Reinforcement Learning with Verifiable Rewards (RLVR) has recently supercharged the reasoning capabilities of large language models. However, most existing methods rely solely on outcome rewards—evaluating only whether the model got the final answer right. This creates a "blind reflection" problem: models might realize they are wrong but don't know why, leading to verbose, unhelpful internal monologues or random guessing. Furthermore, models often hit a performance ceiling where adding more "thinking time" (test-time compute) doesn't help if the model cannot reliably verify its own progress.
To address this, researchers introduce ReVeal, a new reinforcement learning framework that turns LLMs into self-evolving code agents. By explicitly training models to generate and execute their own test cases, ReVeal widens the "verification-generation asymmetry"—the principle that it is easier to check a solution than to create one. This enables models to reliably continue improving their code over 20+ iterations at test-time, even when trained on only three.
The Generation-Verification Loop
ReVeal structures long-horizon reasoning as an interleaved, multi-turn process:
- Generation Turn: The model writes candidate code for the given problem.
- Verification Turn: The model generates its own test cases to validate the code.
- Tool Feedback: A Python interpreter executes the code against the generated tests.
- Refinement: The model uses the execution traces (errors, outputs) to refine the code in the subsequent turn.
The "secret sauce" driving this loop is Turn-Aware Policy Optimization (TAPO). Standard RL often struggles with multi-turn credit assignment. TAPO solves this using a structured reward system that includes an Outcome Reward for final correctness, a Generation Reward for improvements in code accuracy between turns, and a Verification Reward specifically for generating high-quality tests (validated against a "golden" solution during training). Crucially, TAPO prevents "reward gaming" by ensuring verification turns are only rewarded if they actually help improve the code or accurately judge correctness.
Key Insights and Performance Scaling
The core hypothesis behind ReVeal is that making a model a much better "grader" (verification) naturally makes it a better "student" (generation). By explicitly optimizing this verification gap, the model gains a reliable compass to navigate complex problem spaces.
- Robust Extrapolation: One of the most striking findings is that a model trained on only 3 turns of refinement can successfully scale to 25+ turns at inference time without losing its way or "looping" pointlessly.
- Zero Degradation: Unlike many iterative refinement methods where a model might accidentally break a correct solution while trying to "fix" it, ReVeal achieved a 0.0% degradation rate on several benchmarks. This proves the self-verification signals are highly reliable.
- Expanding Boundaries: ReVeal doesn't just find the same solutions faster; it improves Pass@k, meaning it explores the solution space more effectively to find correct answers that the base model couldn't find even with many independent attempts.
When evaluated on LiveCodeBench (LCB) V6, ReVeal (based on Qwen2.5-32B) improved its Pass@1 accuracy from 34.8% at turn 1 to 38.7% at turn 25. It significantly outperformed existing RL baselines and critic-based models. For instance, on CodeContests, it achieved a 33.6% Pass@1, nearly doubling the performance of the base instruct model (13.3%).
Furthermore, ReVeal maintains high efficiency. By using a short-term memory mechanism that keeps only the last three turns in context, the model avoids the computational bloat of massive context windows during long reasoning chains.
Limitations and Future Directions
Currently, ReVeal focuses on functional correctness. It does not explicitly reward code efficiency (time/space complexity) unless the code actually times out. A brute-force solution is treated the same as an optimal one if both pass the tests.
Future work will explore incorporating large-scale "stress tests" into the verification turn to push the model toward more efficient algorithmic solutions. Integrating runtime and memory usage statistics into the reward signal could evolve agents that write not just correct code, but highly performant code. Additionally, the TAPO framework shows promise for cross-domain applications, such as mathematical proof generation or legal reasoning, where verification-generation asymmetry is also prevalent.
Summary updated