Lesson 67
Proximal Policy Optimization
Update a policy in small, clipped steps so a new policy cannot move far from the one that collected the data. One example is on this page.
Intermediate12 min
What You Will Learn
- Idea
- Example
- When to use it
Idea
PPO looks at the probability ratio between the new policy and the policy that gathered the batch. If that ratio leaves a clip range, the objective uses the clipped ratio instead. A large lucky step cannot dominate the update. Several epochs can reuse the same batch inside that fence.
Example
ratio = 1.5
advantage = 1.0
low, high = 0.8, 1.2
clipped = min(max(ratio, low), high)
objective = min(ratio * advantage, clipped * advantage)
print(f"clipped ratio: {clipped:.1f}")
print(f"objective: {objective:.1f}")Output:
clipped ratio: 1.2
objective: 1.2When to use it
- Use it as the default actor-critic when you want a stable policy update.
- Here the raw ratio is 1.5 and the clip ceiling is 1.2, so the objective stays at 1.2.
- The clip range is usually 0.8 to 1.2, written as 1 minus and plus 0.2.
Loading playground…