Abstract
Programming by Example (PBE) systems often struggle with ambiguity, frequently selecting an incorrect program when provided with only a few examples. This paper presents Disjunctive Program Synthesis, a novel approach that delays the selection of the final program until execution time. By maintaining a set of candidate programs (disjuncts) and using feature calculators to evaluate their outputs on live data, the system significantly improves robustness. Evaluation on 47 real-world extraction tasks shows that this method increases the success rate for one-shot learning from 59.6% to 93.6%.
Introduction: The Fragility of PBE
Programming by Example (PBE) allows users to automate repetitive data tasks by providing a few input-output demonstrations. A classic example is extracting specific identifiers from a messy text column, as seen in systems like Excel's Flash Fill.
Despite their utility, these systems face a fundamental "expressivity vs. correctness" trade-off. Because a single example can be satisfied by many different logic strings, the system must use a ranking heuristic to pick the "most likely" program. This ranking happens at synthesis time, when the system has very little information. If the system picks a program that is too specific (overfitting) or too general, the automation will fail when it encounters a slightly different row of data. This "premature commitment" is the primary cause of fragility in modern PBE.
Methods: Delaying the Decision
The authors propose a shift in philosophy: rather than choosing the best program during synthesis, the system should choose it during execution.
- The Disjunctive Operator (
Disj): The researchers extended Domain Specific Languages (DSLs) with a new operator that holds an array of candidate programs (disjuncts) instead of a single result. - Feature Calculators: Along with the programs, the
Disjoperator stores "feature calculators"—small functions that measure properties of the output (e.g., "Is the output 9 characters long?", "Is it non-null?"). - Delayed Ranking: When the synthesized program runs on a new input, it executes all candidate disjuncts. It then evaluates the outputs using the feature calculators to see which output most closely resembles the "shape" of the original examples. The program that "looks right" for that specific input is selected on the fly.
By keeping the top 10 candidates instead of just one, the system creates a safety net. If the top-ranked program fails on a unique edge case, a lower-ranked program that handles that specific variation can take over.
Evaluation and Results
The researchers evaluated their approach using 47 complex extraction tasks provided by a Microsoft product team, involving the extraction of fields like flight numbers or confirmation codes from semi-structured emails. They compared their disjunctive approach against a state-of-the-art baseline PBE system.
The results demonstrated a dramatic improvement in "one-shot" learning. The percentage of tasks where a correct program could be learned from just a single example jumped from 59.6% (baseline) to 93.6% (disjunctive). While running multiple programs causes a slight performance overhead, it averaged only 2.9x, with all tasks finishing in under two seconds—well within the threshold for a responsive user interface.
Conclusion
Disjunctive Program Synthesis addresses the core weakness of PBE by leveraging execution-time context. By treating synthesis as a process of generating a set of plausible hypotheses rather than a single absolute truth, the system becomes significantly more robust to the ambiguities inherent in small example sets. Future work will focus on automating the creation of feature calculators and exploring more sophisticated scoring functions to further refine disjunct selection.
Summary updated