TL;DR
VeRPO (Verifiable Dense Reward Policy Optimization) is a novel reinforcement learning framework for code generation that replaces sparse binary rewards with dense, verifiable rewards derived from partial test-case success. By theoretically identifying and correcting a "cardinality bias"—where a high volume of easy test cases drowns out progress on harder ones—VeRPO achieves up to an +8.83 pass@1 gain on competitive programming benchmarks with zero GPU memory overhead and negligible computational cost.
What Problem Does This Paper Address?
Reinforcement Learning (RL) has drastically improved the code-generation capabilities of Large Language Models (LLMs). However, designing effective reward functions remains a major bottleneck.
Currently, researchers rely on two main paradigms:
- Outcome-driven rewards: These use a binary signal (1 if all test cases pass, 0 otherwise). While highly verifiable, this signal is incredibly sparse. If every generated solution in an RL training batch fails at least one test case, the model receives zero relative advantage signals, leading to "degenerate groups" and stalled learning.
- External Reward Models (RMs): These are separate neural networks trained to score code quality. While they provide dense feedback, they are computationally expensive, consume massive GPU memory, and are highly susceptible to "reward hacking" (where the LLM exploits flaws in the RM to get high scores without writing correct code).
Since code execution naturally provides fine-grained feedback (e.g., passing 10 out of 100 test cases), why not just use the test-case pass rate as a dense reward? The authors show that a naive pass-rate reward actually degrades final model performance. This paper investigates why this happens and how to fix it.
Methods
The authors discover that naive pass-rate rewards fail due to cardinality bias. In typical programming datasets, the vast majority of test cases are easy, meaning the model already passes them early in training. If rewards are calculated as a simple sum or average of passed tests, the sheer volume of these easy tests inflates the baseline. Consequently, the RL algorithm prioritizes securing easy wins over making risky progress on the few difficult "frontier" test cases that actually define the model's capability boundary.
To solve this, the authors introduce VeRPO, which combines two complementary reward signals:
- Density-Calibrated Local Reward: VeRPO uses a Gaussian kernel density estimator to calculate how many test cases share a similar empirical pass rate. It then divides the weight of each test case by this density, effectively flattening the distribution so that a massive cluster of easy tests cannot dominate the reward. Additionally, it applies an exponential difficulty-aware weight to explicitly favor harder frontier tests.
- Outcome-Driven Global Reward: To ensure the model still targets complete functional correctness, VeRPO retains a binary trajectory-level reward, augmented with an efficiency decay factor to reward solutions that solve the problem in fewer turns.
The framework fuses these local and global advantages into a single turn-level objective within a group-based RL setup (like GRPO), as illustrated below:
Datasets
- Training: A filtered subset of TACO containing 7.4K verified algorithmic problems.
- Evaluation: The model was tested across several prominent code-generation benchmarks: HumanEval, HumanEval-Plus, BigCodeBench (Full and Hard subsets), LiveCodeBench (LCB), and Codeforces (via CodeElo).
Key Insights and Ideas
- The Skewness of Test Suites: Before training even begins, test case difficulty is heavily skewed. For over half of the problems in the TACO dataset, more than 90% of the test cases are already "easy" (pass rate > 0.8) for a base model like Qwen3-8B.
- More Feedback $\neq$ Better Feedback: Simply making a reward denser by counting passed tests introduces structural bias. Without calibration, dense feedback actively misguides policy optimization.
- Zero-Cost Density: You don't need a multi-billion parameter Reward Model to get high-quality dense supervision. The execution environment itself holds all the necessary information; it just needs to be mathematically calibrated.
Key Results
VeRPO was evaluated using Qwen3-8B as the RL backbone across single-turn (ST) and multi-turn (MT) settings:
- Performance Gains: In multi-turn settings, VeRPO consistently outperformed standard outcome-driven GRPO, achieving an average pass@1 improvement of 3.12 points, with its highest jump on the challenging Codeforces benchmark (+8.83 points).
- Training Stability: Unlike external RMs (such as AceCoder), which frequently suffer from catastrophic training collapse due to out-of-distribution distribution shifts, VeRPO remained completely stable because its rewards are grounded in deterministic code execution.
- Efficiency: Because VeRPO computes rewards mathematically from test results rather than running an external neural network, it introduces zero GPU memory overhead and adds less than 0.02% to total training time (only ~0.10 seconds per iteration).
The importance of both density calibration and the global anchor is highlighted in their ablation studies:
Limitations and Future Work
While VeRPO provides an elegant solution to reward sparsity, it relies on the assumption that the problem's test suite contains a sufficient number of test cases to estimate a meaningful difficulty density. For tasks or datasets with very sparse test suites (e.g., only 1–2 test cases per problem), the density calibration mechanism would degrade.
Additionally, the current formulation treats each turn in a multi-turn generation setting independently for local rewards; exploring explicit cross-turn credit assignment remains an open avenue for future research.
Summary updated