PPO Algorithm › The Clipped Objective
Language AI HandbookAll chapters PPO Algorithm › The Clipped ObjectiveOne section · Sections in this chapter5 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
PPO's key innovation is straightforward: clip the probability ratio to remove incentives for excessive policy changes. Rather than imposing a hard constraint requiring complex optimization machinery, PPO modifies the objective function itself, so large policy changes provide no additional benefit. The clipping mechanism is self-limiting: once the policy has changed enough to fall outside the allowed range, the gradient signal turns off, and the optimizer cannot push the policy further in that direction.
Think of the clipped objective as a reward system with diminishing returns for policy changes. The policy earns credit for adjusting action probabilities in the direction indicated by the advantage, but only up to a point. Beyond the clip threshold, additional changes earn no extra credit. This is like an employer who rewards employees for working overtime, but only up to a cap: you can work as many hours as you want, but you only get paid extra for the first few hours of overtime. The cap prevents extreme behavior without eliminating the incentive entirely.
The clipped surrogate objective is:
where is a hyperparameter, typically set between 0.1 and 0.2, that defines the trust region width. This single parameter controls how much the policy can change in each update. Larger allows more aggressive updates. Smaller enforces tighter constraints and slower learning.
To understand precisely how clipping constrains the ratio, we need to examine the clip function itself. The clip function constrains the probability ratio to remain within the interval , defined as:
Each component of this piecewise function serves a specific purpose:
- : the input value to be clipped; in PPO, this is , the probability ratio
- : the lower bound of the allowed range
- : the upper bound of the allowed range
- The function returns unchanged if it's within the bounds, otherwise returns the nearest bound
The key intuition is that this clipping removes the gradient signal when the ratio moves outside the trust region. Consider what happens during optimization: you want the optimizer to adjust parameters to increase the objective. If the new policy is already making an action much more likely, with a ratio greater than , or much less likely, with a ratio less than , than the old policy, clipping prevents the optimizer from pushing it even further in that direction. The clipped term becomes constant with respect to the parameters, meaning its gradient is zero, so there is no signal encouraging further movement in that direction.
This clipped ratio is then used in computing the clipped surrogate objective. Returning to the full formula and examining it in detail:
Each component plays a specific role in creating stable policy updates:
- : the clipped surrogate objective that PPO maximizes
- : expectation over all timesteps in the collected batch
- : takes the smaller of the two arguments (the pessimistic bound)
- : the probability ratio
- : the advantage estimate at timestep
- : the clipping parameter, typically 0.1 to 0.2, that defines the trust region
- : constrains the ratio to the interval
Understanding the Clipping Mechanism
The operation is important. It selects the smaller of the unclipped and clipped objectives. This keeps a pessimistic (conservative) bound on the improvement. By always choosing the lower value, we prevent the optimizer from being overly optimistic about improvements that would require large policy changes. We will analyze both cases based on the sign of the advantage.
Case 1: Positive Advantage ()
When an action is better than expected (positive advantage), we want to increase its probability. The unclipped objective's gradient pushes the policy to make this action more likely, but PPO limits the extent.
- If : The clipped term is smaller than , since and . The selects the clipped term , which is constant with respect to , so the gradient is zero and provides no incentive for us to increase the ratio further.
- If : Both terms are equal or the unclipped term is smaller, so normal optimization proceeds.
This means that once the probability ratio exceeds , the optimizer receives no additional reward for increasing it further. The policy has already been sufficiently encouraged to take this good action. Importantly, the policy can still take that action at a higher probability than the old policy, it just does not receive additional credit for pushing the probability even higher.
Case 2: Negative Advantage ()
When an action is worse than expected (negative advantage), we want to decrease its probability. The unclipped objective's gradient encourages this, but PPO limits the extent:
- If : Since , multiplying by smaller values makes the product more negative. The clipped term is larger (less negative) than the unclipped term because . The selects the more negative unclipped term. Since the clipped term is constant, its gradient is zero and the objective becomes flat once drops below , preventing the policy from decreasing the probability further.
- If : Normal optimization proceeds.
This prevents the policy from becoming too averse to actions that happened to have negative advantage. Such actions might still be valuable in other states, and excessively penalizing them could harm overall performance. The clipping protects both ends: it prevents overconfidence about good actions and overpunishment of bad ones.
The following figure illustrates this behavior:


Clipping creates a "pessimistic bound" on the objective. When the policy tries to change too much, the objective flattens and provides no gradient signal to continue. This self-limiting behavior makes PPO stable without requiring the complex second-order optimization of TRPO. The operation is the mechanism: it always selects whichever value is more conservative, preventing the optimizer from exploiting large policy changes that might not generalize.