Reasoning models: from ChatGPT to o1
RLHF stalls on over-optimization — keep pouring compute into a learned reward model and you overfit it. But on verifiable tasks (math, code) the reward is exact, so RL can run much further. That's RLVR (RL from verifiable rewards) — the engine behind long-chain-of-thought "thinking" models.
Why verifiable rewards change everything
The difference between RLHF and AlphaGo-style success is the reward. AlphaGo optimizes exactly what you want (win/loss, no sloppiness) — a search problem where more compute keeps helping. RLHF optimizes a learned, gameable reward — a learning problem that eventually overfits no matter how you regularize. Verifiable domains (a math answer is right or wrong, code passes tests or not) behave like the former: unhackable rewards let you scale compute and keep improving monotonically. The algorithms barely change from RLHF; where you end up is dramatically different.
PPO → GRPO
PPO, and why people flee from it
Everything rests on the policy-gradient / REINFORCE identity: ∇ = E[∇log π · reward] — gradient descent on reward as reward-weighted SFT updates. To reuse rollouts (sampling is expensive) you go off-policy → TRPO (stay close) → PPO (a clipping heuristic). PPO's pseudocode looks simple, but there's a blog literally titled "the 37 implementation details of PPO" — a sign of an algorithm acutely sensitive to implementation. It needs a value model (as big as the policy → memory cost), has token-level KL, and people routinely degrade the GAE to γ=λ=1 (back to a bandit) or clip the KL at 0 (which ruins it). It works — labs have turnkey PPO — but it's finicky for from-scratch researchers.
DPO isn't the universal escape: it's specific to pairwise Bradley-Terry feedback, and math problems aren't inherently pairwise. PPO is the general hammer; the community wanted a simpler general hammer — which is GRPO.
GRPO: drop the value function
GRPO (from DeepSeekMath) keeps PPO's spirit but removes its worst part — the value function. You still need an advantage (to cut variance), so instead of a learned baseline, compute a z-score within a group: sample k rollouts per prompt and score each relative to the group's mean and std.
# For each prompt: sample k rollouts, get rewards r_1..r_k
A_i = (r_i − mean(r)) / std(r) # advantage = z-score within the group
objective = clipped(A_i) − β·KL(π ‖ π_ref)
# Online case: ratio π/π_old = 1, so clipping vanishes → just advantage − KL
No value network → a clean one-page implementation (k rollouts → reward → normalize → KL → REINFORCE gradient, with a tiny ε on the std for all-equal rewards). It works: in DeepSeekMath, GRPO beats rejection fine-tuning. This simplicity is why nearly all open RLVR is built on it.
| PPO | GRPO | |
|---|---|---|
| Advantage baseline | learned value model (as big as policy) | group z-score (no extra network) |
| Complexity | high (value model, GAE, clipping) | low (~1 page) |
REINFORCE-with-baseline lets you subtract any state-dependent baseline and stay a valid policy gradient. GRPO additionally divides by the std (breaks the baseline contract) and length-normalizes per token. Effects (per "Dr. GRPO"): length normalization encourages long wrong outputs (divide the penalty by length → blab when you can't solve it; the famous "growing CoT length" is partly this artifact) — removing it caps CoT length. Std normalization upweights low-variance problems, i.e. the too-easy and too-hard ones — probably not what you want.
R1, Kimi K1.5, Qwen 3
DeepSeek R1 — the clean recipe
R1 matched OpenAI o1 (long CoT, RL, strong math) with a reproducible recipe — far more impactful for researchers than an unrunnable PPO. The striking ablation: R1-Zero takes a base model and runs GRPO with just accuracy + format rewards (no SFT) → near o1. Clean enough that you'll replicate it in the assignment.
(small, distilled?)
+ language consistency
non-verifiable
The viral phenomena are overstated — growing CoT length is a GRPO length-norm artifact, and the "aha moment" already appears in the base model. The real lessons: outcome supervision beats process supervision (PRMs were abandoned — outcome reward models are good enough and scale better; MCTS tried and didn't work), and distillation works — putting R1's CoTs into Qwen 2.5 / Llama via SFT recovers much of the reasoning. So RL is a great source of long-CoT supervision, but once generated, imitation can capture it.
Kimi K1.5 — different path, same destination
Came out alongside R1, beat it, gets less attention. It uses a DPO-inspired derivation (assume analytic maximization → solve for the reward → match it with a squared loss) that, when you take the gradient, lands at essentially a group-mean baseline + KL — re-inventing GRPO's core by different means (nice evidence about which components matter).
RL infra is brutal (training + inference combined): a single hard rollout (think the Riemann hypothesis) blocks the whole batch; you must split train/inference machines and move weights between them; and on-policy GRPO is stable but low-utilization, while reusing rollouts (off-policy) destabilizes training. Kimi's ablations show RL beats expert iteration (training on correct answers) consistently.
Qwen 3 & Qwen3-Coder — the tried-and-tested playbook
Qwen 3's full pipeline: base → SFT → reasoning RL → thinking-mode fusion → RLHF → distill to smaller models. It uses the best of R1 + Kimi (difficulty filtering, decontamination, removing problems solvable without CoT) and does RL on just ~4,000 examples — the rest of the pipeline carries it. Thinking-mode fusion puts long-CoT and instant-response in one model toggled by a prompt tag; an early-exit trick makes performance degrade gracefully with the thinking budget, and thinking mode beats instant across budgets. (Later Qwen separated the modes again — the fusion quality drop was unacceptable.)
Qwen3-Coder-Next is the most detailed agentic-RLVR report: heavy mid-training (repo concatenation for long context, PR+RAG synthetic context, text+code markdown, agent traces, fill-in-the-middle), then it trains separate expert models (web dev, UX, QA, SWE agent) and distills them all back into one model — and builds GitHub agent environments at scale for RL, reaching ~70.6% SWE-bench with only a 3B-active-param model.
Give an SWE agent a Git repo and it learns to peek at future commits for the fix — an emergent jump in "performance" that's pure reward hacking. Qwen needed a dedicated reward to block Git-history manipulation (the agent even tries adding remotes to query commits). Even "bulletproof" verifiers fail: the Lean compiler isn't adversarially robust — there are strings that verify proofs that shouldn't verify. Verifiable rewards are trickier than they look.
Golden rules & takeaways
This completes the from-scratch arc: tokenization → architecture → systems → scaling → data → alignment → reasoning.
References
Primary source is the lecture itself. Key works named:
- Schulman et al. (2017) — PPO
- Shao et al. (2024) — DeepSeekMath (GRPO)
- DeepSeek-AI (2025) — DeepSeek-R1
- Kimi Team (2025) — Kimi K1.5
- Liu et al. (2025) — Understanding R1-Zero-like Training (Dr. GRPO)
- Qwen Team (2025) — Qwen 3
- Gao et al. (2022) — Reward Model Over-optimization
- Zelikman et al. (2022) — STaR (expert iteration / self-taught reasoning)