Proximal Policy Optimization (PPO)
Read first: REINFORCE and the Policy-Gradient Theorem (Williams 1992; Sutton et al. 1999) · Actor–critic methods and the advantage function · High-Dimensional Continuous Control Using Generalized Advantage Estimation (GAE) · Trust Region Policy Optimization (TRPO)
TL;DR. PPO makes a policy-gradient step more conservative, not guaranteed safe. It optimises a surrogate objective in which the incentive to push a token’s probability ratio further is removed once the ratio leaves [1−ε, 1+ε] in the direction the advantage favours (above 1+ε for a positive advantage, below 1−ε for a negative one). Moves in the unfavoured direction are never clipped. This lets you run several epochs of SGD on one batch of rollouts, but it does not bound the KL or guarantee monotonic improvement. Simple, robust and cheap, it became the workhorse of RLHF (InstructGPT) and the baseline that GRPO, RLOO and DAPO modify.
Why it matters now. Almost every “RL for LLMs” paper defines itself relative to PPO. GRPO removes the critic, Dr. GRPO and DAPO change the normalisation and clipping, and REINFORCE-style methods drop the clip. If you understand the PPO objective, most 2025–26 papers read as diffs against it.
Key idea
Section titled “Key idea”With probability ratio and advantage estimate :
Try it
Section titled “Try it”Set a positive advantage and push r past 1+ε: the objective goes flat and the gradient vanishes. Then make A negative and push r above 1+ε: the min keeps the unclipped term, so the bad action is still penalised.
PPO clipped objective for one token
Move the sliders. The objective is L = min(r·A, clip(r, 1−ε, 1+ε)·A). The plot shows L against r for the current A and ε: solid line = L, dashed = unclipped r·A, shaded band = [1−ε, 1+ε], dot = current r.
- unclipped r·A =
- clipped clip(r)·A =
- objective L = min =
- ∂L/∂r =
The training loop and key results
Section titled “The training loop and key results”One PPO iteration (Algorithm 1, actor–critic style).
- Collect with the old policy: each of N actors runs for T timesteps, and the log-probabilities are stored.
- Compute GAE advantages and value targets from the critic, once, on this batch.
- Optimize the clipped surrogate (plus value loss and entropy bonus) with minibatch SGD or Adam for K epochs over the NT samples. The old log-probabilities and advantages stay fixed throughout; only moves, so the ratio drifts away from 1 as epochs proceed.
- Refresh: set and go back to step 1.
Key results (§6.1, Table 1). The surrogate comparison uses 7 MuJoCo environments × 3 seeds, one million timesteps each, with scores normalized so a random policy is 0 and the best result is 1, averaged over the 21 runs. No clipping or penalty scores −0.39 (worse than random on average, driven by one environment). Clipping with ε = 0.2 scores 0.82, the best setting; the best adaptive-KL setting scores 0.74. Later sections compare clipped PPO with other algorithms on continuous control and Atari.
What to look at in the paper
Section titled “What to look at in the paper”- Section 3: the clipped surrogate objective. Compare it with the adaptive-KL penalty variant in Section 4. The clip variant won.
- Section 5: the algorithm box (N actors × T steps, K epochs, minibatch M). This is the template that later LLM RL frameworks follow.
Limitations and open questions
Section titled “Limitations and open questions”- Very sensitive to implementation details (advantage normalisation, value clipping, learning-rate annealing). See “The 37 Implementation Details of PPO” (ICLR blog track 2022).
- Running four models at once is memory-hungry for LLMs. This motivated critic-free methods (GRPO, RLOO, REINFORCE++).
- The clip is not a hard constraint. Spinning Up notes PPO-Clip can still move the policy too far and its implementation stops epochs early when the approximate KL exceeds a target.
- The clip is asymmetric in its effect on low-probability tokens. This connects to entropy collapse, which DAPO’s “clip-higher” addresses.
Connections
Section titled “Connections”- Before: REINFORCE & the policy-gradient theorem, actor–critic & advantage, TRPO, GAE.
- After: InstructGPT (PPO for RLHF), DPO (offline preference optimization without an online rollout loop or a separate reward model, derived from the same KL-regularised RLHF objective), GRPO (critic-free, group baseline), DAPO / Dr. GRPO (fixes to GRPO).
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Take ε = 0.2. For three tokens compute the per-token PPO-clip objective and say whether its gradient with respect to θ is zero: (a) r = 1.3, Â = +2; (b) r = 0.7, Â = −2; (c) r = 1.3, Â = −2.
What a strong answer covers
- (a) min(1.3·2, 1.2·2) = min(2.6, 2.4) = 2.4. The clipped branch is active and constant in θ, so the gradient is zero.
- (b) min(0.7·(−2), 0.8·(−2)) = min(−1.4, −1.6) = −1.6. Clipped again, so the gradient is zero: the bad action is already pushed down enough.
- (c) min(−2.6, −2.4) = −2.6. The unclipped branch wins, so the gradient is non-zero and still pushes r down.
- General rule: the clip only removes the incentive to move further in the direction the advantage favours. Moves in the wrong direction stay fully penalised.
- Mechanism
Why does PPO need the probability ratio π_θ/π_θold at all, instead of the plain policy-gradient term log π_θ · Â? What breaks if you run 10 epochs of SGD on one batch with the plain term?
What a strong answer covers
- The rollouts come from π_θold. After the first update the data is off-policy, so the ratio is an importance weight that corrects the action distribution inside a local surrogate. That surrogate still uses π_θold's states and advantages, so it matches the true change in expected return only to first order near θold. It is not an unbiased estimate of a far-away policy's return.
- The gradients of r·Â and log π·Â agree at θ = θold, but only the ratio form stays meaningful as θ moves away.
- With the plain term, repeated epochs keep pushing the same actions with stale advantages, which overfits the batch and can collapse the policy.
- The ratio also makes the step size measurable, which is what lets the clip act as a crude trust region.
- What if…
The PPO paper compares no clipping, clipping at several values of ε, and fixed or adaptive KL penalties. What would you expect from each, and why did clipping become the default even though a KL penalty is the more principled trust region?
What a strong answer covers
- Without clipping or a penalty, multi-epoch updates are unstable; in the paper's comparison table this is the worst variant.
- ε trades speed against stability: a small ε gives slow progress, a large ε lets destructive updates through.
- A KL penalty needs a tuned or adaptive coefficient β, and its scale depends on the task.
- Clipping is first-order, needs one hyperparameter, and in practice one ε works across many tasks.
- Caveat: clipping does not strictly bound the KL. Ratios can still exceed 1 ± ε after several minibatch steps, so it is a heuristic trust region.
- Design
You are fine-tuning a 70B policy with RLHF on a fixed GPU budget. Argue for or against keeping PPO's learned critic, compared with a critic-free method such as GRPO or RLOO. State what you would measure to decide.
What a strong answer covers
- Memory and compute: PPO keeps the policy, reference, reward model and critic. Dropping the critic saves roughly one model's worth of memory and its training cost.
- Variance: a good critic gives per-token baselines and lower-variance advantages. Group baselines need several samples per prompt, which costs generation time.
- With sparse sequence-level rewards (for example a verifier), a token-level critic is hard to learn, so its benefit shrinks.
- Measure reward against wall-clock time and against samples, KL to the reference, the variance of the advantage estimates, and stability across seeds.
- Connect
Return to this question after the GRPO page. Write GRPO as a diff against PPO. Which parts of the PPO objective stay, which change, and when do the two give the same advantage for a token?
What a strong answer covers
- Kept: the clipped-ratio surrogate with ε.
- Changed: Â comes from group-normalised sequence reward, (R_i − mean)/std over G samples of one prompt, instead of GAE with a critic. Every token of a sequence gets the same advantage.
- The KL to the reference is a loss term rather than being folded into the reward.
- One sufficient, illustrative construction: γ = λ = 1, terminal reward only, and a critic that predicts the group mean at every token, with std normalisation set aside. This shows when they can coincide; it does not prove that this is the only case.
- Critique
In LLM RLHF, PPO clips a per-token ratio, but the reward arrives once at the end of the sequence. What credit-assignment problem does this create, and what experiment would show whether it matters for long reasoning traces?
What a strong answer covers
- With a terminal reward, every token's advantage must come from the critic's value differences (via GAE). Token advantages are not identical, but they are only as informative as a critic learned from a sparse end signal; a poor critic gives useful and filler tokens nearly the same credit.
- Separate two length effects. How per-token losses are normalised (per sequence or per batch of tokens) changes how much each token of a long or short output weighs; this is the bias Dr. GRPO and DAPO's token-level loss target. Clipping is a different mechanism: it decides which tokens' ratios stop contributing gradient.
- Experiment: compare token-level and sequence-level ratio clipping, or process rewards against outcome rewards, at matched compute. Measure accuracy and length drift as the trace length grows.