LLM-Guided Compositional Program Synthesis
Ruhma Khan, Sumit Gulwani, Vu Le, Arjun Radhakrishna, Ashish Tiwari, Gust Verbruggen
TL;DR
This work tackles the instability of LLM-driven program synthesis by introducing SymLLM, a failure-guided compositional approach that salvages prefix or suffix fragments of an initially generated program and solves the remaining subproblems via forward and backward execution semantics. Four synthesis strategies—ForwardAll, Forward1, Backward1, and IfThenElse—drive the decomposition and recursive resolution of PBE tasks, with a disciplined, shallow recursion depth to maintain efficiency. Empirical results on Playgol-derived benchmarks show that Compositional SymLLM solves a meaningful portion of challenging Python tasks beyond self-reflection, and the method adapts to Excel-formula targets with complementary performance patterns. The work demonstrates that decomposing PBE problems into solvable subproblems, guided by LLMs and underpinned by dataflow-inspired salvor strategies, yields scalable gains and broadens the applicability of LLM-assisted program synthesis in practical settings.
Abstract
Program synthesis from input-output examples, also called programming by example (PBE), has had tremendous impact on automating end-user tasks. Large language models (LLMs) have the ability to solve PBE tasks by generating code in different target languages, but they can fail unpredictably. To recover for failure, most approaches, such as self-reflection, use the LLM to solve the same task, but with a richer context. We introduce a novel technique that recovers from failure by constructing simpler subtasks for the LLM to solve. Our approach performs compositional program synthesis using LLMs, where LLM not only guides the decomposition of the PBE task into subtasks, but also solves the subtasks. We present different strategies for decomposing the original task. We experimentally show that our approach can solve challenging task instances that are not solved by self-reflection alone.
