arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.22803cs.AIcs.SE
收藏

CVeDRL: 一种通过难度感知强化学习实现的高效代码验证器

CVeDRL: An Efficient Code Verifier via Difficulty-aware Reinforcement Learning

Harbin Institute of Technology(哈尔滨工业大学)

Ji Shi, Peiming Guo, Meishan Zhang, Miao Zhang, Xuebo Liu, Min Zhang, Weili Guan

AI总结:

CVeDRL通过难度感知强化学习提升代码验证效率,实现更高通过率和分支覆盖,参数更少,推理更快。

摘要:

代码验证器在基于大语言模型的代码生成后的验证中起着关键作用,但现有的监督微调方法却面临数据稀缺、失败率高和推理效率差的问题。虽然强化学习(RL)通过执行驱动的奖励优化模型,无需标注监督,提供了一个有前途的替代方案,但我们的初步结果表明,仅使用功能奖励的朴素RL无法为困难分支和样本生成有效的单元测试。我们首先理论分析表明,分支覆盖、样本难度、语法和功能正确性可以联合建模为RL奖励,通过优化这些信号可以提高基于单元测试的验证的可靠性。基于这一分析,我们设计了语法和功能感知的奖励,并进一步提出了分支和样本难度感知的RL,使用指数奖励塑造和静态分析指标。通过这种建模,CVeDRL仅使用0.6B参数,就实现了最先进的性能,其通过率比GPT-3.5高28.97%,分支覆盖高15.08%,同时比竞争基线快20倍以上。代码可在https://github.com/LIGHTCHASER1/CVeDRL.git获取。

英文摘要:

Code verifiers play a critical role in post-verification for LLM-based code generation, yet existing supervised fine-tuning methods suffer from data scarcity, high failure rates, and poor inference efficiency. While reinforcement learning (RL) offers a promising alternative by optimizing models through execution-driven rewards without labeled supervision, our preliminary results show that naive RL with only functionality rewards fails to generate effective unit tests for difficult branches and samples. We first theoretically analyze showing that branch coverage, sample difficulty, syntactic and functional correctness can be jointly modeled as RL rewards, where optimizing these signals can improve the reliability of unit-test-based verification. Guided by this analysis, we design syntax- and functionality-aware rewards and further propose branch- and sample-difficulty--aware RL using exponential reward shaping and static analysis metrics. With this formulation, CVeDRL achieves state-of-the-art performance with only 0.6B parameters, yielding up to 28.97% higher pass rate and 15.08% higher branch coverage than GPT-3.5, while delivering over $20\times$ faster inference than competitive baselines. Code is available at https://github.com/LIGHTCHASER1/CVeDRL.git

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑