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


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

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
通过强化学习增强代码生成中的代码大语言模型:综述
专知会员服务
29+阅读 · 2025年1月1日
专知会员服务
29+阅读 · 2021年6月7日
Distributional Soft Actor-Critic (DSAC)强化学习算法的设计与验证
深度强化学习实验室
19+阅读 · 2020年8月11日
【论文笔记】ICLR 2018 Wasserstein自编码器
专知
32+阅读 · 2018年6月29日
【强化学习】强化学习+深度学习=人工智能
产业智能官
55+阅读 · 2017年8月11日
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
39+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
31+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
国家自然科学基金
48+阅读 · 2009年12月31日
VIP会员
相关VIP内容
相关基金
国家自然科学基金
43+阅读 · 2015年12月31日
国家自然科学基金
39+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
31+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
国家自然科学基金
48+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员