Project P09
Continuous control agent with PPO and SAC in MuJoCo
How do you build a reinforcement learning agent from scratch that learns to walk in a physics simulator, and how do you tell a genuine improvement from variation across seeds?
- stages
- 8
- duration
- 14 h
- concepts
- 20
- available in English
- 8 / 8
- completed by you
0 of 8
Where it fits
Overview
Build deep reinforcement learning agents for continuous control with MuJoCo and Gymnasium on your own machine. Start with a multi-seed evaluation protocol and confidence intervals. Implement REINFORCE with a baseline, actor–critic with GAE, PPO with its implementation details, and off-policy SAC. Diagnose PPO, use ablations to measure which details matter, build a custom MuJoCo environment with domain randomization, and analyze the behavior and robustness of the learned policies.
Why it matters
Continuous-control RL underlies robot control, and PPO is also used for RLHF in language models. Implementing PPO from scratch and reproducing reference results with a sound evaluation protocol reveals how implementation details and variation across seeds affect performance. The custom environment prepares you for the robot imitation and AlphaZero projects.
Stages 8
- 01MuJoCo environments and evaluation protocolInstall MuJoCo and Gymnasium, study Hopper, HalfCheetah, Walker2d and Ant, and build the project evaluation protocol with separate deterministic episodes, multiple seeds, IQM and stratified bootstrap intervals; measure random and zero-policy baselines.
- 02REINFORCE with baseline for continuous actionsImplement a Gaussian policy with network-produced mean and learned log deviation, and REINFORCE with discounted returns and a baseline; solve InvertedPendulum and measure the baseline’s effect on gradient variance.
- 03Actor-critic and GAEAdd a critic that learns the value function and compute GAE while handling terminations and truncations; measure lambda’s bias-variance tradeoff and assess critic quality by explained variance on Hopper.
- 04PPO from scratch with all its detailsImplement readable single-file PPO with vectorized environments, clipped updates and implementation details, then compare its measured performance with a local reference under the same budget.
- 05Debugging PPO and measuring which details matterInstrument PPO diagnostics, investigate deliberately induced failures, and measure implementation details with a multi-seed ablation informed by published studies.
- 06SAC: off-policy maximum entropy learningImplement Soft Actor-Critic with replay, twin critics and soft targets, a tanh-squashed Gaussian and automatic temperature, then compare SAC and PPO in environment steps and wall time.
- 07A custom MuJoCo environment with domain randomizationDesign a custom robotic-arm pushing environment in MJCF from an open model, with sensors, actuators and a Gymnasium class; use potential-based reward shaping and domain randomization, then train with PPO or SAC and evaluate robust success.
- 08Behavior, robustness and reward hackingAnalyze learned locomotion, joint use and sensitivity to pushes, observation noise and physical changes; investigate reward hacking and produce a reproducible report with curves, intervals and videos.
Final deliverable
Build and document a continuous-control RL library
Package your PPO and SAC implementations with tests and your custom manipulation environment. Write a reproducible report with IQM curves, ablations, robustness results, and videos of the policies.
Check what you already know
- Distinguish termination from truncation and handle value bootstrapping correctly in each case
- Implement a Gaussian policy and REINFORCE with a baseline
- Implement GAE and explain the bias–variance trade-off controlled by lambda
- Implement PPO with observation and advantage normalization and the other practical implementation details
- Correct the log-probability of a tanh-squashed Gaussian in SAC
- Report reinforcement learning results with IQM and stratified bootstrap intervals