Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Practising with an answer key
A student with a book of problems and an answer key can practise alone: try, check, and remember what worked. Reasoning models are trained the same way: they attempt maths or coding problems, an automatic checker says right or wrong, and training makes the successful lines of thought more likely. This makes the model much more reliable at what it can already sometimes do. Whether it also learns genuinely new tricks is debated: practice with an answer key does not show you methods you never try. The demo shows the first-try success rising while the many-try ceiling barely moves.
RL with verifiable rewards produced the jump in reasoning ability of 2024–2025 models in maths, coding and science.
- 1. A verifiable reward comes from…
- 2. RL raises the probability of…
- 3. A debated question is whether RL…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- RLVR: reinforcement learning with verifiable rewards: rule-based rewards for answer correctness (and format), no learned reward model, so less reward hacking.
- GRPO: sample G answers per prompt, advantage = reward standardised within the group, PPO-style clipped update, optional KL to a reference; no value network (DeepSeekMath, 2024). Variants: DAPO, Dr. GRPO, RLOO.
- DeepSeek-R1: R1-Zero trained with pure RL from a base model, showing growing response length and self-verification (‘aha moments’); R1 added cold-start SFT data and multi-stage training.
- Dynamics: response length grows; entropy collapses as the policy concentrates; problems never solved give zero-variance groups and no signal (curriculum and filtering help).
- Sharpening vs new ability: RL raises pass@1 strongly but may not raise (or may lower) pass@k at large k compared with the base (Yue et al., 2025); distillation from a stronger model can add new solutions.
- Distillation: small models fine-tuned on a reasoning model’s traces (R1-distill) gain much of its ability cheaply.
- 1. GRPO computes advantages…
- 2. Groups where all answers are wrong give…
- 3. Distillation trains a small model on…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Running reasoning RL
Exercise 1.
- GRPO group advantages.
- A rule-based verifiable reward.
- The clipped surrogate objective.
Practice.
- Libraries: TRL GRPOTrainer, verl, OpenRLHF; vLLM for fast sampling.
- Rewards: exact-match on normalised answers (maths), unit tests (code), plus a format reward for the answer tag.
- Filter prompts to those with intermediate difficulty for the current model; drop always-solved and never-solved ones.
- Monitor reward, response length, entropy, KL and held-out pass@1 and pass@k.
- Guard against hacking: check that answers are extracted from the intended place and that tests cannot be modified.
from trl import GRPOConfig, GRPOTrainer
def correctness(completions, answer, **kw):
return [float(extract_boxed(c) == a) for c, a in zip(completions, answer)]
cfg = GRPOConfig(num_generations=8, max_completion_length=2048, beta=0.0, learning_rate=1e-6)
trainer = GRPOTrainer(model="Qwen/Qwen2.5-1.5B-Instruct", reward_funcs=[correctness], args=cfg, train_dataset=ds)
trainer.train()- 1. A library with a GRPO trainer:
- 2. Filter training prompts to…
- 3. Monitor during RL:
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Policy gradient on a softmax. For a policy π over solution paths, the GRPO update raises the logits of sampled paths with positive advantage and lowers those with negative advantage; unsampled paths change only through normalisation. Paths the policy almost never samples receive almost no direct gradient.
Signal requires variance. A group of G samples with per-sample success p carries signal only if it mixes right and wrong answers: probability 1 − p^G − (1 − p)^G. Problems with p ≈ 0 contribute nothing, so RL cannot discover solutions that the base model never produces.
Sharpening. RL moves probability towards paths that already succeed. pass@1 = E[p] rises towards the coverage ceiling, while pass@k for large k, which already counts rare successes, changes little. Entropy falls as the distribution concentrates; a KL penalty to the base slows this and keeps alternatives alive.
Distillation adds support. Supervised training on a teacher’s correct paths raises probability on paths the student rarely produced, extending coverage, which on-policy RL alone does not.
- 1. Paths the policy never samples get…
- 2. Signal probability for a group of G:
- 3. A KL penalty to the base…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Does RL with verifiable rewards teach new solutions or make existing ones more likely, and how do KL penalties and distillation change this?
History.
- Z. Shao et al., “DeepSeekMath” (2024): GRPO.
- OpenAI, “Learning to reason with LLMs” (o1, 2024); DeepSeek-AI, “DeepSeek-R1” (2025).
- Y. Yue et al., “Does reinforcement learning really incentivize reasoning capacity in LLMs beyond the base model?” (2025).
Exercise 2. 400 problems, each with 20 candidate solution paths, 15% of them correct; the base policy is a softmax over random logits. For 30% of problems the base model strongly avoids the correct paths (logits − 6).
- GRPO: 200 steps, group size 8, learning rate 0.5 on the logits, no KL or KL coefficient 0.05.
- Distillation: for a random 70% of problems a teacher’s correct path is boosted by +6 logits.
| policy | pass@1 | pass@64 | pass@1024 | entropy |
|---|---|---|---|---|
| base | 0.100 | 0.642 | 0.778 | 2.142 |
| GRPO, 50 steps | 0.578 | 0.679 | 0.782 | 1.056 |
| GRPO, 200 steps | 0.683 | 0.703 | 0.791 | 0.684 |
| GRPO + KL, 200 steps | 0.587 | 0.682 | 0.781 | 1.117 |
| distilled from teacher | 0.445 | 0.794 | 0.905 | 1.466 |
(3.5% of problems have no correct path at all.)
- Sharpening: pass@1 rose almost sevenfold, to 97% of pass@64, while pass@1024 rose by just over 1 point.
- Hard problems stayed unsolved: paths the base model almost never sampled got almost no gradient.
- Entropy collapsed under plain GRPO; the KL penalty kept more diversity but reached a lower pass@1.
- Distillation extended what the model could find (pass@1024 0.91) because it put probability on paths the base model avoided.
- Seeds 1 and 2: GRPO pass@1 0.642 and 0.672, pass@1024 change +1.1 and +0.8 points; distilled pass@1024 0.896 and 0.903.
- Caveat: a softmax over 20 fixed paths cannot invent new paths; real models compose steps, and RL with long chains may discover some combinations the base model rarely produced.
Reasoning RL in AI, robotics and aerospace
- Verifiable engineering tasks: code that compiles and passes tests, calculations checked by solvers, plans checked by simulators all provide RL rewards.
- Robot learning: RL with success detectors is the robotics analogue; sharpening versus exploration is a familiar trade-off there.
- Small onboard models: distillation brings reasoning ability into models small enough for edge hardware.
References
- Z. Shao et al. (2024). “DeepSeekMath: pushing the limits of mathematical reasoning in open language models.” arXiv:2402.03300.
- DeepSeek-AI (2025). “DeepSeek-R1: incentivizing reasoning capability in LLMs via reinforcement learning.” arXiv:2501.12948.
- Y. Yue et al. (2025). “Does reinforcement learning really incentivize reasoning capacity in LLMs beyond the base model?” arXiv:2504.13837.
- Q. Yu et al. (2025). “DAPO: an open-source LLM reinforcement learning system at scale.” arXiv:2503.14476.