用自动生成测试用例提升代码模型强化学习效果,显著改善生成质量。
ACECODER: Acing Coder RL via Automated Test-Case Synthesis
- 通过自动化合成大量测试用例构建奖励信号。
- 7B模型经强化学习后性能媲美236B的DeepSeek-V2.5。
- 仅80步优化即在HumanEval-plus上提升超25%。
近期代码模型进展主要依赖监督微调(SFT),而强化学习(RL)潜力未被充分挖掘,主要因代码领域缺乏可靠的奖励数据。本文提出通过自动化大规模测试用例合成来增强代码模型训练。我们设计了一条流水线,从现有代码数据中生成大量(问题, 测试用例)对。基于采样程序的通过率,构建偏好对,并使用Bradley-Terry损失训练奖励模型。实验显示,采用best-of-32采样后,Llama-3.1-8B-Ins平均提升10分,Qwen2.5-Coder-7B-Ins提升5分,使7B模型性能达到236B DeepSeek-V2.5水平。进一步结合奖励模型与测试用例通过奖励进行强化学习,在HumanEval、MBPP、BigCodeBench和LiveCodeBench(V4)上均实现一致提升。特别地,从Qwen2.5-Coder-base直接开始遵循R1风格训练,仅80步优化即在HumanEval-plus上提升超过25%,在MBPP-plus上提升6%。结果表明强化学习在代码模型中具有巨大潜力。
原文摘要 · Abstract (English)
Most progress in recent coder models has been driven by supervised fine-tuning (SFT), while the potential of reinforcement learning (RL) remains largely unexplored, primarily due to the lack of reliable reward data/model in the code domain. In this paper, we address this challenge by leveraging automated large-scale test-case synthesis to enhance code model training. Specifically, we design a pipeline that generates extensive (question, test-cases) pairs from existing code data. Using these test cases, we construct preference pairs based on pass rates over sampled programs to train reward models with Bradley-Terry loss. It shows an average of 10-point improvement for Llama-3.1-8B-Ins and 5-point improvement for Qwen2.5-Coder-7B-Ins through best-of-32 sampling, making the 7B model on par with 236B DeepSeek-V2.5. Furthermore, we conduct reinforcement learning with both reward models and test-case pass rewards, leading to consistent improvements across HumanEval, MBPP, BigCodeBench, and LiveCodeBench (V4). Notably, we follow the R1-style training to start from Qwen2.5-Coder-base directly and show that our RL training can improve model on HumanEval-plus by over 25\% and MBPP-plus by 6\% for merely 80 optimization steps. We believe our results highlight the huge potential of reinforcement learning in coder models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。