Project 11: PPO on a manipulation task

Level 13 (after Lessons 13.2 and 13.3) · Time 3 to 5 hours, mostly waiting · Difficulty 3 of 5

Objective

Train PPO on the reach task and report the result the way a paper should: five training seeds, each evaluated deterministically on 100 initial states that training never used, summarized as an interquartile mean with a bootstrap interval. Add one ablation with exactly the same budget, and say what it changed. The algorithm can be the course’s (mjcourse.rl.ppo) or your own; the experiment is what this project grades.

Prerequisites

Starter code

The tests train all ten runs in parallel processes: about 45 s on 48 cores.

Expected behaviour

The reference trains the course’s PPO (16 environments, 128 steps each per iteration, so 100 000 steps become 48 iterations and 98 304 steps). It ablates PPO’s central mechanism, the clipping, by raising the clip range from 0.2 to 10. That leaves ten epochs of unconstrained updates on each batch.

Measure Main (clip 0.2) Ablation (clip 10) Main − ablation, by seed
held-out success, per seed 1.00, 1.00, 1.00, 1.00, 1.00 0.93, 1.00, 0.74, 0.91, 0.96  
success, IQM [95% interval] 1.000 [1.000, 1.000] 0.933 [0.797, 0.987] +0.092 [+0.028, +0.182] (mean)
steps per episode, IQM 8.53 [8.38, 8.83] 14.3 [9.7, 31.5] −9.6 [−20.3, −2.6] (mean)
final distance (m), mean 0.015 0.019 −0.004 [−0.007, −0.001]

On seed 0, the ablation’s KL divergence between successive policies was 0.27 per iteration in the last iteration, against 0.011 with clipping.

Read the table with three things in mind:

Tests

MJC_IMPL=starter pytest projects/p11_ppo_reach
pytest projects/p11_ppo_reach

Five tests:

python tools/mutate_project.py p11_ppo_reach checks the three mutants in mutants.json (about 3 minutes).

Common failures

Extension challenges

  1. Measure where the time goes: simulation in the environment workers against learning in the main process, at 4, 16 and 32 environments.
  2. Halve the budget until the main run’s success no longer saturates, and repeat the comparison on success alone.
  3. Replace the percentile bootstrap with a stratified bootstrap over seeds and states, and compare the interval widths.

Solution

solution.py, about 10 lines: the experiment, not the algorithm, is the work.