[Paper Review] Parsel: Algorithmic Reasoning with Language Models by Composing Decompositions
Parsel is a framework that enhances large language models (LLMs) for algorithmic reasoning by decomposing complex tasks into hierarchical natural language function descriptions, then composing correct implementations through combinatorial testing. It achieves pass@1 rates of 85% on HumanEval and over 75% higher pass rates than prior methods on APPS, significantly improving LLM-generated program and robotic plan accuracy by enabling modular, test-driven composition.
Despite recent success in large language model (LLM) reasoning, LLMs struggle with hierarchical multi-step reasoning tasks like generating complex programs. For these tasks, humans often start with a high-level algorithmic design and implement each part gradually. We introduce Parsel, a framework enabling automatic implementation and validation of complex algorithms with code LLMs. With Parsel, we automatically decompose algorithmic tasks into hierarchical natural language function descriptions and then search over combinations of possible function implementations using tests. We show that Parsel can be used across domains requiring hierarchical reasoning, including program synthesis and robotic planning. We find that, using Parsel, LLMs solve more competition-level problems in the APPS dataset, resulting in pass rates over 75\% higher than prior results from directly sampling AlphaCode and Codex, while often using a smaller sample budget. Moreover, with automatically generated tests, we find that Parsel can improve the state-of-the-art pass@1 performance on HumanEval from 67\% to 85\%. We also find that LLM-generated robotic plans using Parsel are more than twice as likely to be considered accurate than directly generated plans. Lastly, we explore how Parsel addresses LLM limitations and discuss how Parsel may be useful for human programmers. We release our code at https://github.com/ezelikman/parsel
Motivation & Objective
- To address the challenge of hierarchical, multi-step reasoning in LLMs when generating complex programs.
- To enable LLMs to decompose high-level algorithmic tasks into modular, composable function descriptions.
- To improve program correctness and efficiency by composing implementations through automated testing and constraint validation.
- To extend LLM capabilities beyond direct generation by enabling structured, hierarchical reasoning similar to human programming.
Proposed method
- Parsel uses a domain-specific intermediate language to represent algorithmic designs as natural language function descriptions with inputs, outputs, and constraints.
- It decomposes tasks into strongly-connected components (SCCs) to manage complexity and avoid combinatorial explosion during synthesis.
- Each function is implemented independently by an LLM, then validated against input-output constraints using a constraint solver.
- The framework supports recursive and higher-order functions by treating dependencies as part of the dependency graph and solving SCCs in topological order.
- It enables zero-shot and few-shot Parsel generation using LLMs, including GPT-4, by prompting with a formalized syntax.
- It integrates automated test generation to validate implementations, reducing reliance on hand-crafted test cases.
Experimental results
Research questions
- RQ1Can LLMs effectively decompose complex algorithmic tasks into modular, composable function descriptions?
- RQ2How does hierarchical decomposition with test-based composition improve LLM performance on program synthesis benchmarks?
- RQ3To what extent can Parsel reduce the failure rate of LLM-generated robotic plans compared to direct generation?
- RQ4Can Parsel achieve state-of-the-art performance on standard benchmarks like HumanEval and APPS without increasing the sample budget?
- RQ5How does Parsel’s modular, constraint-driven approach mitigate the error propagation common in autoregressive code generation?
Key findings
- Parsel improves pass@1 performance on HumanEval from 67% to 85%, significantly outperforming GPT-4 and prior LLM-based methods.
- On the APPS benchmark, Parsel achieves over 75% higher pass rates than direct sampling methods like AlphaCode and Codex, even with a smaller sample budget.
- LLM-generated robotic plans using Parsel are more than twice as likely to be accurate as those generated directly by LLMs.
- The framework enables GPT-4 to generate Parsel programs zero-shot by describing the format, leading to substantial performance gains on both HumanEval and APPS.
- Parsel’s use of automatically generated tests improves correctness and reduces dependency on hand-written test cases, enhancing robustness across domains.
- The SCC-based decomposition strategy effectively controls combinatorial explosion, allowing scalable synthesis of complex, hierarchical programs.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.