Introduction
Program synthesis—the automated generation of executable code from high-level specifications like input-output examples—has traditionally been divided into two competing paradigms. Symbolic search methods offer mathematical precision and correctness but are often crippled by the "combinatorial explosion," where the search space grows exponentially with program length. Conversely, Large Language Models (LLMs) demonstrate remarkable intuition for identifying relevant code components but frequently fail to produce perfectly correct, executable code in specialized domain-specific languages (DSLs).
A fundamental technical barrier prevents the seamless integration of these two approaches: state-of-the-art symbolic search algorithms, such as bottom-up search, are context-free, while LLMs rely on extensive left-to-right context. HYSYNTH addresses this gap by approximating LLM intuition as a task-specific context-free grammar, effectively bridging neural creativity with symbolic rigor.
The HYSYNTH Framework
HYSYNTH employs a three-stage pipeline to synthesize programs efficiently. First, the system prompts an LLM to generate multiple candidate solutions for a given task. Because these candidates are used only as guidance, they do not need to be correct or even syntactically perfect.
Second, HYSYNTH performs a Context-Free Approximation. It parses the LLM's outputs to construct a task-specific Probabilistic Context-Free Grammar (PCFG). This surrogate model acts as a statistical summary of the LLM's "intent," assigning higher probabilities (and lower search costs) to operators and constants that appear frequently in the LLM's guesses. A key innovation here is the "non-strict mode," which allows HYSYNTH to perform lexical analysis on syntactically broken LLM code to extract useful building blocks rather than discarding the output entirely.
Finally, a Guided Bottom-Up Search uses these derived costs to prioritize the exploration of the most likely program candidates. By focusing the search on the "neighborhood" suggested by the LLM, the synthesizer can find complex solutions that would be unreachable via unguided search.
Experimental Evaluation
The researchers evaluated HYSYNTH across 299 tasks in three distinct domains:
- ARC (Abstraction and Reasoning Corpus): Logic puzzles involving grid manipulations.
- TENSOR: Real-world TensorFlow manipulation tasks sourced from StackOverflow.
- STRING: Spreadsheet-style string transformations.
Results and Discussion
HYSYNTH consistently outperformed unguided search, direct LLM sampling, and specialized state-of-the-art synthesizers. Across all domains, the framework achieved a 58% success rate, significantly higher than the 40% achieved by unguided search and the 6% achieved by direct GPT-4o sampling.
In the TENSOR domain specifically, HYSYNTH demonstrated a clear advantage over TFCODER, a specialized tool for TensorFlow synthesis. By automatically extracting constants and relevant operators from LLM guesses, HYSYNTH reduces the manual effort required from users while increasing the likelihood of finding a solution within a fixed time budget.
Efficiency gains were equally notable. On complex ARC tasks, HYSYNTH achieved up to a 4x speedup compared to unguided search. Furthermore, the system proved to be highly sample-efficient; as few as 10 LLM samples provided sufficient guidance to outperform baseline models. This suggests that HYSYNTH effectively treats LLM "hallucinations" as features rather than bugs, mining near-misses for the essential building blocks of a correct solution.
Conclusion
HYSYNTH demonstrates that while a PCFG is a lossy approximation of an LLM's full reasoning capabilities, it is a highly functional bridge for program synthesis. By converting neural intuition into a format compatible with symbolic search, HYSYNTH achieves a level of performance and robustness that neither paradigm can reach in isolation. Future work will explore more expressive surrogate models that can capture context while maintaining the efficiency of dynamic programming search.
Summary updated