TL;DR
This paper introduces SYMLLM, a novel approach to program synthesis from input-output examples that leverages Large Language Models (LLMs) to decompose complex tasks into simpler subtasks. By intelligently breaking down problems and having LLMs solve these smaller pieces, SYMLLM can tackle challenging synthesis tasks that current LLM-based self-reflection methods fail to solve.
What Problem Does This Paper Address?
Automating the creation of computer programs from examples, known as Programming by Example (PBE), has been a long-standing goal in computer science. While traditional symbolic methods excelled at this for specific domains, they struggled with scalability and flexibility. The advent of Large Language Models (LLMs) has opened new avenues for PBE, allowing synthesis in various languages and handling natural language specifications. However, LLMs are prone to unpredictable failures. Existing methods to overcome these failures, like self-reflection, often involve the LLM retrying the same task with more context. This paper addresses the limitation of LLMs failing on complex PBE tasks by proposing a compositional approach that breaks down the problem into smaller, more manageable subtasks for the LLM to solve.
Methods
SYMLLM employs a compositional program synthesis strategy guided by LLMs. When an initial LLM-generated program fails to solve a PBE task, SYMLLM doesn't simply retry the same task. Instead, it decomposes the failed program into simpler subtasks. The LLM is then used for two key roles:
- Guiding Decomposition: The LLM helps identify how to break down the original, failed program into smaller, more manageable components.
- Solving Subtasks: The LLM is tasked with solving these newly created subtasks.
The paper details four specific decomposition strategies:
- ForwardAll: Salvages the entire incorrect program and asks the LLM to synthesize a new program that transforms its output to the desired output.
- Forward1: Salvages the "prefix" of the incorrect program (operations on inputs) and asks the LLM to synthesize the remaining part.
- Backward1: Salvages the "suffix" of the incorrect program (operations producing the output) and asks the LLM to synthesize the preceding parts. This involves a novel use of LLMs for "back-propagation" to infer intermediate values.
- IfThenElse: Used when a program partially succeeds. It splits the examples into those that work and those that don't, and then uses LLMs to synthesize two programs and a condition to switch between them.
Datasets
The primary dataset used for evaluation is Playgol [Cropper, 2019], a collection of 327 real-world string transformation tasks. The authors created a challenging benchmark set called SYMLLM-playgol-py by filtering out "easy" tasks that could be solved by a single LLM call or a few iterations of self-reflection. This resulted in 665 PBE tasks. They also evaluated on FlashFill [Cambronero et al., 2023] and a Conditionals benchmark set. For experiments targeting Excel formulas, they used a similar filtered dataset named SYMLLM-playgol-xl, containing 1134 tasks.
Key Insights and Ideas
- Decomposition is Key: The core insight is that breaking down a complex, failed program into simpler subtasks is more effective than repeatedly asking an LLM to solve the same difficult problem.
- LLMs as Decomposers and Solvers: LLMs are not just used to generate code but also to intelligently guide the decomposition process and solve the resulting subproblems.
- Leveraging Symbolic Synthesis Ideas: The Forward and Backward synthesis concepts from traditional PBE are adapted and integrated with LLMs.
- Backward Synthesis with LLMs: The paper introduces an innovative use of LLMs for "back-propagating" values in backward synthesis, a task traditionally handled by symbolic inverse semantics.
- Compositional Power: Combining multiple LLM calls through decomposition significantly boosts the success rate on challenging PBE tasks.
Key Results
SYMLLM, using its four strategies, was able to solve approximately 31.6% of challenging PBE tasks in the SYMLLM-playgol-py benchmark that were not solvable by self-reflection alone. For Excel formulas, the combined strategies achieved a 19.7% success rate on the SYMLLM-playgol-xl benchmark. The IfThenElse strategy showed improved performance on a dedicated "Conditionals" benchmark, validating its utility for tasks requiring conditional logic. The paper highlights that each decomposition strategy can solve unique benchmarks, demonstrating the value of having multiple approaches.
Limitations and Future Work
The authors acknowledge that their current implementation limits recursion depth to one for efficiency. They also note that the success of their approach relies on the assumption that either the prefix/suffix of the wrong program is salvageable, or that the wrong program is a branch of a correct conditional program. Future work could explore deeper recursion, different tactics for applying strategies, and alternative ways to extract program parts for decomposition. Integrating SYMLLM into an agentic framework is also suggested as an exciting avenue. The paper also mentions challenges with Excel formula synthesis due to incomplete parsers and execution engines.
Summary updated