The problem it fixes
A plain policy gradient step can be too large. The policy changes sharply, the next batch is collected under a much worse policy, and the run never recovers.
The ratio between the new and old policy on the same action measures how far the update has moved, per sample.
Maximising that surrogate with no constraint pushes the ratio to infinity wherever the advantage is positive, which is the failure being prevented.
The clipped objective
- : how far the ratio may move before the objective stops rewarding it.
When the advantage is positive, the objective stops improving once the ratio passes , so there is no gradient to push further.
When the advantage is negative, the same applies below .
The minimum is what makes it a pessimistic bound.
It takes the clipped value only when clipping makes the objective smaller, so a step that has already gone too far can still be corrected back.
Why it replaced TRPO
Trust region policy optimisation enforced a hard KL constraint, which required second-order information and a conjugate gradient solve at every update.
PPO gets most of the benefit with a first-order method and a clip, so it runs on ordinary optimisers and a few lines of code.
That simplicity is the whole reason it is the default, and it is why the same algorithm trains robots and language models.
One iteration, in order
- Run the current policy and collect a batch of transitions.
- Compute advantages, usually by generalised advantage estimation.
- Take several gradient epochs over that same batch under the clipped objective.
- Update the value network on the same data with a squared error loss.
- Discard the batch and collect again with the new policy.
Step three is the practical gain. Clipping makes it safe to reuse a batch several times, where a plain policy gradient could use it once.
In RLHF
Language model training adds an explicit penalty against the original supervised model, which is a different KL from the one PPO already controls.
The clip stops the update from being too large in one step. This term stops the policy from drifting far from a sensible model across many steps.
Without it the policy finds text that scores highly under the reward model and reads as nonsense, which is reward hacking in its clearest form.
Four models are in memory during this: the policy, the reference, the reward model and the critic, which is why direct preference methods that need only two became popular.