用自生成代码和测试构建偏好数据,提升代码大模型生成准确率
DSTC: Direct Preference Learning with Only Self-Generated Tests and Code to Improve Code LMs
- 仅用自生成代码与测试构造高质量偏好对
- 在HumanEval等基准上提升代码通过率,稳定有效
- 无需外部标注,适合各类规模代码模型应用
直接偏好学习为提升代码大语言模型的生成能力提供了一种高效替代监督微调的路径,但可靠偏好数据稀缺成为其性能瓶颈。本文提出DSTC框架,仅利用自生成代码片段与测试用例构建可靠偏好对,使直接偏好学习能在无外部标注的情况下提升代码生成准确性。DSTC结合极小极大选择机制与测试-代码拼接策略,降低错误自动生成测试的影响,增强模型性能,且无需昂贵的奖励模型。在HumanEval、MBPP和BigCodeBench等多个基准上,配合DPO和KTO等方法,均实现稳定的编码通过率(pass@1)提升,验证了该方法在不同规模模型上的有效性与可扩展性,显著减少对昂贵标注数据集的依赖。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。