From REINFORCE to PPO to GRPO: the RL behind reasoning models
Reasoning models are trained by letting them attempt problems and reinforcing the attempts that work. The algorithms behind that step form a family tree: REINFORCE, then baselines and value functions, actor-critic and GAE, TRPO and PPO, and finally GRPO, which drops the value network and compares each answer with the others in its group. This guide follows the video's chapters, points to the course's in-depth PPO material, and spends its own space on GRPO and the Dr. GRPO correction.
Start here (no maths needed)
To teach an AI to solve maths problems, you can let it try a problem many times, check which answers are right, and nudge it towards the kind of thinking that produced the right ones. GRPO does this by comparing each answer with the others in the same batch: better than average gets pushed up, worse than average gets pushed down.
Think of it like this
A coach wants to know whether a runner had a good day. One way is to keep a notebook predicting how fast the runner "should" be on each track, and compare against that. Keeping that notebook accurate is a lot of work. Another way: have eight runners race the same track at once, and just compare each with the group's average. Faster than the group is good, slower is bad. No notebook needed. That second way is GRPO; the notebook is PPO's critic.
How it works
- Give the model one question and let it write several answers (a "group"), say 8.
- A checker scores each answer, for example 1 if the final answer is right and 0 if it's wrong.
- Work out the group's average score. Answers above it get a positive "advantage", answers below it a negative one.
- Make every word in a good answer a bit more likely, and every word in a bad answer a bit less likely.
- Don't change too much in one step (a "clip"), and stay close to the original model (a "KL" leash), so training stays stable.
Why robots care
Robots learn many skills by trial and error in simulation, and the algorithms used there are the same family: policy gradients and PPO. GRPO's trick of comparing several attempts from the same starting point works whenever you can reset to the same situation and try again, which simulators make easy.
Try it
- Throw 8 paper balls at a bin from the same spot and note which go in. Now work out your average. Each throw that went in is "better than average". If all 8 went in, or all 8 missed, is any throw better than average? What does that tell you about learning from that round?
- In the demo further down, set Success rate to 0.05 and look at Chance the group has no signal. Then press Sample new group a few times and compare the GRPO, Dr. GRPO and Critic bars for a rare correct answer.
Words to know
- Policy
- The model's way of choosing what to do (for a language model, which token to write next).
- Reward
- A score for how well an attempt went.
- Advantage
- How much better an attempt was than expected.
- Critic (value function)
- A second model that predicts how well things will go from here, used as the "expected" score.
- Clipping
- A rule that stops one update from changing the policy too much.
Going deeper: everything below is the full version, with some maths. On a first read, skim the headings and the "Why it matters for robotics" box, and come back for the rest later.
1. Watch
Chapter guide
| Time | Chapter | What to look for |
|---|---|---|
| 0:00 | Introduction | Why RL is the step that turns a pretrained model into a reasoning model. |
| 0:43 | Notation | States, actions, policy πθ, trajectories τ and returns. For an LLM: the state is the prompt plus tokens so far, the action is the next token. |
| 2:41 | Policy gradient | The log-derivative trick that turns "maximise expected reward" into a gradient you can estimate from samples. |
| 5:11 | Decomposing trajectory into states and actions | Why the environment's dynamics drop out of the gradient, leaving only the policy's log-probabilities. |
| 7:05 | Baseline subtraction | Subtracting a baseline leaves the gradient unbiased but cuts its variance. |
| 7:58 | Value function estimation | Learning V(s) as the baseline, by regression on observed returns. |
| 8:31 | Advantage estimation | The advantage A = Q − V, TD residuals and Generalized Advantage Estimation's λ knob between bias and variance. |
| 11:11 | Actor-critic methods | Training the policy (actor) and value function (critic) together. |
| 12:16 | Trust region policy optimization | Optimising a surrogate objective under a KL constraint, so one update can't wreck the policy. |
| 16:48 | Proximal Policy Optimization | Replacing TRPO's constraint with a clipped probability ratio that ordinary SGD can optimise. |
| 19:55 | Group Relative Policy Optimization | Dropping the critic: the baseline becomes the mean reward of a group of answers to the same prompt. |
| 21:58 | Dr. GRPO | The two normalisations in GRPO that introduce bias, and what removing them changes. |
2. The ideas, explained
Policy gradient (REINFORCE)
Williams (1992) showed how to follow the gradient of expected reward using only samples. Because the environment's transition probabilities don't depend on θ, they vanish from the gradient of the log-probability of a trajectory, and only the policy's own terms remain:
J(θ) = E_{τ~π_θ}[ R(τ) ]
∇J(θ) = E_τ[ Σ_t ∇_θ log π_θ(a_t | s_t) · G_t ] G_t = Σ_{k≥t} γ^{k−t} r_k (reward-to-go)
with a baseline: replace G_t by G_t − b(s_t) (still unbiased, lower variance)
The estimate is unbiased but very noisy. The rest of the family tree is mostly about reducing that noise and keeping updates safe. The course derives and codes these steps on Module 02's RL ladder.
Value functions, advantages and GAE
The best simple baseline is the state value V(s), the expected return from s. Then Gt − V(st) estimates the advantage A(s, a) = Q(s, a) − V(s): how much better this action was than the policy's average. Actor-critic methods learn V with a second network and use it in the update; Mnih et al.'s A3C (2016) is the reference the video cites. Generalized Advantage Estimation (Schulman, Moritz, Levine, Jordan and Abbeel, 2015) blends short and long look-aheads:
δ_t = r_t + γ V(s_{t+1}) − V(s_t) (TD residual)
Â_t^GAE(γ,λ) = Σ_{l≥0} (γλ)^l δ_{t+l}
λ = 0: one-step TD (low variance, biased by V) λ = 1: Monte Carlo return − V (unbiased, noisy)
TRPO and PPO
Policy gradients can take a step that's too large and collapse the policy. TRPO (Schulman et al., 2015) maximises an importance-weighted surrogate subject to a limit on the average KL divergence from the old policy, solved with conjugate gradients and a line search. PPO (Schulman et al., 2017) gets most of the benefit with a first-order trick: clip the probability ratio so there's no incentive to move it outside [1 − ε, 1 + ε].
ρ_t(θ) = π_θ(a_t | s_t) / π_θ_old(a_t | s_t)
TRPO: max E[ ρ_t Â_t ] s.t. E[ KL(π_θ_old ‖ π_θ) ] ≤ δ
PPO: L^CLIP = E[ min( ρ_t Â_t, clip(ρ_t, 1−ε, 1+ε) Â_t ) ]
In LLM fine-tuning (RLHF), PPO usually runs with four models in memory: the policy, a critic of similar size, a frozen reference model for the KL penalty, and a reward model. The PPO mechanics, ε ablations and a full implementation are on 30u30 Day 29; this page doesn't repeat them.
Group Relative Policy Optimization (GRPO)
GRPO was introduced by Shao et al. in the DeepSeekMath paper (2024) as a PPO variant that improves maths reasoning while reducing PPO's memory use. Its key move is to remove the critic. For each question q, sample a group of G outputs o1…oG from the old policy, score them, and use the group's statistics as the baseline:
Â_{i,t} = ( r_i − mean(r_1..r_G) ) / std(r_1..r_G) (outcome reward: same for every token of o_i)
J_GRPO(θ) = E[ (1/G) Σ_i (1/|o_i|) Σ_t {
min( ρ_{i,t} Â_{i,t}, clip(ρ_{i,t}, 1−ε, 1+ε) Â_{i,t} )
− β · D_KL[ π_θ ‖ π_ref ] } ]
D_KL estimate per token: π_ref/π_θ − log(π_ref/π_θ) − 1 (non-negative, unbiased)
Three differences from PPO as used in RLHF:
- No value network. The group mean plays the role of V(s), which suits LLMs because training a token-level critic for long reasoning traces is hard and doubles memory.
- KL in the loss, not the reward. PPO-for-RLHF usually subtracts a KL penalty from the reward; GRPO adds it directly to the objective, so it doesn't complicate the advantage.
- Group comparison matches how rewards work. Reward models and verifiers are often better at comparing answers to the same question than at giving absolute scores. The paper also describes a process-supervision variant, where step-level rewards are normalised the same way.
DeepSeek-R1 (DeepSeek-AI, 2025) made GRPO famous: its R1-Zero model was trained with large-scale RL using GRPO and rule-based rewards directly on a base model, without supervised fine-tuning first, and long reasoning behaviour emerged. Module 07 covers this RL-with-verifiable-rewards recipe in context (RLVR section).
Interactive: GRPO group advantages vs a critic baseline
One prompt, G sampled answers, each scored 1 (correct) or 0 (wrong). For each answer, three bars show its advantage: GRPO (r − mean) / std, Dr. GRPO r − mean, and a PPO-style baseline r − V, where V is a critic's guess of the success rate. Dots above the axis mark correct answers.
Dr. GRPO
Liu et al. (2025), in "Understanding R1-Zero-Like Training: A Critical Perspective", identify an optimisation bias in GRPO that artificially increases response length, especially for incorrect outputs, and propose Dr. GRPO ("GRPO Done Right") as an unbiased fix. It removes two normalisations:
- The 1/|oi| length term. Each answer's token losses are averaged over its own length. For a wrong answer (negative advantage), a longer answer spreads the same penalty over more tokens, so each token is punished less. That quietly rewards long wrong answers. For correct answers it favours short ones. Dr. GRPO sums over tokens with a constant normaliser instead.
- The std term in the advantage. Dividing by the group's std gives prompts whose groups are nearly all right or nearly all wrong (small std) much larger weight, a question-level difficulty bias. Dr. GRPO uses r − mean only. The demo above shows the size of this effect.
Dr. GRPO: Â_{i,t} = r_i − mean(r_1..r_G)
J = E[ (1/G) Σ_i Σ_t min( ρ_{i,t} Â_{i,t}, clip(ρ_{i,t}, 1−ε, 1+ε) Â_{i,t} ) ] / C (C constant)
The paper reports better token efficiency with similar reasoning performance, and a minimal R1-Zero-style recipe reaching 43.3% on AIME 2024 with a 7B base model. With r − mean as the advantage, the group mean is an ordinary REINFORCE baseline again (close to the leave-one-out style), which is a nice way to see that GRPO is still a policy gradient method underneath.
The family tree in one table
| Method | Baseline / advantage | Step-size control | Extra models |
|---|---|---|---|
| REINFORCE (1992) | Return, optional baseline | Learning rate only | None |
| Actor-critic, A3C (2016) | Learned V(s) | Learning rate | Critic |
| GAE (2015) | λ-weighted TD residuals | (used inside TRPO/PPO) | Critic |
| TRPO (2015) | GAE | Hard KL constraint | Critic |
| PPO (2017) | GAE | Clipped ratio | Critic (+ reference and reward models in RLHF) |
| GRPO (2024) | Group mean, divided by group std | Clipped ratio + KL to reference | Reference (+ reward model or verifier) |
| Dr. GRPO (2025) | Group mean only | Clipped ratio | As GRPO |
3. Where the course goes deeper
| Topic | Course page |
|---|---|
| Bellman → REINFORCE → A2C → GAE → PPO, as practice problems | Module 02 · RL ladder |
| PPO in depth: clipping, ε, GAE, a full implementation and robot locomotion | 30u30 Day 29 · PPO |
| RLHF and the reward model that PPO originally optimised | 30u30 Day 30 · RLHF |
| RL with verifiable rewards, the KL leash and where GRPO fits in post-training | Module 07 · RLVR, Module 07 · KL |
| DPO and preference optimisation, the RL-free alternative | Module 08 · Stage 05 |
| Book-length treatments of RL for LLMs | Module 11 · Raschka, Module 11 · RLHF book |
| Dense teacher feedback instead of one reward per answer | Video 05 · On-policy distillation |
Why it matters for robotics
- PPO already runs robotics RL. Legged-locomotion and dexterous-manipulation policies are commonly trained with PPO and GAE across thousands of parallel simulated robots. Understanding the REINFORCE → PPO line is directly useful there; GRPO is the newer branch.
- GRPO needs resets to the same state. Its baseline compares several attempts from the same starting point. That's natural for an LLM prompt or a simulator you can reset, and awkward on a real robot, where every attempt starts from a slightly different world. Long-horizon control with dense rewards also still benefits from a learned critic, so GRPO doesn't simply replace PPO there.
- Success detectors as verifiers. For VLA fine-tuning, a binary "did the task succeed?" signal (from a scripted check in simulation or a learned success classifier) plays the role of a maths answer checker. Group-relative advantages over several rollouts per task are a plausible way to use it; how well this works for real robots is still an active research question.
- Watch the zero-signal groups. If a robot task succeeds almost never (or almost always) for the current policy, most groups give no gradient, as the demo shows. Curricula that keep success rates in the middle are as important as the algorithm.
Self-check
Why does subtracting a baseline b(s) from the return not bias the policy gradient?
Because Ea~π[∇ log π(a|s) · b(s)] = b(s) · ∇ Σa π(a|s) = b(s) · ∇1 = 0. The baseline doesn't depend on the action, so its contribution averages to zero, while it can greatly reduce variance.
What does GAE's λ trade off?
Bias against variance. λ = 0 uses one-step TD residuals, low variance but biased by errors in V. λ = 1 uses the full Monte Carlo return minus V, unbiased but noisy. Values in between weight longer look-aheads geometrically.
What does PPO's clip do for a positive-advantage action whose ratio is already 1.3 with ε = 0.2?
The clipped term is capped at 1.2 · Â, and the min picks it, so the gradient with respect to that sample is zero: there's no incentive to push its probability higher in this update.
Rewards in a group of 4 are (1, 0, 0, 0). What are the GRPO and Dr. GRPO advantages?
Mean 0.25. Population std = √(0.25 · 0.75) ≈ 0.433. GRPO: correct +0.75 / 0.433 ≈ +1.73, wrong −0.25 / 0.433 ≈ −0.58. Dr. GRPO: +0.75 and −0.25.
Why does the 1/|oi| term encourage long wrong answers?
A wrong answer's negative advantage is spread over its tokens and averaged by its length, so a longer wrong answer receives a smaller penalty per token. The model learns that rambling softens the punishment for being wrong.
Why is GRPO attractive for LLMs but less obviously so for a real robot?
For an LLM, sampling many answers to the same prompt is cheap and removes the need for a large critic. A real robot can't easily restart from exactly the same state many times, and long-horizon control with dense rewards benefits from a learned value function.
References
From the video's description (resources):
- Foundations of Deep RL, 6-lecture series by Pieter Abbeel
- DeepMind x UCL · Introduction to Reinforcement Learning by David Silver
- Reinforcement Learning: An Introduction (Sutton, Barto, 2nd edition)
From the video's description (references):
- Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning (REINFORCE) (Williams, 1992)
- Asynchronous Methods for Deep Reinforcement Learning (A3C) (Mnih et al., 2016)
- High-Dimensional Continuous Control Using Generalized Advantage Estimation (Schulman, Moritz, Levine, Jordan, Abbeel, 2015)
- Trust Region Policy Optimization (Schulman, Levine, Moritz, Jordan, Abbeel, 2015)
- Proximal Policy Optimization Algorithms (Schulman, Wolski, Dhariwal, Radford, Klimov, 2017)
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models (GRPO) (Shao et al., 2024)
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (DeepSeek-AI, 2025)
- Understanding R1-Zero-Like Training: A Critical Perspective (Dr. GRPO) (Liu et al., 2025)
- Manim Community, the animation library used to make the video