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

DSTC:仅利用自生成测试与代码的直接偏好学习以改进代码语言模型

DSTC: Direct Preference Learning with Only Self-Generated Tests and Code to Improve Code LMs

Northwestern University(西北大学);ByteDance Inc.(字节跳动公司)

Zhihan Liu, Shenao Zhang, Yongfei Liu, Boyi Liu, Yingxiang Yang, Zhaoran Wang

AI总结:

针对代码LM偏好数据稀缺问题,提出DSTC框架,仅用自生成代码与测试构建可靠偏好对,结合极小极大选择和测试-代码拼接,在多个基准上稳定提升pass@1。

摘要:

直接偏好学习为改进代码大语言模型(LM)的代码生成提供了一种超越监督微调(SFT)且具有计算效率的有前景方法。然而,可靠偏好数据的稀缺成为直接偏好学习提升代码LM编码准确率性能的瓶颈。本文提出 Direct Preference Learning with Only Self-Generated Tests and Code(DSTC),这是一个仅利用自生成代码片段和测试来构建可靠偏好对的框架,使直接偏好学习无需外部标注即可提升LM编码准确率。DSTC结合极小极大选择过程和测试-代码拼接来提高偏好对质量,减少错误自生成测试的影响,并在无需昂贵奖励模型的情况下增强模型性能。当与 Direct Preference Optimization(DPO)和 Kahneman-Tversky Optimization(KTO)等直接偏好学习方法结合使用时,DSTC在 HumanEval、MBPP 和 BigCodeBench 等多种编码基准上稳定提升了编码准确率(pass@1 分数),证明了其在不同规模模型上的有效性和可扩展性。该方法可自主提升不同规模LLM的代码生成准确率,减少对昂贵标注编码数据集的依赖。

英文摘要:

Direct preference learning offers a promising and computation-efficient beyond supervised fine-tuning (SFT) for improving code generation in coding large language models (LMs). However, the scarcity of reliable preference data is a bottleneck for the performance of direct preference learning to improve the coding accuracy of code LMs. In this paper, we introduce \underline{\textbf{D}}irect Preference Learning with Only \underline{\textbf{S}}elf-Generated \underline{\textbf{T}}ests and \underline{\textbf{C}}ode (DSTC), a framework that leverages only self-generated code snippets and tests to construct reliable preference pairs such that direct preference learning can improve LM coding accuracy without external annotations. DSTC combines a minimax selection process and test-code concatenation to improve preference pair quality, reducing the influence of incorrect self-generated tests and enhancing model performance without the need for costly reward models. When applied with direct preference learning methods such as Direct Preference Optimization (DPO) and Kahneman-Tversky Optimization (KTO), DSTC yields stable improvements in coding accuracy (pass@1 score) across diverse coding benchmarks, including HumanEval, MBPP, and BigCodeBench, demonstrating both its effectiveness and scalability for models of various sizes. This approach autonomously enhances code generation accuracy across LLMs of varying sizes, reducing reliance on expensive annotated coding datasets.

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

↑