Level 5 · research · ~50 h
Implement PPO from scratch with GAE
Implement Proximal Policy Optimization with generalized advantage estimation and a clipped surrogate objective from scratch, and reproduce learning curves on MuJoCo or Brax continuous-control tasks.
Prerequisites
Problem statement
- 01Implement Proximal Policy Optimization with generalized advantage estimation and a clipped surrogate objective from scratch, and reproduce learning curves on MuJoCo or Brax continuous-control tasks.
Real-world motivation
- 01PPO's clipping and GAE interact subtly; a from-scratch implementation forces you to get advantage normalization, value losses and minibatch epochs right.
Learning objectives
- 01Derive the clipped surrogate objective
- 02Implement GAE lambda
- 03Match reference performance on two environments
Technical architecture
- 01actor and critic networks with shared trunk
- 02vectorized rollout collection
- 03minibatch PPO epochs with clipping
Mathematical foundations
- 01$L^{CLIP}=\mathbb{E}_t[\min(r_t(\theta)\hat A_t,\mathrm{clip}(r_t,1-\epsilon,1+\epsilon)\hat A_t)]$
- 02$\hat A_t^{GAE}=\sum_{l=0}^{T-t-1}(\gamma\lambda)^l\delta_{t+l}$
Dataset and sources
- 01MuJoCo HalfCheetah-v4
- 02Brax Ant
- 03Hopper-v4 for a second task
Step-by-step tasks
- 01Implement vectorized environment rollouts
- 02Implement GAE and verify it reduces advantage variance
- 03Implement the clipped objective and value loss
- 04Add advantage normalization and gradient clipping
- 05Train three seeds per environment
- 06Ablate clip epsilon and lambda
Implementation requirements
- 01Use Gaussian policies with a learned log standard deviation
- 02Use separate optimizers for actor and critic
- 03Log KL divergence and clip fraction
Testing requirements
- 01Check GAE reduces to one-step TD at lambda=0
- 02Verify clipped objective never increases beyond the bound
- 03Confirm gradient norms stay finite
Evaluation metrics
- 01episode return
- 02KL divergence
- 03clip fraction
- 04explained variance
Expected outputs
- 01training code
- 02learning curves with seed bands
- 03ablation table
- 04derivation notes
Common failure modes
- 01advantage normalization applied per minibatch rather than per rollout
- 02value function dominates the objective
- 03clip epsilon too small freezes the policy
Stretch goals
- 01add a KL early-stopping criterion
- 02implement recurrent PPO
Research extensions
- 01study the bias-variance tradeoff of lambda
- 02analyze the relationship between clip fraction and performance
GitHub submission requirements
- 01Full implementation
- 02Three-seed curves for two environments
- 03Ablation results
- 04README with hyperparameters
Completion rubric
- 01GAE derivation and code correct
- 02clipped objective correct
- 03reference performance reached
- 04three seeds reported
- 05ablation performed
Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.