arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.02783cs.CLcs.AIcs.LG
收藏

教你的模型通过焦点偏好对齐理解代码

Teaching Your Models to Understand Code via Focal Preference Alignment

Tsinghua University(清华大学);Microsoft Research(微软研究院);CASIA(中国科学院自动化研究所);Wuhan University(武汉大学)

Jie Wu, Haoling Li, Xin Zhang, Xiao Liu, Yangyu Huang, Jianwen Luo, Yizhen Zhang, Zuchao Li, Ruihang Chu, Yujiu Yang, Scarlett Li

AI总结:

针对现有偏好学习粒度不足的问题,提出Target-DPO框架,通过定位错误区域并定制DPO算法对齐标记,结合CodeFlow数据集,显著提升代码大语言模型的生成性能并减少错误。

摘要:

偏好学习通过利用相对质量比较,将代码大语言模型的性能扩展到传统的监督微调之外。在现有方法中,一组n个候选解决方案根据测试用例成功率进行评估,通过率较高的候选被标记为正样本,而通过率较低的对应候选被标记为负样本。然而,由于这种方法对齐整个失败的代码块而不是精确定位具体错误,它缺乏捕获有意义的错误-修正关系所需的粒度。因此,模型无法学习更具信息量的错误-修正模式。为了解决这些问题,我们提出了Target-DPO,一种新的偏好对齐框架,模拟人类迭代调试来优化代码大语言模型。Target-DPO显式定位错误区域,并通过定制的DPO算法对齐相应的标记。为促进这一点,我们引入了CodeFlow数据集,其中样本被迭代细化直到通过测试,修改捕获错误修正。大量实验表明,配备Target-DPO的多种代码大语言模型在代码生成方面取得了显著的性能提升,并在BigCodeBench等具有挑战性的任务上有所改进。深入分析显示,Target-DPO产生的错误更少。代码、模型和数据集位于:https://github.com/JieWu02/Target-DPO。

英文摘要:

Preference learning extends the performance of Code LLMs beyond traditional supervised fine-tuning by leveraging relative quality comparisons. In existing approaches, a set of n candidate solutions is evaluated based on test case success rates, with the candidate demonstrating a higher pass rate being labeled as positive and its counterpart with a lower pass rate as negative. However, because this approach aligns entire failing code blocks rather than pinpointing specific errors, it lacks the granularity necessary to capture meaningful error-correction relationships. As a result, the model is unable to learn more informative error-correction patterns. To address these issues, we propose Target-DPO, a new preference alignment framework that mimics human iterative debugging to refine Code LLMs. Target-DPO explicitly locates error regions and aligns the corresponding tokens via a tailored DPO algorithm. To facilitate it, 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 Target-DPO achieves significant performance gains in code generation and improves on challenging tasks like BigCodeBench. In-depth analysis reveals that Target-DPO yields fewer errors. Code, model and datasets are in: https://github.com/JieWu02/Target-DPO.

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

↑