Proximal Policy Optimization
Proximal Policy Optimization (PPO) is a policy-gradient method designed to take the largest useful improvement step without destabilizing training. A raw policy gradient can push the policy so far that the data it was estimated from no longer describes it, collapsing performance. PPO constrains each update to stay close to the policy that gathered the data, which makes it stable enough to be the default choice in continuous control and in RLHF.
The Update Ratio
PPO works with the probability ratio between the new and old policies for the action actually taken:
A ratio above 1 means the new policy makes the action more likely. Multiplying this ratio by the advantage gives the importance-weighted policy-gradient objective, but maximizing it directly allows unbounded steps.
Clipped Surrogate Objective
PPO clips the ratio so that moving it beyond a band yields no further objective gain:
The makes the bound one-sided in the right direction: for a positive advantage, improvement is capped once the action is already times more likely; for a negative advantage, the penalty is capped symmetrically. A typical is –. This is a cheap, first-order approximation to the trust region that TRPO enforces with a hard KL constraint.
Advantage Estimation
The advantage measures how much better an action was than the policy’s average at that state. PPO usually estimates it with generalized advantage estimation (GAE), which blends multi-step temporal-difference errors:
The parameter trades bias for variance exactly as in TD(). A learned value function acts as the critic and is trained alongside the policy.
Algorithm Sketch
flowchart TD Policy[Current policy] --> Rollout[Collect trajectories from the environment] Rollout --> Advantage[Estimate returns and GAE advantages] Advantage --> Optimize[Maximize the clipped surrogate over several epochs] Optimize --> Constrain[Clipping keeps the update near the old policy] Constrain --> Policy
repeat:
run the current policy to collect a batch of trajectories
compute rewards, value estimates, and GAE advantages
for several epochs over minibatches:
compute ratio r_t(theta) against the old policy
maximize the clipped surrogate + value loss + entropy bonus
set old policy <- current policyReusing each batch for several epochs is what makes PPO more sample-efficient than a single-step policy gradient, while clipping keeps those repeated updates from drifting too far.
Why PPO Dominates RLHF
In RLHF, the policy is a language model, the reward comes from a learned reward model, and a KL penalty to the original model keeps generations on-distribution. PPO fits because it is robust to noisy, learned rewards, needs little hyperparameter surgery, and its clipping plus KL control directly limit how far the model moves from its supervised starting point, guarding against reward over-optimization.
Caveats
PPO is still on-policy and discards data after a few epochs, so it is less sample-efficient than strong off-policy methods like soft actor-critic. Its clip is a heuristic, not a true trust region, and performance is sensitive to advantage normalization, learning rate, and the number of epochs per batch.
Connections
- Policy Gradients and Actor-Critic Methods provide the objective and the critic PPO builds on.
- Reinforcement Learning from Human Feedback uses PPO as its optimizer with an added KL penalty.
- LLM Training places PPO-based alignment in the wider training pipeline.
References
- Schulman et al., 2017, Proximal Policy Optimization Algorithms
- Schulman et al., 2015, Trust Region Policy Optimization
- Schulman et al., 2016, High-Dimensional Continuous Control Using Generalized Advantage Estimation
- Ouyang et al., 2022, Training Language Models to Follow Instructions with Human Feedback
Nav