Skip to content

The Clipped Surrogate

The PPO objective takes the minimum of the unclipped and clipped surrogate:

LCLIP(θ)=Et[min(rt(θ)A^t,  clip(rt(θ),1ϵ,1+ϵ)A^t)]L^{CLIP}(\theta) = \mathbb{E}_t \left[ \min \left( r_t(\theta) \hat{A}_t, \; \text{clip}(r_t(\theta), 1-\epsilon, 1+\epsilon) \hat{A}_t \right) \right]

Let’s break this down for both cases:

When A^t>0\hat{A}_t > 0 (the action was good)

Section titled “When A^t>0\hat{A}_t > 0A^t​>0 (the action was good)”

We want to increase πθ(atst)\pi_\theta(a_t \mid s_t), which increases rtr_t. But the clip caps the benefit at rt=1+ϵr_t = 1 + \epsilon:

Lt=min(rtA^t,(1+ϵ)A^t)={rtA^tif rt1+ϵ(1+ϵ)A^tif rt>1+ϵL_t = \min(r_t \hat{A}_t, (1+\epsilon) \hat{A}_t) = \begin{cases} r_t \hat{A}_t & \text{if } r_t \leq 1+\epsilon \\ (1+\epsilon)\hat{A}_t & \text{if } r_t > 1+\epsilon \end{cases}

When A^t<0\hat{A}_t < 0 (the action was bad)

Section titled “When A^t<0\hat{A}_t < 0A^t​<0 (the action was bad)”

We want to decrease πθ(atst)\pi_\theta(a_t \mid s_t), which decreases rtr_t. The clip prevents over-correction below rt=1ϵr_t = 1 - \epsilon:

Lt=min(rtA^t,(1ϵ)A^t)={rtA^tif rt1ϵ(1ϵ)A^tif rt<1ϵL_t = \min(r_t \hat{A}_t, (1-\epsilon) \hat{A}_t) = \begin{cases} r_t \hat{A}_t & \text{if } r_t \geq 1-\epsilon \\ (1-\epsilon)\hat{A}_t & \text{if } r_t < 1-\epsilon \end{cases}

Adjust ϵ\epsilon and toggle the advantage sign to see how the clipping region changes:

Suppose at a single timestep we have:

  • πθold(as)=0.20\pi_{\theta_\text{old}}(a \mid s) = 0.20
  • A^t=+1.5\hat{A}_t = +1.5 (good action)
  • ϵ=0.2\epsilon = 0.2

Consider three candidate post-update probabilities πθ(as)\pi_\theta(a \mid s):

πθ\pi_\thetart=πθ/πoldr_t = \pi_\theta / \pi_\text{old}Inside trust region?LCLIPL^{CLIP} contribution
0.221.10yes (1 − ε = 0.8, 1 + ε = 1.2)1.101.5=1.651.10 \cdot 1.5 = 1.65
0.261.30no, clipped to 1.20min(1.301.5,1.201.5)=1.80\min(1.30 \cdot 1.5,\, 1.20 \cdot 1.5) = 1.80
0.402.00clipped to 1.20min(2.001.5,1.201.5)=1.80\min(2.00 \cdot 1.5,\, 1.20 \cdot 1.5) = 1.80

Notice the contribution stops growing at rt=1.20r_t = 1.20. The gradient with respect to θ\theta at that point is zero — pushing πθ\pi_\theta from 0.26 to 0.40 buys exactly zero more reward in the objective. That is the trust-region effect made concrete.

Now flip the advantage. With A^t=1.5\hat{A}_t = -1.5 (bad action) the clip activates on the low side:

πθ\pi_\thetartr_tLCLIPL^{CLIP} contribution
0.180.900.90(1.5)=1.350.90 \cdot (-1.5) = -1.35
0.140.70min(0.701.5,0.801.5)=min(1.05,1.20)=1.20\min(0.70 \cdot -1.5,\, 0.80 \cdot -1.5) = \min(-1.05, -1.20) = -1.20
0.050.25min(0.251.5,0.801.5)=1.20\min(0.25 \cdot -1.5,\, 0.80 \cdot -1.5) = -1.20

For a bad action the min\min takes the more negative number, so the clip prevents extreme down-weighting from over-rewarding the loss. Either way, πθ\pi_\theta stays inside [0.16,0.24][0.16, 0.24] (i.e. within ±20%\pm 20\% of πold=0.20\pi_\text{old} = 0.20) before clipping kicks in.

ϵ\epsilonEffect
0.1Very conservative — slow but stable
0.2Standard (OpenAI default)
0.3More aggressive — faster but riskier

In practice, ϵ=0.2\epsilon = 0.2 works well across many tasks, including RLHF for language models.

  • Schulman et al. Proximal Policy Optimization Algorithms. 2017, §3. arXiv:1707.06347