[论文解读] ANPL: Towards Natural Programming with Interactive Decomposition
ANPL 是一种交互式编程系统,通过草图与填空范式,使用户能够将复杂编程任务分解为结构化、模块化的组件,其中控制/数据流由用户手动定义(草图),函数实现则由大语言模型生成(填空)。通过支持局部化、迭代式改进而不破坏整体程序结构,该系统显著提升了用户在复杂任务上的表现——在 ARC 上的任务成功率从原始 LLM 的 58.4% 提升至 75.0%。
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/.
研究动机与目标
- 为解决大语言模型生成代码时迭代调试与改进的挑战,特别是初始输出存在错误或不完整时的问题。
- 通过模块化、交互式的框架,使用户在保持对程序结构控制的同时,将实现细节交由大语言模型处理。
- 通过允许对单个组件进行局部修改,降低调试大型单体程序的认知负担。
- 提供一种系统化的人机协同程序合成方法,支持递归分解与验证。
- 构建一个新的数据集(DARC),包含人类标注的抽象推理与编程任务的分解结果。
提出的方法
- ANPL 程序由用户定义的草图(以精确代码形式表达的控制流与数据流,例如 Python)和大语言模型生成的填空(以自然语言描述的函数模块)组合而成。
- 每个填空都是一个独立的子-ANPL 程序,支持递归分解与独立改进。
- 系统将 ANPL 代码编译为可执行的 Python 代码,并通过输入-输出测试用例验证其正确性,错误时生成详细的调试追踪信息。
- 用户可通过修改草图、重写填空的自然语言描述,或提供新的输入-输出示例,将一个填空转化为子-ANPL 任务,从而对程序进行改进。
- 该框架支持迭代交互:在失败后,用户仅需关注故障填空,保留程序其余部分的结构不变。
- 通过一项大规模人工研究对系统进行了评估,共涉及 19 名 Python 程序员,耗时 440 人时,完成 400 个 ARC 任务,与原始 LLM 交互方式进行了对比。
实验结果
研究问题
- RQ1与一次性生成 LLM 相比,使用 LLM 进行交互式分解是否能显著提高解决复杂编程任务的成功率?
- RQ2通过草图与自然语言填空实现的结构化分解,在 LLM 生成程序的可用性与可维护性方面有何影响?
- RQ3用户在多大程度上可以将调试工作局部化,而无需重新处理整个程序?
- RQ4从人类标注的抽象推理与编程任务分解中,可以获取哪些关于人-LLM 协作程序合成的洞见?
- RQ5ANPL 框架是否可泛化至合成基准之外的多样化编程领域?
主要发现
- ANPL 在抽象与推理语料库(ARC)上实现了 75.0% 的任务成功率,显著优于原始 LLM 交互方式(58.4%)。
- 该系统通过允许用户仅关注故障填空,显著降低了调试的认知负担,同时保持了整体程序结构的完整性。
- DARC 数据集包含 300 个 ARC 任务的人工标注分解,为研究人-LLM 协作程序合成提供了宝贵资源。
- 用户平均每个任务的交互次数少于 20 次,其中系统 A(平均每个任务 10.76 次 API 调用)与系统 B(平均每个任务 4.81 次 API 调用)均表现出高效的交互模式。
- 案例研究显示,用户可通过细化自然语言描述或添加新的输入-输出示例,成功修正 LLM 生成的错误函数。
- 该框架在多样化领域(包括 APPS、HumanEval 和真实世界编程任务)中均表现有效,证实了其泛化能力。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。