TL;DR
Standard reinforcement learning for code generation teaches models to write solutions, but not necessarily how to evaluate them. This paper introduces Critique Reinforcement Learning (CRL), a novel paradigm that explicitly rewards models for correctly judging the validity of question-solution pairs. By mixing CRL with standard RL, the resulting "Critique-Coder" models achieve state-of-the-art performance on coding benchmarks and demonstrate enhanced, transferable logical reasoning skills.
The Challenge of Evaluation in Code Generation
The recent leap in Large Language Model (LLM) reasoning capabilities is largely driven by Reinforcement Learning with Verifiable Rewards (RLVR). In the coding domain, this typically involves giving the model a prompt, having it generate code, and rewarding it based on how many test cases the generated code passes.
However, this standard RL paradigm focuses entirely on generation. It lacks a mechanism to explicitly foster internal critique, reflection, or the ability to evaluate existing solutions. The authors argue that to build truly robust reasoning models, we need to explicitly incentivize critical thinking. The challenge lies in teaching a model to critique without losing its ability to generate end-to-end solutions.
Methods: Introducing Critique Reinforcement Learning
The authors propose a hybrid training framework that combines standard RL with a new approach called Critique Reinforcement Learning (CRL).
- Standard RL: The model is given a question, generates a solution, and receives a continuous reward (0.0 to 1.0) based on the test case pass rate.
- Critique RL (CRL): The model is given a question and a candidate solution. It must generate a reasoning trace (a critique) and output a final binary judgment (
TrueorFalse). The reward is 1.0 if the judgment matches the ground truth, and 0.0 otherwise.
To prevent the model from becoming purely an evaluator and forgetting how to write code, the authors train Critique-Coder using a hybrid batch: 80% standard RL data and 20% CRL data. They use Group Relative Policy Optimization (GRPO) to update the policy, allowing the model to jointly learn task-oriented generation and evaluative judgment. This approach was applied to Qwen3-4B and Qwen3-8B base models, utilizing an iterative context-lengthening strategy (from 16k to 32k tokens) to accommodate long reasoning chains.
Datasets and Setup
- Training Data: Derived from the human-seeded RL dataset of rStar-Coder. To speed up training, the authors heavily filtered the test cases (removing cases longer than 200 tokens and capping at 30 cases per problem).
- CRL Data Generation: Candidate solutions were generated using a larger model (
Qwen3-Coder-30B-A3B-Instruct). Solutions with a test pass rate >80% were labeledTrue; the rest were labeledFalse. - Evaluation Benchmarks: The models were evaluated on coding tasks (EvalPlus, BigCodeBench-Instruct, Aider-Polyglot, LiveCodeBench v5) and general reasoning tasks (BIG-Bench Extra Hard logic subtasks).
Key Insights
- Critiquing improves generation: Training a model to evaluate other code actually makes it better at writing its own. CRL-trained models generate longer "think" blocks and include more explanatory comments in their generated code, indicating deeper deliberation.
- Reasoning skills transfer across domains: Even though the CRL training was done exclusively on Python coding tasks, the resulting model showed massive improvements in multi-language programming (Aider-Polyglot) and pure logical reasoning (BBEH).
- CRL is a complement, not a replacement: Ablation studies revealed a "Goldilocks" zone for critique training. Training a model on 100% CRL data causes its performance to drop below the baseline because it forgets how to generate long-horizon solutions. The 20% CRL / 80% RL mix provided the optimal balance.
- Test-time scaling works for compact models: Giving the 4B model a larger compute budget at inference time (allowing it to think longer) monotonically improved its performance, proving that the model learned how to use extra tokens for productive reasoning.
Key Results
Critique-Coder consistently outperforms RL-only baselines across all evaluated benchmarks.
- LiveCodeBench (v5): Critique-Coder-8B achieved 60.8%, outperforming much larger reasoning models like DeepCoder-14B (60.6%) and even GPT-o1 (59.5%). The 4B variant hit 59.0%, a +4.8 point jump over the base model and +2.4 points over an RL-only baseline.
- Aider-Polyglot: The 8B model scored 35.6, a massive +7.2 point improvement over the baseline, showcasing strong cross-language transfer.
- EvalPlus: Both the 4B and 8B models showed solid gains over the RL-only baselines, reaching 86.5% and 87.7% respectively.
- Logical Reasoning (BBEH): Critique-Coder achieved a +6.1 average improvement over the base model across four logic subtasks, significantly beating the RL-only variant.
Limitations and Future Work
While CRL improves reasoning during generation, the authors note that the model still cannot reliably evaluate or fix its own code after the final answer is produced (post-hoc self-critique). The performance gains come from internalizing the critique process before outputting the final solution. Additionally, the framework is sensitive to the ratio of CRL to RL data. Future work could explore dynamic mixing ratios during training or extending the CRL paradigm explicitly into non-coding domains like advanced mathematics.
Summary updated