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

CYCLE:学习自精化代码生成

CYCLE: Learning to Self-Refine the Code Generation

Columbia University(哥伦比亚大学)

Yangruibo Ding, Marcus J. Min, Gail Kaiser, Baishakhi Ray

AI总结:

针对代码语言模型自精化能力不足的问题,提出CYCLE框架,利用测试反馈学习修复错误代码生成,在多个基准上显著提升性能并超越更大规模模型。

摘要:

预训练代码语言模型在代码生成方面取得了令人鼓舞的性能,并提高了人类开发者的编程效率。然而,其自精化能力通常被现有的代码语言模型评估所忽视,这些评估仅关注一次性预测的准确性。对于代码语言模型未能实现正确程序的情况,开发者实际上发现很难调试和修复错误的预测,因为该预测并非由开发者自己编写。不幸的是,我们的研究表明,代码语言模型也无法高效地自精化其错误的生成。在本文中,我们提出了CYCLE框架,根据可用的反馈(例如测试套件报告的执行结果)学习自精化错误的生成。我们在三个流行的代码生成基准HumanEval、MBPP和APPS上评估了CYCLE。结果表明,CYCLE成功维持了(有时甚至提高了)一次性代码生成的质量,同时显著提升了代码语言模型的自精化能力。我们实现了CYCLE的四个变体,参数数量分别为350M、1B、2B和3B,实验表明,CYCLE在各个基准和不同模型规模上持续提升代码生成性能,最高达63.5%。我们还注意到,在自精化方面,CYCLE优于参数量多3倍的代码语言模型。

英文摘要:

Pre-trained code language models have achieved promising performance in code generation and improved the programming efficiency of human developers. However, their self-refinement capability is typically overlooked by the existing evaluations of code LMs, which focus only on the accuracy of the one-time prediction. For the cases when code LMs fail to implement the correct program, developers actually find it hard to debug and fix the faulty prediction since it is not written by the developers themselves. Unfortunately, our study reveals that code LMs cannot efficiently self-refine their faulty generations as well. In this paper, we propose CYCLE framework, learning to self-refine the faulty generation according to the available feedback, such as the execution results reported by the test suites. We evaluate CYCLE on three popular code generation benchmarks, HumanEval, MBPP, and APPS. The results reveal that CYCLE successfully maintains, sometimes improves, the quality of one-time code generation, while significantly improving the self-refinement capability of code LMs. We implement four variants of CYCLE with varied numbers of parameters across 350M, 1B, 2B, and 3B, and the experiments show that CYCLE consistently boosts the code generation performance, by up to 63.5%, across benchmarks and varied model sizes. We also notice that CYCLE outperforms code LMs that have 3$\times$ more parameters in self-refinement.

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

↑