Inferring Generative Model Structure with Static Analysis

Paroma Varma, Bryan D. He, Payal Bajaj, Nishith Khandwala, Imon Banerjee, Daniel L. Rubin, Christopher Ré

TL;DR

The "Coral" paradigm improves weak supervision by using static analysis of source code to automatically infer dependencies between labeling heuristics. By looking at the code instead of just the data, Coral avoids the exponential complexity of traditional structure learning, leading to more accurate models with significantly less data.

What Problem Does This Paper Address?

In modern machine learning, the biggest bottleneck is often obtaining enough labeled data. "Weak supervision" solves this by using programmatic heuristics (labeling functions) to create training sets. However, these heuristics are rarely independent; if two functions rely on the same underlying feature, their errors will be correlated.

Existing methods try to learn these dependency structures statistically from the labels themselves. The problem is that as dependencies become more complex (involving three or more functions), the amount of data and time needed to learn them grows exponentially. This makes it nearly impossible to model the high-order relationships common in complex domains like medical imaging or computer vision.

Methods

The authors introduce Coral, a system that treats the source code of labeling heuristics as a primary source of information to infer generative model structure.

The Coral Pipeline
  1. Domain-Specific Primitives (DSPs): Users define basic, interpretable features (e.g., the "area" or "intensity" of a tumor).
  2. Static Analysis: Instead of running the code and looking at the output, Coral parses the source code of the heuristics and the DSPs into Abstract Syntax Trees (ASTs).
Static analysis of heuristic source code into Abstract Syntax Trees

By traversing these trees, Coral identifies which heuristics share the same input primitives or "composed" primitives (e.g., a "ratio" primitive built from "area" and "perimeter").

  1. Generative Factor Graph: Coral uses these inferred relationships to build a factor graph. This model represents the relationship between the primitives, the noisy labels from the heuristics, and the unknown "true" label.
  2. Weight Learning: Because the structure is already known from the code, the system only needs to learn the weights (the accuracy of each heuristic). This is done using contrastive divergence, which requires far less data than learning the structure from scratch.

Datasets

The authors evaluated Coral across four diverse domains:

  • Visual Genome: Identifying "person biking" in images.
  • ActivityNet: Identifying "basketball" in video clips.
  • Bone Tumor Classification: A specialized medical dataset of 802 X-ray images with radiologist-drawn segmentations.
  • Mammogram Tumor Classification (DDSM-CBIS): 1,800 scanned film mammograms used to identify malignant vs. benign tumors.

Key Insights and Ideas

  • Code as a Metadata Source: The core "aha moment" is that the structure of a generative model is often already encoded in the logic of the labeling functions. We don't need to guess if two functions are related if we can see they both call the same variable.
  • Breaking the Complexity Barrier: Traditional structure learning scales exponentially ($O(2^n)$) with the degree of dependency. Coral scales quasilinearly ($O(n \log n)$). This allows it to handle complex, high-order relationships that were previously computationally out of reach.
  • Primitive Composition Matters: It’s not enough to know which variables a function uses. Coral tracks how those variables are transformed (e.g., if Function A uses x and Function B uses z = x/y, Coral correctly identifies the dependency between A and B).

Key Results

  • Performance Gains: Coral outperformed standard structure learning approaches by up to 3.81 F1 points.
  • Beating Full Supervision: In the Bone Tumor task, using Coral to label an additional 800 unlabeled images resulted in a model that was 3.07 accuracy points better than a model trained on the original fully supervised (hand-labeled) dataset.
  • Efficiency: In the Visual Genome task, just 6 simple heuristics were able to train a model that performed within 0.74 F1 points of a model trained on rich, hand-labeled gold-standard data.
  • Simulation: In controlled tests, as the degree of dependency increased (from binary to 4-ary), traditional methods failed to recover the structure even with more data, while Coral remained stable and accurate.

Limitations and Future Work

  • Programmatic Constraints: Coral requires heuristics to be written in a specific way (using defined DSPs) so the static analyzer can track them. It cannot analyze "black box" functions or pre-compiled binaries.
  • Spurious Dependencies: Static analysis might flag a dependency because two functions share a primitive, even if that primitive doesn't actually cause a meaningful correlation in the specific dataset being used.
  • Future Directions: The authors suggest exploring more advanced programming language concepts, such as how different control flow structures (like complex nested loops) might imply different types of statistical dependencies.

Summary updated

BibTeX
@inproceedings{varma2017inferring,
  author = {Paroma Varma and Bryan D. He and Payal Bajaj and Nishith Khandwala and Imon Banerjee and Daniel L. Rubin and Christopher Ré},
  title = {{Inferring Generative Model Structure with Static Analysis}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2017},
  url = {https://openreview.net/forum?id=Sy-T0LWObS},
}

Loading related content...

Figure