2025-03-05 · 进阶 · 机器学习 · 计算机视觉

IterPref: Focal Preference Learning for Code Generation via Iterative Debugging

IterPref通过模仿人类迭代调试过程,为代码生成中的偏好学习提供了一种新的框架,显著提高了代码生成准确性和复杂编码任务的处理能力。

更新于 2025-05-20。作者:Jie Wu、Haoling Li、Xin Zhang、Jianwen Luo、Yangyu Huang、Ruihang Chu、Yujiu Yang、Scarlett Li。

中文摘要

偏好学习通过利用相对质量比较来增强代码LLMs,超越了监督微调。现有方法通过测试用例的成功率从候选者中构建偏好对,将通过率更高的样本视为正面,较低的视为负面。然而,这种方法并没有指出代码中的具体错误,这阻碍了模型学习更有信息的错误纠正模式,因为将整个失败的代码对齐缺乏捕捉有意义的错误解决关系的粒度。为了解决这些问题,我们提出了IterPref,一个模仿人类迭代调试以精炼代码LLMs的新偏好对齐框架。IterPref通过定制的DPO算法明确定位错误区域并对齐相应的标记。为了生成有信息量的对,我们引入了CodeFlow数据集,其中样本经过迭代优化直至通过测试,修改部分捕捉错误纠正。广泛的实验表明,配备IterPref的多样化代码LLMs在代码生成方面实现了显著的性能提升,并在BigCodeBench等具有挑战性的任务上取得了进步。深入分析显示,IterPref产生的错误更少。我们的代码和数据将公开提供。

英文摘要

Preference learning enhances Code LLMs beyond supervised fine-tuning by leveraging relative quality comparisons. Existing methods construct preference pairs from candidates based on test case success, treating the higher pass rate sample as positive and the lower as negative. However, this approach does not pinpoint specific errors in the code, which prevents the model from learning more informative error correction patterns, as aligning failing code as a whole lacks the granularity needed to capture meaningful error-resolution relationships. To address these issues, we propose IterPref, a new preference alignment framework that mimics human iterative debugging to refine Code LLMs. IterPref explicitly locates error regions and aligns the corresponding tokens via a tailored DPO algorithm. To generate informative pairs, we introduce the CodeFlow dataset, where samples are iteratively refined until passing tests, with modifications capturing error corrections. Extensive experiments show that a diverse suite of Code LLMs equipped with IterPref achieves significant performance gains in code generation and improves on challenging tasks like BigCodeBench. In-depth analysis reveals that IterPref yields fewer errors. Our code and data will be made publicaly available.

解读

一句话总结

IterPref通过模仿人类迭代调试过程,为代码生成中的偏好学习提供了一种新的框架,显著提高了代码生成准确性和复杂编码任务的处理能力。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt