Proximal Policy Optimization

The workhorse of reinforcement learning, and the algorithm behind classic RLHF.

🔴 advanced5 min readrlalignmentmust-know
PPO is the go-to reinforcement learning algorithm, and it is the one used in classic RLHF for chatbots. Plain policy gradient methods can take one oversized update and wreck a policy that was working well. PPO prevents that by limiting how much the probability of any action can change in a single update. If an update would move it by more than a small amount, the extra change is ignored. That keeps learning steady, and it is far simpler than earlier methods with the same aim.

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, keeping policy updates small and stable 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