Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

Proximal Policy Optimisation (PPO)

Policy gradient with a clipped objective that stops updates from changing the policy too much.

The idea

After collecting data, PPO takes several gradient steps on the same batch, but clips the probability ratio r = π_new/π_old to [1 − ε, 1 + ε]. Once an action's probability has moved enough in the helpful direction, the gradient is cut off, keeping each update inside a safe "trust region" with a simple first-order method.

L = E[min(r·A, clip(r, 1−ε, 1+ε)·A)]

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

action 1true reward 0.425%action 2true reward 0.625%action 3true reward 0.125%action 4true reward 0.925%
  • probability of action
  • sample pushed up
  • sample pushed down

The policy starts uniform: every action is equally likely.

iteration:
0
expected reward:
0.5
1/41

Dashed ticks mark each action's probability before this iteration's updates.

Step by step

  1. 1Collect trajectories with the current policy.
  2. 2Compute advantages (often with GAE).
  3. 3Compute the ratio r = π_new(a|s)/π_old(a|s).
  4. 4Maximise min(r·A, clip(r, 1−ε, 1+ε)·A) for several epochs.
  5. 5Replace the old policy and repeat.

Where it is used

Robotics, games (OpenAI Five) and RLHF for language models.

Watch out for

Sensitive to implementation details; still on-policy.

Related