arXiv:2503.02951cs.LGcs.AI2025-03ACL被引 117

构建可验证的多样化编程数据集,提升代码大模型训练效果

KodCode: A Diverse, Challenging, and Verifiable Synthetic Dataset for Coding

  • 通过自验证流程生成题目-解法-测试用例三元组,确保质量
  • 在多个基准上超越Qwen2.5和DeepSeek等主流模型性能
  • 适合监督微调与强化学习调优,支持复杂算法训练

我们提出KodCode,一个合成的编程数据集,旨在解决为代码大模型训练获取高质量、可验证数据的长期难题。现有资源通常难以兼顾任务难度广度(从基础编码到高级算法)或答案正确性验证(如单元测试)。KodCode包含经自验证流程系统确认的题目-解法-测试用例三元组。其生成流程首先合成多样化的编程问题,对困难问题增加解法与测试生成尝试次数;随后通过深度推理模型(DeepSeek R1)基于测试结果拒绝采样,重写问题形式并生成多样化响应,实现后训练数据增强。该流程产出大规模、鲁棒且多样化的数据集。在HumanEval(+), MBPP(+), BigCodeBench, LiveCodeBench等基准上的微调实验表明,使用KodCode训练的模型表现达到当前最优,优于Qwen2.5-Coder-32B-Instruct与DeepSeek-R1-Distill-Llama-70B等模型。

原文摘要 · Abstract (English)

We introduce KodCode, a synthetic dataset that addresses the persistent challenge of acquiring high-quality, verifiable training data across diverse difficulties and domains for training Large Language Models for coding. Existing code-focused resources typically fail to ensure either the breadth of coverage (e.g., spanning simple coding tasks to advanced algorithmic problems) or verifiable correctness (e.g., unit tests). In contrast, KodCode comprises question-solution-test triplets that are systematically validated via a self-verification procedure. Our pipeline begins by synthesizing a broad range of coding questions, then generates solutions and test cases with additional attempts allocated to challenging problems. Finally, post-training data synthesis is done by rewriting questions into diverse formats and generating responses under a test-based reject sampling procedure from a reasoning model (DeepSeek R1). This pipeline yields a large-scale, robust and diverse coding dataset. KodCode is suitable for supervised fine-tuning and the paired unit tests also provide great potential for RL tuning. Fine-tuning experiments on coding benchmarks (HumanEval(+), MBPP(+), BigCodeBench, and LiveCodeBench) demonstrate that KodCode-tuned models achieve state-of-the-art performance, surpassing models like Qwen2.5-Coder-32B-Instruct and DeepSeek-R1-Distill-Llama-70B.

代码生成合成数据大模型训练

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。