arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2305.04087cs.SEcs.CL
收藏

Self-Edit:用于代码生成的容错代码编辑器

Self-Edit: Fault-Aware Code Editor for Code Generation

Peking University(北京大学)

Kechi Zhang, Zhuo Li, Jia Li, Ge Li, Zhi Jin

AI总结:

提出Self-Edit方法,利用LLMs生成代码的执行结果作为补充注释指导容错编辑器纠正错误,在多个数据集和模型上显著提升pass@1准确率。

摘要:

大型语言模型(LLMs)在竞赛编程任务中展现出了令人印象深刻的代码生成能力。然而,在样本数量有限的情况下,LLMs的准确率仍然较差。受人类编程过程的启发,我们提出了一种名为Self-Edit的生成并编辑方法,该方法利用LLMs生成代码的执行结果来提高竞赛编程任务中的代码质量。我们在问题中提供的示例测试用例上执行生成的代码,并将执行结果包装成补充注释。利用该注释作为指导,我们采用容错代码编辑器来纠正生成代码中的错误。我们在两个竞赛编程数据集上使用九个不同的LLMs进行了广泛的评估。与直接从LLMs生成相比,我们的方法在APPS-dev上平均提高了pass@1的89%,在APPS-test上提高了31%,在HumanEval上提高了48%,涵盖了参数规模从110M到175B的九个流行代码生成LLMs。与其他后处理方法相比,我们的方法展现出更高的准确性和效率。

英文摘要:

Large language models (LLMs) have demonstrated an impressive ability to generate codes on competitive programming tasks. However, with limited sample numbers, LLMs still suffer from poor accuracy. Inspired by the process of human programming, we propose a generate-and-edit approach named Self-Edit that utilizes execution results of the generated code from LLMs to improve the code quality on the competitive programming task. We execute the generated code on the example test case provided in the question and wrap execution results into a supplementary comment. Utilizing this comment as guidance, our fault-aware code editor is employed to correct errors in the generated code. We perform extensive evaluations across two competitive programming datasets with nine different LLMs. Compared to directly generating from LLMs, our approach can improve the average of pass@1 by 89\% on APPS-dev, 31\% on APPS-test, and 48\% on HumanEval over nine popular code generation LLMs with parameter sizes ranging from 110M to 175B. Compared to other post-processing methods, our method demonstrates superior accuracy and efficiency.

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

↑