Numerator = the new policyπθ (the one we are updating). Denominator = the old policy πθold that collected the data.
rt=0.8 means the new policy makes this sampled action ==20% less likely== than the old policy did. It sits exactly on the lower clip edge when ϵ=0.2.
Recall Solution
clip just squeezes the number back into [0.8,1.2]:
0.65<0.8⇒0.8
1.0 is inside ⇒1.0
1.35>1.2⇒1.2
Recall Solution
A^t>0 = better-than-average action, so we want it more likely ⇒ push rtup (above 1). Recall from the Policy Gradient Theorem that we scale ∇logπ by A^: positive advantage pushes probability up.
min(4.4,4.4)=4.4. Both branches equal ⇒ gradient flows, PPO acts like plain policy gradient here.
Recall Solution
Unclipped: 1.6×4=6.4
Clip: clip(1.6,0.8,1.2)=1.2⇒1.2×4=4.8
min(6.4,4.8)=4.8. Clipped branch active ⇒ ∂L/∂rt=0: no reward for pushing further.
Recall Solution
Unclipped: 0.5×(−3)=−1.5
Clip: clip(0.5,0.8,1.2)=0.8⇒0.8×(−3)=−2.4
min(−1.5,−2.4)=−2.4. The more negative value wins the min. Clipped branch active ⇒ gradient =0: PPO refuses to suppress a bad action even more in one step.
Recall Solution
Unclipped: 1.4×(−3)=−4.2
Clip: clip(1.4,0.8,1.2)=1.2⇒−3.6
min(−4.2,−3.6)=−4.2. Unclipped active ⇒ gradient flows to push rtdown: we are always allowed to undo a mistake.
A^>0: the objective rises with rt until it hits the cap (1+ϵ)A^. So gradient is zero for rt>1+ϵ=1.2. Below that it flows.
A^<0: objective is rtA^ (a decreasing line since A^<0). We want it larger, i.e. rt smaller. The clip caps the "reward" once rt<1−ϵ=0.8. So gradient is zero for rt<0.8.
Summary of the flat (zero-gradient) region:
A^>0:rt>1.2,A^<0:rt<0.8.
These are exactly the "you've moved far enough in the helpful direction" zones.
Recall Solution
For A^>0, min(rtA^,clip(rt)A^) compares two increasing multiples of A^; the min tracks the smaller multiplier:
\begin{cases}
r_t\,\hat A, & r_t\le 1.2\\[4pt]
1.2\,\hat A, & r_t> 1.2
\end{cases}$$
Below $r_t=0.8$: $\operatorname{clip}=0.8$ but $r_t<0.8$, and since $\hat A>0$ the **min picks $r_t$** (smaller) — so the low side is *not* flattened. The curve rises, flattens after $1.2$. (This is the blue curve in the next figure.)Recall Solution
For A^<0, multiplying by a negative number flips which multiplier gives the smaller product; the min now picks the larger multiplier:
\begin{cases}
0.8\,\hat A, & r_t< 0.8\\[4pt]
r_t\,\hat A, & r_t\ge 0.8
\end{cases}$$
Flat (gradient zero) for $r_t<0.8$; a downward-sloping line (penalty grows) for $r_t\ge0.8$, including the whole region above $1.2$ — so raising a bad action's probability is **never** shielded. (Pink curve, next figure.)
Ratios are computed from log-probs to stay numerically stable:
rt=exp(logπθ−logπθold)=exp(−0.90−(−1.20))=exp(0.30)≈1.3499.
Since rt≈1.35>1.2 and A^>0:
Unclipped =1.3499×2=2.6997
Clipped =1.2×2=2.4
min⇒2.4, clipped branch active, gradient =0.
Recall Solution
Per-sample (from L2 logic):
min(2.2,2.2)=2.2
min(3.0,2.4)=2.4
min(−1.0,−1.6)=−1.6
min(−2.6,−2.4)=−2.6
Mean =42.2+2.4−1.6−2.6=40.4=0.10.
Recall Solution
Value loss: (5.0−6.5)2=(−1.5)2=2.25; times c1=0.5⇒1.125.
Entropy bonus: 0.01×0.7=0.007. (This term, from Entropy Regularization, keeps exploration alive.)
L=2.4−1.125+0.007=1.282.Why signs: value loss is subtracted (we minimise squared error while maximising L); entropy is added (we reward randomness).
PPO stops rewarding a positive-advantage action once rt>1+ϵ. To cap the rewarded range at 1.25, set 1+ϵ=1.25⇒ϵ=0.25.
What it does NOT constrain: for A^<0, ratios above1.2(=1.25 here) are left open by design — so a bad action wrongly made more likely can still have rt arbitrarily large in the objective; the gradient (correctly) drives it back down but PPO does not hard-cap it. Clipping is a soft trust region, unlike TRPO's hard KL constraint.
Mechanism: the Importance Sampling ratio rt is only trustworthy near πθold. With no clip, the optimizer keeps pushing rt→∞ for the largest (often noisy) positive A^. After a couple of epochs the new policy is far from the old one, so the surrogate no longer approximates the true return J(θ) — the "improvement" is fictitious and the real policy degrades (collapse).
Fix: reinstate LCLIP (or add a KL penalty). The clip zeroes the gradient once rt>1+ϵ for good actions, keeping every epoch's update inside the region where the surrogate is valid — this is precisely PPO's cheap stand-in for the Actor-Critic Methods + TRPO trust region.