The clipped surrogate objective lets proximal policy optimization (PPO) reuse data collected by an older policy while discouraging overly large updates. Importance sampling adjusts for the difference between the current policy and the policy that generated the data; clipping limits the incentive to move the sampled action’s probability too far in a favorable direction. section 6.2.5
Equation 6.30
\[\label{eq:PPO_EQN_EXPECTED} \begin{aligned}[b] J(\theta) &= \mathbb{E}_{t}\left[ \min\left(\rho_t(\theta)A_t,\ \text{clip}(\rho_t(\theta),1-\varepsilon,1+\varepsilon)A_t\right) \right], \\[5pt] \rho_t(\theta) &= \frac{\pi_\theta(a_t\mid s_t)}{\pi_{\theta_{\text{old}}}(a_t\mid s_t)}. \end{aligned}\]The objective averages the smaller of the unclipped and clipped advantage-weighted terms over sampled time steps. section 6.2.5
At time t, the ratio ρₜ is the current policy’s probability of the sampled action divided by the old policy’s probability. The advantage Aₜ measures whether the action was better or worse than the value estimate. The clip parameter ε sets the interval [1−ε, 1+ε]. PPO maximizes the minimum of ρₜAₜ and clip(ρₜ, 1−ε, 1+ε)Aₜ; a loss for minimization is its negative. section 6.2.5 section 6.2.6
Inside the clipping interval, the objective follows the ordinary advantage-weighted policy-gradient term. Outside it, the minimum makes the objective flat only in the favorable direction: above 1+ε for a positive advantage, or below 1−ε for a negative advantage. Unfavorable changes remain penalized. Clipping removes an incentive for further movement on an individual sample; it does not guarantee that the policy ratio stays inside the interval. section 6.2.5 section 6.2.6
Positive and negative advantages
With ε = 0.2, the clipping interval is [0.8, 1.2]. If A = 1 and ρ = 1.3, the objective selects 1.2 rather than 1.3. If A = −1 and ρ = 0.7, it selects −0.8 rather than −0.7. In each case, further movement in the favorable direction does not improve that sample’s objective. section 6.2.5 section 6.2.6
pg_losses1 = -advantages * ratio # Shape: (B*G, L)
pg_losses2 = -advantages * torch.clamp(
ratio,
1.0 - eps,
1.0 + eps,
) # Shape: (B*G, L)
pg_loss_max = torch.max(pg_losses1, pg_losses2) # Shape: (B*G, L)
A PyTorch implementation negates the two advantage-weighted terms and takes their maximum: minimizing this loss is equivalent to maximizing the minimum surrogate. section 6.3.5
For language-model training, the ratio and loss can be computed per token. The old policy is the one that generated the current batch, not necessarily the initial reference model used for a KL penalty. A practical pipeline also estimates and normalizes advantages, trains a value function, and masks completion padding. These choices add complexity; clipping is one part of the update, not a substitute for those components. section 6.2.5 section 6.3.5

