Proximal Policy Optimization Algorithms (PPO)

PPO banner Kaggle

Summary

PPO is a family of policy gradient methods for reinforcement learning. A normal policy gradient method uses each batch of experience for one gradient step only. PPO uses the same batch for several epochs of minibatch updates, and a clipped surrogate objective stops each update from moving the policy too far (Abstract, Section 3).

The paper says PPO has some of the benefits of trust region policy optimization (TRPO) but is much simpler to implement, more general, and has better sample complexity in their tests (Abstract). On 7 MuJoCo tasks, clipping with ε = 0.2 had the best average normalized score, 0.82, against −0.39 with no clipping or penalty and 0.62 to 0.74 for KL penalties (Table 1). On 49 Atari games, PPO won 30 games on average reward over all of training, against 18 for ACER and 1 for A2C (Table 2).

What Problem Does It Solve

Imagine learning to ride a bike from notes about your last few rides. If you change your style a lot after every ride, one bad lesson can make you fall and undo everything. If you change too little, you learn very slowly.

Policy gradient methods have the same problem. Taking many big steps on the same data can destroy the policy, and the paper shows that doing this without clipping gave a score worse than a random policy on one task (Section 6.1, Table 1). TRPO solves this with a hard limit on the change, but needs second-order optimization. PPO gets a similar safety limit with a simple change to the loss, so normal first-order optimizers such as Adam work (Sections 1 and 3).

Core Idea

  • Probability ratio: r_t(θ) = π_θ(a_t | s_t) / π_θold(a_t | s_t). It is 1 when the new policy equals the policy that collected the data (Section 3).
  • Clipped objective: L^CLIP(θ) = E_t[min(r_t(θ) Â_t, clip(r_t(θ), 1 − ε, 1 + ε) Â_t)], with ε = 0.2 (Section 3, Eq. 7).
  • Pessimistic bound: taking the minimum means the objective ignores changes in r that would make it look better, but keeps changes that make it worse. So L^CLIP is a lower bound on the unclipped objective L^CPI (Section 3).
  • Combined loss: with a value function and an entropy bonus, the objective is L^CLIP − c1 · (value loss) + c2 · (entropy) (Section 5, Eq. 9).

Key Method Details

  • Algorithm 1: N actors each collect T steps, the advantages  are computed, then the loss is optimized for K epochs with minibatches of size M (Section 5).
  • Advantages: a truncated version of generalized advantage estimation (GAE) with λ (Section 5, Eqs. 11 and 12).
  • MuJoCo settings: T = 2048, Adam stepsize 3 × 10⁻⁴, 10 epochs, minibatch 64, γ = 0.99, λ = 0.95 (Table 3). The policy is an MLP with two hidden layers of 64 tanh units, and the policy and value function share no parameters (Section 6.1).
  • Atari settings: 8 actors, c1 = 1, c2 = 0.01, and ε = 0.1 × α, where α goes from 1 to 0 during training (Table 5).
  • Alternative tried: a KL penalty with a fixed or adaptive coefficient. It did worse than clipping (Section 4, Table 1).

Simplifications in This Notebook

  • Task: CartPole-v1 (discrete actions, Categorical policy) instead of MuJoCo (continuous actions) or Atari.
  • Scale: one actor, 50,000 environment steps and one seed, instead of 1 million steps and 3 seeds per task.
  • Settings from the paper: T = 2048, 10 epochs, minibatch 64, Adam 3 × 10⁻⁴, γ = 0.99, λ = 0.95, ε = 0.2, separate 2 × 64 tanh policy and value networks. The entropy bonus c2 = 0.01 comes from the Atari table.
  • Additions not in the paper: advantage normalization per batch and gradient-norm clipping at 0.5.

What the Notebook Result Shows

  • PPO learned the task: the first 500-step episode was episode 361 of 424. In the last 50 episodes, 42 reached 500, and the last 20 averaged 464.9.
  • Greedy policy: taking the most likely action, the final policy scored 500 in all 10 evaluation episodes.
  • Clipping is small but active: the mean clip fraction was 6.19% (max 15.16%), falling from 7.91% in the first quarter to 4.20% in the last.
  • Lower bound holds: the clipped objective was never above the unclipped one (0 violations in 25 updates).
  • One easy task and one seed: this does not test the paper’s MuJoCo or Atari results.

Influence

OpenAI’s release post says “PPO has become the default reinforcement learning algorithm at OpenAI” (OpenAI blog). OpenAI Five, which played Dota 2, trained its policy with PPO (Berner et al., 2019, Section 3.2). InstructGPT fine-tuned GPT-3 from human feedback with PPO (Ouyang et al., 2022, Section 3.5). Libraries such as Stable-Baselines3 and Spinning Up include PPO. OpenAlex lists about 41,800 citations (41,821 when checked on 3 December 2026).


Resources

File Description
README.md This overview — a 5-minute read covering the paper’s summary, core idea, key method details, influence, and a plain-English explanation of the problem it solves
solution.ipynb From-scratch PyTorch PPO (clipped objective, GAE, separate policy and value networks) trained on CartPole-v1, with clip-fraction and objective plots
CODE_ARCHITECTURE.md Section-by-section breakdown of the notebook — what each cell does, data flow, tensor shapes, and key design decisions
TALK.md Press coverage, Q&A (answers from the paper), citations, and common misconceptions about the paper

Table of contents