90 minutes · Pillar 4 — the flagship 2025–2026 module. Reasoning models (o1 / R1 / Qwen3) are trained via RL on verifiable rewards.
Pillar 4 — Reasoning Models
The most important judgment in this module. It comes down to one question.
| Reward type | Examples | Method |
|---|---|---|
| Verifiable | math correctness, code execution, tool-use success | GRPO / RL — on-policy exploration |
| Preference only | style, helpfulness, tone | DPO family (FT13) — offline |
DPO — offline preference
Fixed (chosen, rejected) pairs. Model re-scores, never generates. Learns from someone else's attempts. The curriculum is frozen before training begins.
GRPO — on-policy RL
Model generates N attempts per prompt, verifier scores each. Learns from the distribution of its own errors — including errors your fixed dataset never contained.
GRPO (Group Relative Policy Optimization, DeepSeek — DeepSeekMath, arXiv:2402.03300). The key move: eliminate the learned value function from PPO.
| PPO | GRPO | |
|---|---|---|
| Policy | yes (trainable) | yes (trainable) |
| Critic / value | yes — ~same size as policy | NO — dropped |
| Reference (KL) | yes (frozen) | yes (frozen) |
| Baseline | learned estimate | group mean of N samples |
| Models in memory | ~3 | ~2 → ~half the memory |
A_i = (r_i − mean(r)) / std(r) → clipped PPO update + KL anchor. The group is the baseline. No critic to train.
RLOO (Kool et al. 2019): baseline for response i = mean of the other N−1. GRPO: baseline = mean of all N (including i). A small bias/variance tradeoff, not a different family.
| Family | Baseline | Critic? |
|---|---|---|
| PPO | learned value function (estimates expected reward from state) | yes (trained) |
| GRPO / RLOO | Monte Carlo mean over N samples | no |
GRPOTrainer and RLOOTrainer side by side — they behave nearly identically. Siblings, not strangers.
GRPO works. Production recipes patch specific failure modes. (Cameron Wolfe's survey is the map.)
| Variant | Failure it fixes | The patch |
|---|---|---|
| DAPO (ByteDance) | exploration stalls; zero-variance groups waste compute | clip-higher (decouple ± clip) + dynamic sampling (skip all-correct/all-wrong groups) |
| Dr. GRPO | length bias (per-token avg favors short sequences) | remove the length bias in advantage averaging |
| GSPO | noisy credit assignment on long CoT | sequence-level importance weighting (one weight per sequence) |
R1-Zero proved reasoning emerges from RL alone. R1 fixes the readability with a 4-stage pipeline. (arXiv:2501.12948 + Nature s41586-025-09422-z.)
R1-Zero — the proof
Pure RL on the base (DeepSeek-V3-Base), no SFT cold start. Self-verify, backtrack, long CoT emerge — selected for by the correctness reward. Problem: poor readability, mixed languages.
R1 — the 4 stages
(1) Cold-start SFT → readable CoT scaffold. (2) Reasoning RL (GRPO). (3) Rejection-sampling SFT → generate, filter by reward, retrain (→ FT15). (4) Final RL (alignment).
Qwen3 technical report (arXiv:2505.09388, May 2025). Industrializes the R1 recipe.
| # | Stage | What it does |
|---|---|---|
| 1 | Long-CoT cold start | SFT on long chain-of-thought — sets a prior toward thorough reasoning |
| 2 | Reasoning RL | GRPO-style on verifiable rewards (large-scale) |
| 3 | Thinking mode fusion | Merge thinking (long CoT) + non-thinking (fast) into ONE model, mode-flagged |
| 4 | General RL | Broad capability + alignment; preserves reasoning from 2–3 |
The heart of the method. The verifier is the load-bearing component — its quality bounds the whole run.
A_i = (r_i − mean(r)) / std(r) — group-relative, no critic| Tool | Use it for | Notes |
|---|---|---|
| TRL GRPOTrainer | Moderate scale — research, small models, learning | Integrates with transformers/peft/accelerate. Supply a Python reward function. Default starting point. The lab uses this. |
| verl (HybridFlow, ByteDance) | Production-grade distributed RL on Ray | Separates generation (rollout) from training. The standard for 30B+ on a cluster. |
| OpenRLHF | Faster on some micro-benchmarks | A masked_mean bug was found (silently wrong on padded long CoT). Consensus: "TRL or verl and you're fine." |
import re
def math_reward(prompts, completions, answer, **kwargs):
"""Verifiable: parse the model's \\boxed{} answer, compare exactly."""
rewards = []
for comp, gold in zip(completions, answer):
# parse the last \\boxed{...} from the completion
m = re.findall(r"\\\\boxed\{([^}]*)\}", comp)
pred = m[-1].strip() if m else None
rewards.append(1.0 if pred is not None and pred == gold.strip() else 0.0)
return rewards
exec the completion and check the output. The strength of your verifier is the ceiling on your RL run.
Run TRL GRPOTrainer on a small base with a verifiable math reward (GSM8K-style correctness checked by a Python reward function). Watch the reward curve climb.
The reward
Parse the model's \\boxed{} answer, compare to ground truth exactly. Verifiable — no judge. This is what makes GRPO the right tool (vs DPO).
The loop
Load base → write reward function → configure GRPO (N samples, KL) → train → eval on held-out math. Heavy lab — single consumer GPU; cloud GPU stretch goal.
Qwen/Qwen2.5-1.5B-Instruct. Watch the reward climb step-over-step — that is on-policy exploration working. Stretch: swap in verl for scale, or a code-execution reward.
Next: FT15 — CoT Distillation & Rejection-Sampling FT
DPO taught you preference. Now you have exploration — the tool that builds reasoning models.