arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2501.12793cs.SEcs.AI
收藏

重新审视使用自生成测试的代码生成自调试

Revisit Self-Debugging with Self-Generated Tests for Code Generation

Peking University(北京大学);Beijing Institute of Technology(北京理工大学);Meituan(美团)

Xiancai Chen, Zhengwei Tao, Kechi Zhang, Changzhi Zhou, Wanli Gu, Yuanpeng He, Mengdi Zhang, Xunliang Cai, Haiyan Zhao, Zhi Jin

AI总结:

本研究重新审视了代码生成中的自调试方法,提出执行后与执行中两种范式,发现后者能利用中间状态减轻自生成测试的偏差,从而提升性能。

摘要:

大型语言模型(LLMs)在代码生成方面已展现出显著进步,但在超出其基本能力的任务上仍面临挑战。近期,自调试的概念被提出,通过利用测试的执行反馈来提升代码生成的性能。尽管其前景广阔,但在现实场景中高质量测试的可用性有限。在此背景下,使用自生成测试的自调试是一种有前景的解决方案,但对其局限性和实际潜力的探索尚不充分。因此,我们研究了其在多样化编程问题上的有效性。为加深理解,我们提出了该过程的两种不同范式:执行后自调试和执行中自调试。在自包含的Python编程任务范围内,我们发现执行后自调试在基础问题上表现不佳,但在竞争性问题上显示出改进潜力,这是由于自生成测试引入的偏差所致。另一方面,执行中自调试使LLMs能够仅利用执行过程中的中间状态来减轻偏差,从而增强代码生成。

英文摘要:

Large language models (LLMs) have shown significant advancements in code generation, but still face challenges on tasks beyond their basic capabilities. Recently, the notion of self-debugging has been proposed to boost the performance of code generation by leveraging execution feedback from tests. Despite its promise, the availability of high-quality tests in real-world scenarios is limited. In this context, self-debugging with self-generated tests is a promising solution but lacks a full exploration of its limitations and practical potential. Therefore, we investigate its efficacy on diverse programming problems. To deepen our understanding, we propose two distinct paradigms for the process: post-execution and in-execution self-debugging. Within the scope of self-contained Python programming tasks, we find that post-execution self-debugging struggles on basic problems but shows potential for improvement on competitive ones, due to the bias introduced by self-generated tests. On the other hand, in-execution self-debugging enables LLMs to mitigate the bias by solely leveraging intermediate states during execution, thereby enhancing code generation.

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

↑