用强化学习让代码生成与测试自动进化,无需真实代码监督。
Co-Evolving LLM Coder and Unit Tester via Reinforcement Learning
- 通过交互反馈设计奖励机制,让代码与测试协同优化。
- 7B模型代码准确率提升5.3%,14B模型Best-of-N准确率提升9.0%。
- 可直接用于智能编程、测试扩展,适配大模型微调与强化学习。
我们提出CURE,一种基于专用奖励设计的强化学习框架,通过代码与单元测试的交互结果共同演化编码与测试生成能力,无需任何真实代码作为监督信号。该方法支持灵活可扩展的训练,并使测试器能直接从编码器的错误中学习。基于Qwen2.5-Instruct模型优化后,所得到的ReasonFlux-Coder-7B和14B模型在代码生成准确率上分别提升5.3%和9.0%(Best-of-N),优于同规模的Qwen-Coder、DeepSeek-Coder和Seed-Coder。模型自然延伸至测试时扩展与代理式编程任务,实现比基线模型8.1%的性能提升。对于长思维链模型,ReasonFlux-Coder-4B持续超越Qwen3-4B,同时在单元测试生成中达到64.8%的推理效率。值得注意的是,该模型还可作为基础模型强化学习的有效奖励模型。
原文摘要 · Abstract (English)
We propose CURE, a novel reinforcement learning framework with a dedicated reward design that co-evolves coding and unit test generation capabilities based on their interaction outcomes, without any ground-truth code as supervision. This approach enables flexible and scalable training and allows the unit tester to learn directly from the coder's mistakes. Our derived ReasonFlux-Coder-7B and 14B models improve code generation accuracy by 5.3% and Best-of-N accuracy by 9.0% after optimization on Qwen2.5-Instruct models, outperforming similarly sized Qwen-Coder, DeepSeek-Coder, and Seed-Coder. They naturally extend to downstream tasks such as test-time scaling and agentic coding-achieving a 8.1% improvement over the base model. For the long-CoT model, our ReasonFlux-Coder-4B consistently outperforms Qwen3-4B while achieving 64.8% inference efficiency in unit test generation. Notably, we also find that our model can serve as an effective reward model for reinforcement learning on base models. Project: https://github.com/Gen-Verse/CURE
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。