Paper Notes
The Thirty-Line Trick That Tamed Policy Gradients
How a clipped surrogate objective became the substrate under all of RLHF — and why every later method is a reaction to it.
The most consequential reinforcement learning algorithm of the language-model era was not designed for language models at all. It was built for simulated robots learning to walk and Atari agents learning to play. Yet nearly every RLHF pipeline ever run — including the one that produced ChatGPT — has PPO at its core. Understanding post-training means understanding why this particular algorithm won.
The problem PPO was solving
Policy gradient methods learn by nudging a policy toward actions that turned out well. The naive version is treacherous: a single bad update can collapse a policy, because the data you collect next depends on the policy you just changed. Step too far and you fall off a cliff you built yourself.
Trust Region Policy Optimization (TRPO), PPO's predecessor, solved this with a hard constraint: each update had to stay within a small KL-divergence "trust region" of the old policy. It worked, but the constrained optimization was fiddly — second-order methods, conjugate gradients, line searches. Powerful, but nobody's idea of fun to implement.
PPO's insight was that you could get nearly all of TRPO's stability with a fraction of the machinery. Instead of a constrained optimization problem, use a clipped surrogate objective:
L^CLIP(θ) = E[ min(r_t(θ)·Â_t, clip(r_t(θ), 1−ε, 1+ε)·Â_t) ]
where $r_t(\theta)$ is the probability ratio between the new and old policy. When the advantage is positive, the objective refuses to reward pushing the ratio past $1+\epsilon$; when negative, it won't reward pushing below $1-\epsilon$. The min takes the pessimistic bound. That's it — a first-order method, a few lines of code, and the trust region emerges from the clipping rather than from constrained optimization.
The trust region idea has a clean intuition: your gradient estimates are only valid near the data you collected, so large steps leave the region where your estimates mean anything. TRPO enforced this with a KL constraint solved via conjugate gradients — correct but painful. PPO's bet was that a crude enforcement, applied consistently, captures almost all of the benefit. The empirical results bore that out: across simulated robotic locomotion and dozens of Atari games, PPO matched or beat TRPO while being dramatically simpler to implement and tune.
Why the details matter for LLMs
Two properties made PPO the default for language-model RL:
- Multiple epochs per batch. Standard policy gradients do one update per sample. PPO's surrogate lets you run several epochs of minibatch updates on the same rollout data, which matters enormously when each sample is an expensive LLM generation. When your samples cost real money, sample efficiency isn't an academic metric — it's the budget line that determines whether the run happens at all. PPO multiplies the learning per generated token, and that economic fact did as much for its adoption as any theorem.
- The KL penalty variant. In RLHF the objective typically adds a KL term against a reference model, keeping the policy from drifting too far from its starting point. PPO accommodates this naturally, and that KL-regularized form is what InstructGPT actually ran.
The paper's experiments — robotic locomotion, Atari — showed PPO beating other online policy-gradient methods while striking what the authors called "a favorable balance between sample complexity, simplicity, and wall-time." That three-way tradeoff is the whole story: PPO didn't win by being the most sample-efficient or the most principled. It won by being good enough on all three axes at once.
PPO's real innovation wasn't the clipping — it was proving that a simple, slightly unprincipled method could be trusted at scale, which is exactly what the RLHF era needed.
The paper actually proposes two flavors: PPO-Clip, described above, and PPO-Penalty, which uses an adaptive KL coefficient instead of hard clipping. In language-model RLHF it was the penalty flavor's descendant that won — the KL term against the reference model does constant quiet work in every InstructGPT-style run, keeping the policy from exploiting the reward model's blind spots too aggressively. There's also a piece of community lore worth knowing: years after publication, researchers found that many reported PPO results depended on implementation details — advantage normalization, value clipping, orthogonal initialization — that the paper never specified. The algorithm that "just works" worked partly because everyone copied the same codebase. That fragility is part of why the field later embraced GRPO's simpler setup.
What's wrong with it
PPO is still on-policy: it learns only from data collected by the current policy, which makes it sample-hungry compared to off-policy methods. The clipping is a hack, not a guarantee — there's no theorem saying the trust region holds, and in practice the algorithm is sensitive to implementation details that the paper doesn't fully pin down. (The RL community later discovered that many "PPO" results depended on code-level choices nobody had documented.) It also still needs a value function to estimate advantages, which is half the parameters and half the headaches — a cost that GRPO would later eliminate entirely.
Where it sits in the arc
PPO is the substrate. RLHF needed a stable way to optimize against a learned reward model without the policy collapsing mid-training; PPO provided it. Every subsequent post-training advance — DPO's attempt to route around RL entirely, GRPO's removal of the critic, DAPO's decoupled clipping — is best read as a response to some specific pain PPO created. It's also a reminder that in ML, the best algorithm rarely wins — the most usable one does. PPO's dominance is a case study in how API design shapes science: make the right thing easy, and the field reorganizes around it.
Paper: Proximal Policy Optimization Algorithms — Schulman et al., 2017.