Abstract
Program synthesis from few examples often faces a combinatorial explosion in search space. We present DA&C (Divide, Align & Conquer), a strategy implemented in the agent BEN. By segmenting individual examples into components and using analogical reasoning to align them, BEN significantly reduces the search space, achieving high efficiency on string transformation tasks and the Abstract Reasoning Corpus (ARC). BEN generates 99.8% fewer candidate programs than traditional brute-force search methods while maintaining competitive accuracy.
Introduction
Generating code automatically from input/output examples is a core challenge in artificial intelligence. Traditional "Divide and Conquer" methods typically partition the set of examples, which proves insufficient for complex tasks where a single example requires multi-step transformations. The DA&C strategy addresses this by decomposing the problem at the component level within a single example—such as objects in an image or substrings in a schedule—mimicking human compositional reasoning.
Methodology: The DA&C Pipeline
The BEN agent implements the DA&C strategy through a three-stage pipeline designed to manage complexity through structural decomposition and analogical alignment.
1. Divide (Segmentation)
BEN first learns to segment examples into meaningful components. In the string domain, this involves identifying delimiters like commas to isolate data fields. In visual tasks, such as those in the ARC benchmark, it identifies distinct objects based on features like color and spatial proximity.
2. Align (Analogical Reasoning)
To avoid the factorial complexity of matching input components to output components, BEN employs the Structure-Mapping Engine (SME). SME is a computational model of human analogy that aligns components based on their relational structure (e.g., relative positioning). This process effectively prunes the search space by prioritizing the most meaningful correspondences.
3. Conquer (Synthesis & Concept Learning)
- Synthesis: BEN performs a shallow search to find transformations for each aligned pair. It utilizes "holes" in the program grammar, where parameters like target colors or coordinates are directly inferred from the output component rather than being searched for.
- Concept Learning: Once a transformation is identified, BEN learns a "rule condition" (a Boolean classifier) to determine when to apply that specific transformation to new, unseen components.
Evaluation and Results
BEN was evaluated on two distinct benchmarks: a dataset of 130 real-world string transformation tasks and the notoriously difficult Abstract Reasoning Corpus (ARC).
String Transformations
On string tasks, such as extracting timestamps from meeting schedules, BEN achieved 80% accuracy with only three training examples. This performance significantly outperformed state-of-the-art Inductive Logic Programming (ILP) systems like Brute (70%) and Metagol (40%), while completing tasks nearly twice as fast (15s vs 28-37s).
Abstract Reasoning Corpus (ARC)
BEN solved 22.5% of the ARC training set using only 11 generic geometric primitives. While specialized solvers have achieved higher raw scores, BEN's significance lies in its search efficiency: it explored only 0.2% as many candidate programs as the 2020 Kaggle winner (approximately 3,300 vs 1.3 million per task), demonstrating superior sample efficiency in search.
Key Insights
- Analogy as a Search Heuristic: Structural alignment transforms a potentially $O(N!)$ matching problem into a guided search, drastically reducing the time to find solutions.
- Monotonic Accuracy: Unlike traditional ILP, where more examples can complicate the search, DA&C benefits from additional data as it improves the agent's ability to learn robust "Concept" rules.
- Complexity Offloading: By decomposing tasks, complex programs with high logical depth are synthesized as a series of shallow searches, reducing the search space by orders of magnitude.
Limitations and Future Work
DA&C currently assumes that tasks are composed of independent object transformations, which limits its effectiveness on tasks with sequential dependencies (e.g., layering objects). Furthermore, the "Divide" step remains a bottleneck; BEN's automated segmentations matched human intuition only 38% of the time. Future research will explore integrating neural-guided search to improve context-sensitive feature selection and segmentation accuracy.
Summary updated