Reinforcement Learning

Proximal Policy Optimization

Clipping probability ratio updates to achieve stable, sample-efficient policy gradient updates in RL and LLM alignment.

🔴 advanced5 min readrlalignmentmust-know
Proximal Policy Optimization (PPO - Schulman et al., 2017 / OpenAI) is the workhorse policy optimization algorithm for deep RL and LLM RLHF alignment. Standard policy gradient updates suffer from destructive large parameter steps that permanently collapse model performance. PPO introduces a Clipped Surrogate Objective function L_CLIP(θ) = E [ min( r_t(θ) A_t, clip(r_t(θ), 1-ε, 1+ε) A_t ) ], capping the probability ratio r_t(θ) = π_θ(a|s) / π_old(a|s) within [1-ε, 1+ε] to guarantee conservative, monotonic policy improvements.

Why PPO Was Created: Trust Region Motivation

In supervised learning, if a gradient step is too large, the next mini-batch corrects it.

In Reinforcement Learning, taking an overly aggressive policy step Δθ\Delta \theta ruins data collection: the degraded policy generates bad trajectory data, causing irrecoverable policy collapse.

The Clipped Surrogate Objective LCLIP(θ)L^{\text{CLIP}}(\theta)

Let the Probability Ratio rt(θ)r_t(\theta) be:

rt(θ)=πθ(at∣st)πold(at∣st),where rt(θold)=1.0r_t(\theta) = \frac{\pi_\theta(a_t \mid s_t)}{\pi_{\text{old}}(a_t \mid s_t)}, \quad \text{where } r_t(\theta_{\text{old}}) = 1.0 LCLIP(θ)=E^t[min⁡(rt(θ)A^t,clip(rt(θ),1−ϵ,1+ϵ)A^t)]L^{\text{CLIP}}(\theta) = \hat{\mathbb{E}}_t \left[ \min\left( r_t(\theta) \hat{A}_t, \text{clip}\left( r_t(\theta), 1-\epsilon, 1+\epsilon \right) \hat{A}_t \right) \right]

Standard hyperparameter setting: ϵ=0.2\epsilon = 0.2 (Clips ratio rt∈[0.8,1.2]r_t \in [0.8, 1.2]).

   Positive Advantage (A_t > 0)                       Negative Advantage (A_t < 0)
   L_CLIP                                              L_CLIP
     │                                                   │
  1+ε├─────────────── Upper Bound                        │
     │              /                                    │               /
     │             /                                  1-ε├──────────────/─ Lower Bound
     │            /                                      │             /
  1.0├───────────/                                    1.0├────────────/
     └───────────┴─────────────► r_t                     └────────────┴──────────────► r_t
     1.0      1+ε                                         1-ε        1.0

Complete PPO Combined Loss

LPPO(θ)=E^t[LCLIP(θ)−c1LVF(θ)+c2S[πθ](st)]L^{\text{PPO}}(\theta) = \hat{\mathbb{E}}_t \left[ L^{\text{CLIP}}(\theta) - c_1 L^{\text{VF}}(\theta) + c_2 S[\pi_\theta](s_t) \right]

Say this out loud

"PPO stabilizes policy gradient updates using a Clipped Surrogate Objective L_CLIP(θ) = E [ min( r_t A_t, clip(r_t, 1-ε, 1+ε) A_t ) ]. By capping probability ratio r_t = π_θ / π_old within [1-ε, 1+ε] (typically [0.8, 1.2]), PPO prevents destructive large policy steps, providing smooth, monotonic policy improvements in RL and LLM RLHF."

Follow-ups to expect

Check yourself

Question 1 of 3

Why is standard un-clipped Policy Gradient (REINFORCE) dangerously unstable during deep neural network training?

More in Reinforcement Learning

See all →
Value-Based vs Policy-Based Methods5 minMulti-Armed Bandits4 minMarkov Decision Processes4 min