arXiv:2508.05710cs.SEcs.AI2025-08被引 8

为代码强化学习构建高可靠测试用例生成框架,提升模型训练效果

Klear-CodeTest: Scalable Test Case Generation for Code Reinforcement Learning

  • 采用生成-验证双阶段框架,自动生成覆盖正例与边界情况的测试用例
  • 通过与标准答案一致性校验,确保测试用例正确性,显著提升模型性能
  • 设计多层安全沙箱,支持在线验证平台的可靠代码执行

在代码强化学习中,精准正确的反馈对大语言模型训练至关重要。然而,高质量测试用例的合成仍是极具挑战且未解决的问题。本文提出Klear-CodeTest,一个完整的测试用例合成框架,通过严格验证机制保障测试用例的质量与可靠性。该方法基于创新的生成-验证(G-V)框架,广泛覆盖编程问题,利用一致性验证机制将输出与标准解进行比对,确保正确性。G-V框架可生成包含常规与边界情况的全面测试用例,显著提升代码强化学习中解法正确性评估的覆盖度与判别力。此外,我们设计了专为在线验证平台优化的多层级安全沙箱系统,确保代码执行的安全性与可靠性。大量实验表明,所构建数据集有效提升了模型性能与训练稳定性。源代码、数据集及沙箱系统已公开于:https://github.com/Kwai-Klear/CodeTest。

原文摘要 · Abstract (English)

Precise, correct feedback is crucial for effectively training large language models (LLMs) in code reinforcement learning. However, synthesizing high-quality test cases remains a profoundly challenging and unsolved problem. In this work, we present Klear-CodeTest, a comprehensive test case synthesis framework featuring rigorous verification to ensure quality and reliability of test cases. Our approach achieves broad coverage of programming problems via a novel Generator-Validation (G-V) framework, ensuring correctness through a consistency validation mechanism that verifies outputs against gold solutions. The proposed G-V framework generates comprehensive test cases including both regular and corner cases, enhancing test coverage and discriminative power for solution correctness assessment in code reinforcement learning. In addition, we design a multi-layered security sandbox system optimized for online verification platforms, guaranteeing safe and reliable code execution. Through comprehensive experiments, we demonstrate the effectiveness of our curated dataset, showing significant improvements in model performance and training stability. The source codes, curated dataset and sandbox system are available at: https://github.com/Kwai-Klear/CodeTest.

代码生成强化学习测试用例

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