Parsel: A Unified Natural Language Framework for Algorithmic Reasoning

Eric Zelikman, Qian Huang, Gabriel Poesia, Noah D. Goodman, Nick HaberarXiv 2022

Introduction: The Challenge of Multi-Step Reasoning

Large Language Models (LLMs) have demonstrated impressive capabilities in generating short code snippets. However, they frequently struggle with complex, hierarchical multi-step reasoning tasks, such as writing intricate programs or developing long-term robotic plans. The primary bottleneck is the "one-shot" nature of token generation: a single error early in a long sequence can derail the entire output. Unlike humans, who approach complex problems by building and testing modular components, standard LLMs attempt to generate solutions in a single, continuous pass.

Methodology: Decomposition and Synthesis

To address these limitations, we introduce Parsel, a framework that functions as a "natural language compiler." Parsel enables LLMs to solve algorithmic tasks by decomposing them into a hierarchy of natural language function descriptions and constraints.

The Parsel framework workflow: decomposing a task into a hierarchy of function descriptions and synthesizing a final program through combinatorial search.

The Parsel process consists of three core stages:

  1. Decomposition: The model breaks a high-level task into a "Parsel program"—a structured hierarchy of function descriptions and associated unit tests.
  2. Implementation: For each sub-function, the LLM generates multiple candidate implementations.
  3. Synthesis: The framework treats the program as a graph, identifying Strongly Connected Components (SCCs) to manage recursive dependencies. It then performs a combinatorial search to find the optimal combination of implementations that satisfy all defined constraints.

This modular approach provides a significant combinatorial advantage. By generating $N$ versions of $K$ sub-functions, Parsel can explore $N^K$ potential program combinations, far exceeding the linear search space of traditional sampling.

Experimental Evaluation

Parsel was evaluated across competition-level programming (APPS), functional correctness benchmarks (HumanEval), and robotic task planning (VirtualHome).

Comparison of Parsel against direct sampling methods (Codex and AlphaCode) on the APPS dataset, showing significantly higher pass rates at lower sample budgets.

On the APPS dataset, Parsel achieved pass rates over 75% higher than direct sampling from models like AlphaCode and Codex, while requiring a substantially smaller sample budget. In HumanEval benchmarks using GPT-4, Parsel improved state-of-the-art pass@1 performance from 67% to 85% when using automatically generated tests. Furthermore, in VirtualHome simulations, robotic plans generated via Parsel were rated twice as accurate as those generated directly by LLMs.

Discussion and Future Work

Parsel demonstrates that enforcing modularity and providing a structured "formalized scratchpad" can significantly enhance the reasoning capabilities of LLMs. By allowing for "mix-and-match" debugging, the framework reduces the error search space and handles complex recursion through graph-theoretic methods.

However, the system remains dependent on the quality of the initial decomposition. Future research will focus on integrating value functions to guide the combinatorial search more efficiently and exploring automatic function infilling to dynamically address missing components during the implementation phase.

Summary updated

BibTeX
@misc{zelikman2022parsel,
  author = {Eric Zelikman and Qian Huang and Gabriel Poesia and Noah D. Goodman and Nick Haber},
  title = {{Parsel: A Unified Natural Language Framework for Algorithmic Reasoning}},
  year = {2022},
  url = {https://openreview.net/forum?id=SN6yO_a1ZJ},
}
Figure