arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.11475cs.SE
收藏

Focused-DPO:通过在易错点上进行聚焦偏好优化增强代码生成

Focused-DPO: Enhancing Code Generation Through Focused Preference Optimization on Error-Prone Points

Kechi Zhang, Ge Li, Jia Li, Yihong Dong, Jia Li, Zhi Jin

AI总结:

本文提出Focused-DPO框架,通过错误点识别方法定位易错区域并将偏好优化聚焦于这些关键点,从而显著提升代码生成模型的准确性与可靠性。

摘要:

代码生成模型在自动化编程任务方面已展现出巨大潜力。然而,由于该任务具有高度复杂和长推理的特性,生成准确且可靠的代码仍然面临挑战。即使是最先进的模型也常常因微小错误而在代码生成中失败,这些错误会严重影响代码的整体功能。我们的研究发现,当前模型产生的错误往往集中在特定的易错点上,这显著影响了生成代码的准确性。为了解决这一问题,我们提出了Focused-DPO框架,该框架通过将偏好优化引导至这些关键的易错区域来增强代码生成。该方法建立在Direct Preference Optimization(直接偏好优化)的基础上,强调易出错部分的准确性。此外,我们开发了一种名为Error-Point Identification(错误点识别)的方法,该方法构建了一个针对这些有问题点的数据集,而无需昂贵的人工标注。我们在HumanEval(+)、MBPP(+)和LiveCodeBench等基准上的实验表明,Focused-DPO显著提高了代码生成的精确性和可靠性,减少了常见错误并提升了整体代码质量。通过聚焦易错点,Focused-DPO提升了模型生成代码的准确性和功能性。

英文摘要:

Code generation models have shown significant potential for automating programming tasks. However, the challenge of generating accurate and reliable code persists due to the highly complex and long-reasoning nature of the task. Even state-of-the-art models often fail in code generation due to small errors, which can drastically affect the overall functionality of code. Our study identifies that current models tend to produce errors concentrated at specific error-prone points, which significantly impacts the accuracy of the generated code. To address this issue, we introduce Focused-DPO, a framework that enhances code generation by directing preference optimization towards these critical error-prone areas. This approach builds on Direct Preference Optimization, emphasizing accuracy in parts prone to errors. Additionally, we develop a method called Error-Point Identification, which constructs a dataset that targets these problematic points without requiring costly human annotations. Our experiments on benchmarks such as HumanEval(+), MBPP(+), and LiveCodeBench demonstrate that Focused-DPO significantly improves the precision and reliability of code generation, reducing common errors and enhancing overall code quality. By focusing on error-prone points, Focused-DPO advances the accuracy and functionality of model-generated code.

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

↑