Deep RL V: Model-Based RL and World Models
A learned dynamics model can improve data efficiency or create a new surface for exploitation. This stage connects prediction error to decisions, varies planning horizon and uncertainty, and requires a model-free baseline before complexity is justified.
Section 7 of 12 · 11 units · about 45 hours
By the end you can Build a small learned-dynamics controller that passes a known-model oracle, induce compounding error or model exploitation, and defend whether it beats a simpler model-free or controller baseline under matched real samples and compute.
Units
- Known versus learned models, system identification and data collection4h
- One-step and multi-step prediction, open-loop rollout and Model Predictive Control5h
- Random shooting and cross-entropy planning against a known-dynamics oracle4h
- Dyna-style imagined experience and imagined versus real accounting4h
- Model ensembles, epistemic and aleatoric uncertainty and pessimistic planning5h
- Compounding error, decision-relevant error and model exploitation4h
- Policy-induced shift, data aggregation and fallback replanning4h
- Model-Based Policy Optimization and the rollout-horizon trade-off4h
- Latent-state dynamics and world-model policy learning4h
- Monte Carlo Tree Search3h
- Planner, model, reward and policy error attribution with matched model-free baselines4h
Build it
Mini project · about 10 to 14 hours
Learned dynamics with honest planning attribution
Extend policylab with an mbrl/ laboratory: fitted dynamics, ensembles, short-horizon rollouts and search planners over small systems. Prove the planner on a known-dynamics oracle before trusting any learned model. Attribute every win to model, planner or budget with matched model-free controls.
- 1Prove the planner first on a known-dynamics sanity case in
mbrl/: one-step prediction tests, open-loop against closed-loop replanning, random shooting versus CEM on equal model queries, and a simple-controller baseline as the ceiling. - 2Fit an ensemble of probabilistic dynamics models, check member disagreement away from data, derive the Gaussian loss it minimizes, and show one induced exploitation plan that scores well imagined but fails in the system, then contain it with an uncertainty penalty.
- 3Run a data-aggregation loop that collects real transitions under the new policy and refits, showing error falling on the new distribution, and fix a fallback rule that shortens the horizon or hands back control past an uncertainty threshold.
- 4Implement branched rollouts that start from real buffer states and run short model steps under the current policy with imagined and real updates accounted apart, then sweep the horizon and keep the point where model bias reverses the gain beside a matched model-free control.
- 5Add latent-dynamics prediction tests on an encoded state at small scale, then implement tree search with its four steps and state the simulation budget behind every per-move decision.
- 6Attribute results with swap experiments that isolate planner, model, reward and policy error, and run the matched model-free baseline with per-run records and failures kept, stating the operating range where the model earns its keep.
What you hand in
mbrl/dynamics, ensembles and planners with oracle-first prediction and planning tests.- Horizon sweeps with the bias-reversal point, aggregation evidence and latent prediction tests.
- Attribution table with matched model-free controls and per-run records including failures.
How to check it
- Self-grade with the rubric below
How it's graded
Oracle-first planning
Pass: Shooting and CEM match hand rollouts on the sanity case with equal queries, and the simple controller sets the ceiling.
Great: A planning-below-oracle result is diagnosed as a planner fault, never charged to the model.
Uncertainty honesty
Pass: Ensemble disagreement grows away from data, and the exploitation plan shows an imagined-versus-real gap across seeds.
Great: The penalty contains the exploit on a rerun, with member diversity evidence ruling out single-seed agreement.
Horizon discipline
Pass: Branched rollouts carry their branch starts, the sweep keeps the reversal point, and imagined updates never count as samples.
Great: Aggregation lowers new-distribution error on refit, and the fallback rule fires on a demonstrated uncertain state.
Fair attribution
Pass: Swap experiments isolate each error source, and the matched baseline shares steps, compute, seeds and versions.
Great: Failed horizons stay in the report, and the operating range names where the model stops earning its keep.
Resources
- Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Model-Based RLUC Berkeley
Slides are public at https://rail.eecs.berkeley.edu/deeprlcourse/static/slides/lec-N.pdf; current videos are not, and the public Fall 2023 playlist numbers lectures differently. Study Lectures 15 and 16 (model-based RL: learned dynamics, open-loop and closed-loop planning, random shooting and CEM, MPC, model-based policy learning). There is no model-based homework, so build the planner yourself on a small environment with known dynamics first.
- Reinforcement Learning: An Introduction (2nd ed.) - Chapter 8Richard Sutton and Andrew Barto
The authors post the full second edition free at incompleteideas.net; cite the printed page numbers. Study Sections 8.1 to 8.3 (models, Dyna-Q, when the model is wrong) and Sections 8.8 to 8.11 (decision-time planning, rollout algorithms and Monte Carlo Tree Search). Reproduce the Dyna-Q versus Dyna-Q+ ranking on the blocking or shortcut maze.
- When to Trust Your Model: Model-Based Policy OptimizationJanner et al.
Study the model-error analysis and short model-rollout design. Reproduce a reduced real-plus-imagined-data comparison and retain the horizon where model bias reverses the gain.
- Stanford CS224R Spring 2026 - Model-Based RLStanford University
Use Lecture 11 (model-based RL) and its MBPO reading as a second treatment of model error, uncertainty and short model rollouts.
- Deep Reinforcement Learning in a Handful of Trials using Probabilistic Dynamics Models (PETS)Chua et al. (NeurIPS 2018)
Read the split between aleatoric uncertainty (probabilistic networks) and epistemic uncertainty (ensembles) and the trajectory-sampling planner. Implement an ensemble on a small task and show where the members disagree.
- Hands-on Modern RL - Model-Based and World-Model SectionsWalking Labs
Use Sections 9.3 and 9.4 as concept maps for model-based RL, search and world models. No runnable dynamics or planner script exists, so reproduce its error-recursion numbers by hand and verify algorithm claims against the original papers. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its
code/chapterNNfolders do not follow the site chapter numbers. - Reinforcement Learning Control Laboratory - Model-Based StretchRoadmap-Final
Add a learned-dynamics stretch with a known-dynamics sanity case, prediction and planning tests, horizon sweeps, model-exploitation failure and matched model-free comparison.
- Mastering Diverse Domains through World ModelsDeepMind
Read DreamerV3 only after the small explicit dynamics and planning path passes. Trace representation, latent dynamics, imagination and actor-critic state, but do not make a large benchmark reproduction part of the exit gate.