Proximal Policy Optimization
PPO trains a decision-making policy by taking many small, capped steps toward whatever action sequence earned more reward, refusing any single update large enough to wreck what already works.
Prerequisites: The Policy Gradient Theorem, Markov Decision Processes
Imagine retraining a junior trader after one lucky week. The temptation is to overhaul their entire playbook to match whatever they happened to do that made money. That is dangerous: one good week is noisy evidence, and a full rewrite could destroy parts that were working for unrelated reasons. The sane approach is to nudge behaviour a little toward the profitable pattern, check how it performs, then nudge again. Proximal Policy Optimization, PPO, is that caution turned into an algorithm for training a reinforcement-learning agent.
An RL agent has a policy — a rule mapping situations to actions, written , where is the adjustable weights that define it. Training adjusts so that action sequences that earned more reward become more likely. Policy gradient methods, which move directly uphill on reward, can take a step so large that the policy collapses — it starts acting on situations it never experienced, generating garbage data that makes the next update worse. PPO's entire contribution is a governor on step size.
The mechanism: a leash, not a compass
Standard policy gradient asks "which direction increases expected reward?" and steps that way. PPO asks the same question but also asks "how far did the new policy drift from the old one on this decision?" and refuses to reward drifting too far, even if the reward signal says to.
Define the probability ratio for a given action in situation :
In words: how much more (or less) likely the new policy makes this action compared to the policy you started the update from. If , the new policy is 40% more inclined toward that action; if , it is 40% less inclined.
Multiply that ratio by , the advantage — a number estimating how much better this action was than the policy's average action in that situation (positive means better than average, negative means worse). The raw policy-gradient objective is : push up when the advantage is positive, down when it's negative. PPO's fix is to clip that ratio:
In plain English: compute the reward you'd get from moving the ratio freely, and separately compute the reward from a version of the ratio capped to stay within (typically , so the ratio is clamped between 0.8 and 1.2). Take whichever of the two is worse (the minimum). That last step is the trick — it means the objective never rewards the policy for straying outside the leash, even when straying would look profitable in this update.
Watch the step-size control: too large a step overshoots and oscillates, too small crawls. PPO's clip is exactly a mechanism for keeping every single update inside the "converging" zone instead of the "overshooting" one, applied specifically to how far the policy's behaviour is allowed to move, not to the raw learning rate.
Worked example 1: clipping a good action
Suppose the old policy assigned probability to an action, and a gradient step would push it to , giving , with advantage (it worked out well). Unclipped objective: . Clipped ratio caps at , giving . PPO takes the minimum: . Past , the gradient of this term is zero — the optimizer gets no further reward for pushing this action's probability up beyond the leash, even though the raw objective would say to.
Worked example 2: clipping a bad action from over-correcting
Now an action has advantage and a step would drop its ratio to . Unclipped: . Clipped ratio floors at , giving . The minimum of the two is , so PPO uses the clipped, more negative value — it does not soften the penalty here. Clipping only ever blocks reward for overshooting past the trusted region; it never softens a deserved penalty. That asymmetry is what keeps the policy from swinging wildly in either direction.
PPO answers "should I take this gradient step?" with "only up to the point where the new policy's behaviour drifts more than roughly 20% from the old one" — and it enforces that by refusing to let the training objective reward drifting further, rather than by tuning a fragile learning rate.
What this means in practice
PPO is the default choice for training RL agents — including reward-model-tuned language models — because it is far more forgiving of hyperparameter choices than earlier policy-gradient methods, while avoiding the collapse that plain policy gradient suffers on noisy reward signals, which describes almost every real trading environment. In a market-making or execution agent, the advantage estimate is itself noisy, so the clip stops one lucky or unlucky sequence of fills from rewriting the whole policy in one update.
The clip bounds the policy's change per update, not the reward's variance or the learning rate. It only prevents one specific failure — a single update over-trusting one batch of experience. Reward scaling and the optimizer's learning rate still need separate tuning, and a badly designed reward function will still train a bad policy, just slowly and safely.
Related concepts
Practice in interviews
Further reading
- Schulman et al., Proximal Policy Optimization Algorithms (2017)
- Sutton & Barto, Reinforcement Learning: An Introduction, ch. 13