Policy Gradient Methods • Part 3 of 4
📝Draft

Why PPO Works

Simplicity, stability, and performance

PPO has become the default choice for many RL applications, from game playing to robotics to training large language models. Its success comes from an unusual combination: theoretical motivation from trust regions, practical simplicity of clipping, and robust performance across diverse domains.

The Core Insight

PPO rests on one observation: much of TRPO’s benefit can be captured by a far simpler heuristic—remove the incentive for large per-sample policy changes. (For a hands-on view of exactly what this heuristic does to the objective, see the interactive clipping explorer in The PPO Algorithm.)

TRPO asked: “How do we exactly satisfy a KL constraint?” PPO asked: “What’s the simplest objective that stops rewarding big updates?”

The answer: clip the surrogate objective and take the minimum. This is a heuristic — it comes with no formal guarantee that the policy stays close to the old one — but it works surprisingly well in practice.

What Clipping Actually Does

Mathematical Details

Consider a single sample as we optimize the clipped objective:

Ratio near 1:

  • The unclipped objective dominates
  • Gradients flow normally
  • Policy improves

Ratio beyond 1±ϵ1 \pm \epsilon in the direction the advantage favors:

  • The clipped branch is selected
  • That sample’s gradient contribution becomes zero
  • The sample stops encouraging further change

Crucially, this is not a constraint on the policy:

  • Zeroing one sample’s gradient does not stop the other samples in the batch from updating the shared parameters — and those updates can push this sample’s ratio even further outside the clip range.
  • Nothing pulls a ratio back once it has crossed the boundary; clipping only stops pushing.

As a result, realized probability ratios — and the KL divergence between the old and new policies — can and do exceed the clip range in practice (see “Truly Proximal Policy Optimization”, Wang et al.). Clipping removes the incentive for large per-sample updates; it does not bound the update. This is why practitioners monitor the empirical KL and often stop the update epochs early when it exceeds a target.

Imagine a rubber band attached to the old policy. As you pull the new policy away:

  • Small distance: Rubber band is slack, you can move freely
  • Large distance: TRPO says “forbidden!”; PPO says “zero gradient, no benefit”

The rubber band analogy breaks down in an important way: PPO’s band never actually pulls back, it just goes slack — it stops pushing. And updates driven by other samples can still carry the policy further out. In practice the policy usually stays close to where it started, but that is an empirical tendency, not a guarantee.

Stability Through Pessimism

The min in PPO’s objective creates a pessimistic bound:

LCLIP=min(rA,clip(r)A)L^{CLIP} = \min(r \cdot A, \text{clip}(r) \cdot A)

We always take the worse (lower) of two options. This conservative approach means:

  1. The surrogate never rewards pushing a sample’s ratio further beyond the clip range
  2. Per-sample incentives for extreme changes are removed
  3. We sacrifice some potential improvement for stability

This pessimism helps stability. We’d rather make slower progress than chase large, unreliable updates.

Mathematical Details

The pessimistic construction ensures:

LCLIP(θ)Lunclipped(θ)L^{CLIP}(\theta) \leq L^{unclipped}(\theta)

Equality holds when the ratio is in [1ϵ,1+ϵ][1-\epsilon, 1+\epsilon]. Outside this range, the clipped objective is a lower bound on the unclipped surrogate.

Note what this does and does not say: it is a statement about the surrogate objective, not a guarantee about the true performance of the new policy or about how far the policy moves. Formal monotonic-improvement guarantees belong to TRPO, under its assumptions.

Simplicity Enables Scale

PPO’s simplicity has practical benefits beyond just being easy to implement:

Standard optimizers work: Adam, SGD, whatever you’re used to. No special second-order methods.

Parallelization is easy: Collect experience from many environments, concatenate, optimize. No complex synchronization.

Hyperparameters are interpretable: Clip range, learning rate, number of epochs - all have clear meaning.

Debugging is straightforward: If something goes wrong, you can trace through the loss calculation step by step.

This simplicity has enabled PPO to scale to problems that would be impractical with more complex algorithms.

📌Example

PPO in Practice: ChatGPT

OpenAI used PPO as the RL algorithm inside its RLHF (reinforcement learning from human feedback) pipeline for InstructGPT — the direct precursor of ChatGPT’s training method (the InstructGPT paper calls its variant “PPO-ptx”). This is a testament to PPO’s scalability:

  • Billions of parameters
  • Complex reward signals from human preferences
  • Distributed training across many GPUs

The simplicity of PPO made it practical to integrate with the complex infrastructure needed for large language model training.

Multiple Epochs: Sample Efficiency

One of PPO’s biggest advantages over vanilla policy gradient is reusing experience.

REINFORCE: Collect batch, update once, discard batch. PPO: Collect batch, update 3-10 times, then discard batch.

The clipping makes this workable: it removes the incentive for the policy to keep chasing the same batch. Without it, multiple epochs would rapidly drive the policy away from the data distribution. Even with clipping the policy can still drift, so implementations monitor the KL divergence between old and new policies and stop the epochs early when it exceeds a target.

Reusing each batch for several epochs extracts more learning per sample than single-epoch methods.

Mathematical Details

After kk epochs of optimization on the same batch:

  • Without clipping: Nothing even discourages the policy from moving arbitrarily far from πold\pi_{old}
  • With clipping: Any sample whose ratio has moved beyond [1ϵ,1+ϵ][1-\epsilon, 1+\epsilon] in the direction its advantage favors contributes zero gradient

But clipping is per-sample and one-sided. Gradient updates driven by the other samples keep moving the shared parameters, so individual ratios routinely end up outside the clip range, and the overall KL divergence can grow well beyond what the clip range suggests. Clipping removes the incentive for large per-sample updates — it does not bound them. The practical safeguard is monitoring the empirical KL and early-stopping the epochs at a target KL.

Comparison with Other Methods

PPO vs. TRPO

TRPO
  • Policy-change control: explicit KL constraint
  • Optimization: conjugate gradient + line search
  • Implementation: complex (~300 lines)
  • Performance: slightly better in some cases
  • Scalability: limited
PPO (highlighted)
  • Policy-change control: clipped surrogate (heuristic, no bound)
  • Optimization: standard gradient descent
  • Implementation: simple (~100 lines)
  • Performance: comparable, sometimes better
  • Scalability: excellent

TRPO is more principled but harder to implement and scale. PPO trades some theoretical purity for practical benefits. In most cases, the performance difference is negligible.

PPO vs. A2C

A2C
  • Updates per batch: 1
  • Update-size control: none
  • Stability: can collapse
  • Sample efficiency: lower
PPO (highlighted)
  • Updates per batch: multiple
  • Update-size control: clipped surrogate
  • Stability: more stable
  • Sample efficiency: higher

A2C is simpler but less robust. PPO’s clipping and multiple epochs make it significantly more stable and sample-efficient, at a small computational cost.

PPO vs. DQN

DQN
  • Learning paradigm: value-based
  • Actions: discrete only
  • Exploration: epsilon-greedy
  • Replay buffer: yes (off-policy)
  • Sample efficiency: higher
PPO
  • Learning paradigm: policy-based
  • Actions: discrete or continuous
  • Exploration: stochastic policy
  • Replay buffer: no (on-policy)
  • Sample efficiency: lower

DQN is more sample-efficient (it can reuse old experience), but PPO handles continuous actions naturally and is often more stable. The choice depends on your problem.

When PPO Struggles

Why Is It Called “Proximal”?

“Proximal” means “close to” or “nearby.” The name reflects PPO’s goal:

Proximal Policy Optimization = Optimize the policy while staying proximal (close) to the previous policy

This is the spirit of trust-region methods: make progress, but don’t stray too far from what you know works. PPO encourages proximity rather than enforcing it.

The mathematical term comes from “proximal operators” in optimization, though PPO doesn’t use them directly. The name captures the spirit: keep updates close to the starting point.

The PPO Philosophy

PPO embodies a pragmatic philosophy:

  1. Simple is better: Don’t add complexity unless it clearly helps
  2. Robust beats optimal: Consistent good results beat occasional great results
  3. Scale matters: An algorithm that works on GPUs beats one that doesn’t
  4. Trust but verify: Keeping updates small is good, but since clipping doesn’t enforce it, monitor the KL to verify

This philosophy has proven remarkably successful. PPO works well across games, robotics, and language models - domains that seem to have little in common.

Summary

PPO works because it:

  • Removes the incentive for large per-sample updates with simple clipping (with KL monitoring as the real safeguard — clipping itself bounds nothing)
  • Uses a pessimistic surrogate for stability
  • Enables multiple epochs for sample efficiency
  • Scales easily with standard optimizers
  • Performs consistently across diverse problems

The combination of theoretical motivation, practical simplicity, and robust performance has made PPO the go-to algorithm for many practitioners.