[Paper Review] ANPL: Towards Natural Programming with Interactive Decomposition
ANPL is an interactive programming system that enables users to decompose complex programming tasks into structured, modular components using a sketch-and-holes paradigm, where control/data flows are manually defined (sketch) and function implementations are generated via LLMs (holes). It significantly improves user performance on challenging tasks—achieving 75.0% task success on ARC versus 58.4% with vanilla LLMs—by allowing localized, iterative refinement without disrupting the overall program structure.
Though LLMs are capable of generating plausible programs, it's challenging to interact with the LLMs further to revise the program, especially if the user's specific requirements are different from the initial proposal. In this paper, we introduce ANPL, an interactive programming system that ensures users can always refine the generated code towards their specific programmatic intents via structured decompositions. Borrowing the paradigm of sketching from program synthesis, an ANPL program consists of a set of input-outputs that it must satisfy, a ``sketch'' -- control/data flow expressed in precise code (e.g. Python), and ``holes'' -- sub-modules to be implemented by the LLM specified with natural language. The user revises an ANPL program by either modifying the sketch, changing the language used to describe the holes, or providing additional input-outputs to a particular hole, turning it into a sub-ANPL program that can be solved recursively. This workflow allows the users to offload programming burdens to the LLM as much as possible while retaining the ability to pinpoint and resolve bugs locally, without exposing the rest of the program to the LLM. We deploy ANPL on the Abstraction and Reasoning Corpus (ARC), a set of unique tasks that are challenging for state-of-the-art AI systems, showing it outperforms baseline programming systems that (a) without the ability to decompose tasks interactively and (b) without the guarantee that the modules can be correctly composed together. Additional evaluations on APPS, HumanEval, and real-world programming tasks have validated that the ANPL framework is applicable to multiple programming domains. We release the ANPL solutions to the ARC tasks as a dataset, providing insights into how humans decompose novel tasks programmatically. See our code at https://iprc-dip.github.io/ANPL/.
Motivation & Objective
- To address the challenge of iterative debugging and refinement in LLM-generated code, especially when initial outputs are incorrect or incomplete.
- To enable users to maintain control over program structure while offloading implementation details to LLMs through a modular, interactive framework.
- To reduce the cognitive burden of debugging large, monolithic programs by allowing localized edits to individual components.
- To provide a systematic, human-in-the-loop approach to program synthesis that supports recursive decomposition and verification.
- To generate a new dataset (DARC) of human-annotated task decompositions for abstract reasoning and programming tasks.
Proposed method
- ANPL programs are structured as a combination of a user-defined sketch (control and data flow in precise code, e.g., Python) and LLM-generated holes (function modules described in natural language).
- Each hole is a self-contained sub-ANPL program, enabling recursive decomposition and independent refinement.
- The system compiles ANPL code into executable Python and validates it against input-output test cases, generating detailed debugging traces when errors occur.
- Users can refine a program by modifying the sketch, rewriting the natural language description of a hole, or providing new input-output examples to turn a hole into a sub-ANPL task.
- The framework supports iterative interaction: after a failure, users focus only on the faulty hole, preserving the rest of the program’s structure.
- The system was evaluated via a large-scale human study involving 19 Python programmers over 440 man-hours on 400 ARC tasks, with comparisons to vanilla LLM interaction.
Experimental results
Research questions
- RQ1Can interactive decomposition with LLMs significantly improve the success rate of solving complex programming tasks compared to one-shot LLM generation?
- RQ2How does structured decomposition via sketches and natural language holes affect the usability and maintainability of LLM-generated programs?
- RQ3To what extent can users localize debugging efforts without reprocessing the entire program?
- RQ4What insights can be gained from human-annotated task decompositions in abstract reasoning and programming tasks?
- RQ5Can the ANPL framework be generalized across diverse programming domains beyond synthetic benchmarks?
Key findings
- ANPL achieved a 75.0% task success rate on the Abstraction and Reasoning Corpus (ARC), significantly outperforming vanilla LLM interaction (58.4%).
- The system reduced the cognitive load of debugging by enabling users to focus only on faulty holes, preserving the integrity of the overall program structure.
- The DARC dataset, comprising 300 human-annotated decompositions of ARC tasks, provides a valuable resource for studying human-LLM collaboration in program synthesis.
- Users required fewer than 20 interactions per task on average, with System A (10.76 API calls per task) and System B (4.81 API calls per task) showing efficient interaction patterns.
- Case studies demonstrated that users could successfully correct incorrect LLM-generated functions by refining natural language descriptions or adding new input-output examples.
- The framework proved effective across diverse domains, including APPS, HumanEval, and real-world programming tasks, confirming its generalizability.
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.