Foundations to Frontier
Tests

RL with verifiable rewards, GRPO

When answers can be checked automatically (a maths result, passing unit tests, a valid proof), the reward needs no learned model: a program verifies each answer. Reinforcement learning with verifiable rewards (RLVR) is how reasoning models such as DeepSeek-R1 were trained. It is usually run with group relative policy optimisation (GRPO). GRPO samples a group of answers per prompt and uses each answer's reward relative to its group's mean (divided by the group's standard deviation) as the advantage, which removes the value model. This page covers verifiers, format rewards, GRPO and its variants (Dr. GRPO, DAPO) and their failure modes. In the exercises you implement group advantages, a verifier and the zero-signal check. You then train a policy on 300 problems with a fixed budget of 12 800 sampled answers. Test pass@1 rose from 22% to 84–90% for every variant once each learning rate was tuned: group size, standard-deviation scaling and even the group baseline made no consistent difference here. By the end, 70–90% of GRPO groups were all-correct and carried no signal.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Practising on problems with an answer key

For maths or code, we don’t need a judge’s opinion: we can check whether the answer is right. The model tries each problem several times, the attempts are marked right or wrong, and the model is nudged towards attempts that did better than its own average on that problem. This is how recent reasoning models learned to think step by step. The demo shows how a group of marks becomes ‘better than average’ and ‘worse than average’ signals.

Alignment lab
Rewards 0.00, 0.50, 1.00, 0.25, 0.75, 0.00 become advantages -1.12, 0.22, 1.57, -0.45, 0.89, -1.12: above-average answers are reinforced, below-average ones discouraged, with no value network.
Why engineers care

Verifiable rewards suit engineering tasks with checkable answers (unit-tested code, simulated designs that pass constraints), letting models improve without human labels.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A verifiable reward comes from…
  2. 2. GRPO compares each answer with…
  3. 3. If all answers in a group are right, the signal is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Verifier rewards: exact-match of a final answer, unit tests passing, a proof checker, a simulator meeting constraints. Often combined with a small format reward (reasoning inside tags, answer on the last line).
  • GRPO (Shao et al., 2024): for each prompt sample G answers with rewards r₁…r_G; advantage Aᵢ = (rᵢ − mean)/std, shared by every token of answer i. PPO-style clipped ratio plus a KL penalty to the reference. No value model.
  • Zero-signal groups: if all G answers get the same reward, all advantages are 0. Probability p^G + (1 − p)^G for per-answer accuracy p: wasteful for very easy and very hard prompts.
  • Variants: Dr. GRPO removes the std division and per-length normalisation (which bias towards long wrong answers); DAPO adds dynamic sampling (drop zero-signal groups), asymmetric clipping and overlong penalties.
  • pass@k: fraction of problems solved by at least one of k samples; unbiased estimate 1 − C(n − c, k)/C(n, k).
📝 Quick check (Level 1)
0/3 answered
  1. 1. GRPO removes…
  2. 2. Probability a group of 2 at accuracy 0.5 is zero-signal:
  3. 3. DAPO's dynamic sampling…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

GRPO in code

Exercise 1.

  • Compute group-relative advantages with and without std scaling.
  • Write a verifier that extracts the final number.
  • Detect zero-signal groups.

Practice.

  • TRL’s GRPOTrainer takes a list of reward functions (correctness, format) and a group size (num_generations).
  • Use vLLM for fast generation; most of the cost is sampling.
  • Filter the prompt set to medium difficulty for the current model (neither always solved nor never solved).
  • Track pass@1, response length, the fraction of zero-signal groups and the KL; check outputs for verifier exploits (for example printing many numbers).
from trl import GRPOConfig, GRPOTrainer
def correct(completions, answer, **kw):
    return [verify_answer(c, a) for c, a in zip(completions, answer)]
cfg = GRPOConfig(num_generations=8, beta=0.04, learning_rate=1e-6, max_completion_length=1024, use_vllm=True)
trainer = GRPOTrainer(model=policy, reward_funcs=[correct, format_reward], args=cfg, train_dataset=problems)
trainer.train()
🐍 Exercise 1: group advantages and a verifier
Implement GRPO group advantages, a final-answer verifier and the zero-signal check.
📝 Quick check (Level 2)
0/3 answered
  1. 1. TRL's trainer for GRPO:
  2. 2. Most GRPO compute goes to…
  3. 3. Good prompts for GRPO are…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Group mean as a baseline. The policy gradient E[r ∇ log π] has high variance; subtracting a baseline b that does not depend on the sampled answer keeps it unbiased and can reduce variance. The group mean is a per-prompt Monte Carlo estimate of the value V(x), so GRPO gets a value baseline without training a value model. (Strictly, including the answer itself in the mean adds a small bias of order 1/G.)

The std division. Dividing by the group std rescales each prompt’s gradient: groups with low variance (nearly all right or nearly all wrong) are boosted. This is a per-prompt learning-rate change, not a new signal. Dr. GRPO argues it biases training towards too-easy and too-hard prompts and removes it.

Why the variants tied here. In exercise 2 the reward is binary and the policy is a softmax, whose score function averages to zero. So even REINFORCE without any baseline gets useful contrast: raising the correct answer’s probability lowers the others. After tuning, the step size dominated; the baseline and scaling mainly changed which learning rate was best. Larger models, long sequences and noisy rewards are where variance reduction is expected to matter more.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The group mean estimates…
  2. 2. Dividing by the group std is effectively…
  3. 3. A baseline keeps the policy gradient…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much do GRPO’s design choices (group size, std scaling, group baseline) matter at a fixed sampling budget?

History.

  • Z. Shao et al., “DeepSeekMath” (2024): GRPO.
  • DeepSeek-AI, “DeepSeek-R1” (2025): RL with verifiable rewards produces long reasoning.
  • Z. Liu et al., “Understanding R1-Zero-like training” (Dr. GRPO, 2025).
  • Q. Yu et al., “DAPO” (2025).

Exercise 2.

  • Tasks: 600 problems, each with 8 candidate answers described by 16 features; exactly one is correct by a hidden rule, so the reward is verifiable. The reference policy has a weak hint of the rule (22% pass@1).
  • Training: policy logits = reference + linear adjustment, 300 training problems, a fixed budget of 12 800 sampled answers (128 per step, split into 128/G prompts × G answers), KL penalty 0.02.
  • Tuning: each variant’s learning rate chosen from 0.3, 1, 3, 10 on 100 validation problems; pass@1 measured on 200 test problems.
variant test pass@1 best lr zero-signal groups
reference 0.222 — —
GRPO, G = 2 0.866 10 0.90
GRPO, G = 4 0.859 3 0.75
GRPO, G = 8 0.867 3 0.71
GRPO, G = 16 0.842 10 0.83
Dr. GRPO (no std), G = 8 0.863 10 0.74
REINFORCE (no baseline), G = 8 0.896 10 0.06
  • RLVR works: every variant raised pass@1 from 22% to 84–90% with no human labels.
  • Null result on the variants: after tuning, they were within 0.06 of each other, and the order changed across seeds (seed 1: GRPO G = 4 and G = 8 best at 0.893; seed 2: REINFORCE 0.886, GRPO G = 4 lowest at 0.807). Before tuning (all at lr 0.3), GRPO led by 0.06–0.08, but that was the std division acting as a larger step size.
  • Zero-signal groups dominate late in training: most groups end up all-correct, so most samples teach nothing. This is the waste DAPO’s dynamic sampling targets. (For REINFORCE the count is low only because all-correct groups still have nonzero advantage; they still push on already-solved prompts.)
  • Caveat: this is a one-step, linear-policy problem. The variants are designed for long sequences, where token-level length normalisation and variance matter; this study cannot test those effects.
🐍 Exercise 2 (research): how much do GRPO's design choices (group size, std scaling, group baseline) matter at a fixed sampling budget?
Train GRPO with several group sizes, Dr. GRPO and REINFORCE under one sampling budget with tuned learning rates; compare test pass@1 and zero-signal groups.

Verifiable rewards in AI, robotics and aerospace

  • Reasoning models: DeepSeek-R1, OpenAI o-series and others are trained largely with RL on maths and code verifiers.
  • Code and design: unit tests, compilers and simulators as verifiers; for example generated flight-software code checked against a test suite.
  • Robotics: success detectors in simulation give binary verifiable rewards for manipulation tasks.

References

  1. Z. Shao et al. (2024). “DeepSeekMath: pushing the limits of mathematical reasoning in open language models.” arXiv:2402.03300.
  2. DeepSeek-AI (2025). “DeepSeek-R1: incentivizing reasoning capability in LLMs via reinforcement learning.” Nature.
  3. Z. Liu et al. (2025). “Understanding R1-Zero-like training: a critical perspective.” arXiv:2503.20783.
  4. Q. Yu et al. (2025). “DAPO: an open-source LLM reinforcement learning system at scale.” arXiv:2503.14476.