arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.14503cs.SEcs.AI
收藏

规划驱动的编程:一种大语言模型编程工作流

Planning-Driven Programming: A Large Language Model Programming Workflow

School of Computing and Information Systems, The University of Melbourne(计算与信息系统学院,墨尔本大学)

Chao Lei, Yanchuan Chang, Nir Lipovetzky, Krista A. Ehinger

AI总结:

提出一种两阶段LLM编程工作流(LPW),通过计划验证与代码实现分离,显著提升代码生成准确率,在多个基准上创下新纪录。

摘要:

大语言模型(LLM)的强劲性能引发了关于其在代码生成方面应用的广泛讨论。近期研究建议通过可见测试持续改进程序,以提高LLM在代码生成中的准确性。然而,这些方法受限于LLM的低效性和有限的推理能力。在本工作中,我们提出了一种LLM编程工作流(LPW),旨在通过结构化的两阶段工作流改进初始代码生成和后续改进。具体而言,解决方案生成阶段制定解决方案计划,然后通过可见测试验证以明确预期的自然语言解决方案。随后,代码实现阶段根据解决方案计划及其验证结果起草初始代码。如果生成的代码未通过可见测试,则计划验证作为预期解决方案,持续指导改进过程以纠正错误。与各种现有LLM的最先进方法相比,LPW在成熟的文本到代码生成基准上显著提高了Pass@1准确率,最高提升16.4%。LPW还创下了新的最先进Pass@1准确率,在HumanEval上达到98.2%,在MBPP上达到84.8%,在LiveCode上达到59.3%,在APPS上达到62.6%,在CodeContest上达到34.7%,以GPT-4o作为骨干模型。我们的代码公开于:https://github.com/you68681/lpw

英文摘要:

The strong performance of large language models (LLMs) raises extensive discussion on their application to code generation. Recent research suggests continuous program refinements through visible tests to improve code generation accuracy in LLMs. However, these methods suffer from LLMs' inefficiency and limited reasoning capacity. In this work, we propose an LLM programming workflow (LPW) designed to improve both initial code generation and subsequent refinements within a structured two-phase workflow. Specifically, the solution generation phase formulates a solution plan, which is then verified through visible tests to specify the intended natural language solution. Subsequently, the code implementation phase drafts an initial code according to the solution plan and its verification. If the generated code fails the visible tests, the plan verification serves as the intended solution to consistently inform the refinement process for correcting bugs. Compared to state-of-the-art methods across various existing LLMs, LPW significantly improves the Pass@1 accuracy by up to 16.4% on well-established text-to-code generation benchmarks. LPW also sets new state-of-the-art Pass@1 accuracy, achieving 98.2% on HumanEval, 84.8% on MBPP, 59.3% on LiveCode, 62.6% on APPS, and 34.7% on CodeContest, using GPT-4o as the backbone. Our code is publicly available at: https://github.com/you68681/lpw

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑