Unit 8 of 11 · about 4 hours · derive, implement

Model-Based Policy Optimization and the rollout-horizon trade-off

MBPO is the disciplined form of imagined data: short rollouts from real states, so the model is only asked for what it can answer.

You'll be able to

  • Derive the branched-rollout bound's trade-off between a term decaying in and one growing in , and explain why only the measured model error under the new policy makes a nonzero optimal.
  • Implement MBPO-style branched rollouts: sample a real state from the buffer, roll model steps under the current policy, store the transitions.
  • Sweep the rollout horizon and retain the value where model bias reverses the gain, with a matched model-free control.

Covers

Rollout horizon and model-bias trade-offsModel-Based Policy Optimization
1

Read

In this order, only the parts listed

0 of 3 done

  1. MBPO: bound, algorithm and horizon evidenceWhen to Trust Your Model: Model-Based Policy Optimization

    arXiv:1906.08253v3, Section 4.1 (Theorem 4.1, monotonic improvement with model bias), Section 4.2 (Theorem 4.2, branched rollouts), Section 4.3 with Figure 1 and Theorem 4.3 (model error under the updated policy), Section 5 with Algorithm 2 (ensemble, SAC, k-step rollouts from buffer states), Section 6.2 with Figure 3 (Hopper schedule, single-step baseline, no-model control)

  2. Lecture 11: Model-Based RL, MBPO slidesStanford CS224R Spring 2026 - Model-Based RL

    Slides 11 to 18: the Dyna-to-MBPO algorithm, distribution mismatch, partial rollouts from all data states, ensemble error averaging

  3. Lecture 16: Model-Based RL Part 2, short-rollout slidesBerkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Model-Based RL

    Part 2 (Policy learning with models: the curse of long rollouts, short rollouts from real states, MBA, MVE and MBPO)

2

Focus on

  • A branched rollout starts from a real buffer state and runs model steps. Short keeps every query near data; the buffer (not the model) supplies coverage of later task stages.
  • Theorem 4.2 bounds true return by branched return minus a term that decays exponentially in and one that grows linearly in . Taken literally its constants put the best at 0, no model at all. Section 4.3 measures that model error grows slowly with policy shift, and Theorem 4.3, written with that error, has its optimum at when the error is low enough.
  • The paper's numbers are the paper's results: Hopper's best schedule rises from to 15, fixed keeps most of the gain, 200-step rollouts underperform, 500-step rollouts fail, and Ant at 300k steps matches SAC at 3M. Reproduce the design on your task, not these returns.
Common mistakes · 3
  • Branching from the initial-state distribution. That re-entangles model horizon with task horizon and reintroduces the compounding the method was built to avoid.
  • Raising gradient updates per sample without model data. Figure 3 runs that control (G): it learns slightly faster but never matches MBPO, so the model (not the update count) earns the gain.
  • Tuning on test return and reporting the best. Sweep on a fixed protocol, keep the full curve including the value where bias reverses the gain, and report spread across seeds.
3

Try it yourself

Closed-book, before checking anything

Closed-book, state Algorithm 2 lines 6 to 8 in your own words (sample from the environment dataset, perform a model rollout of steps under the current policy, add the transitions to the model dataset), then implement that sampler against a scripted buffer and verify every stored transition carries its branch-start state.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why do branched rollouts see all task stages despite being short?Answer

    Branch starts are sampled from every stage of real trajectories in the buffer. Each rollout is short, but the set of starts covers the task.

  2. 2.Does Theorem 4.2 by itself argue for a short but nonzero ?Answer

    No. It has one term decaying exponentially in and one growing linearly, but with its constants the bound is maximized at . The case for short nonzero rollouts is Theorem 4.3, which replaces the pessimistic model error with the measured error under the new policy (Figure 1).

  3. 3.What does the no-model (G) control in Figure 3 rule out?Answer

    That MBPO wins merely by taking more gradient steps per environment sample. SAC with the same high update ratio improves slightly but does not match MBPO.

  4. 4.Why is SAC swappable inside Algorithm 2?Answer

    The policy optimizer trains on the mixed real-plus-model dataset. Any off-policy method that consumes that dataset fits the same slot.

You're done when

You can implement the branched sampler from memory and defend a horizon choice with a full sweep curve, not a best point.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 5 more in the section
  • Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Model-Based RLUC Berkeley · primary

    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.

  • Stanford CS224R Spring 2026 - Model-Based RLStanford University · support

    Use Lecture 11 (model-based RL) and its MBPO reading as a second treatment of model error, uncertainty and short model rollouts.

  • When to Trust Your Model: Model-Based Policy OptimizationJanner et al. · required

    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.

Also in this section

  • Reinforcement Learning: An Introduction (2nd ed.) - Chapter 8Richard Sutton and Andrew Barto · required

    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.

  • Deep Reinforcement Learning in a Handful of Trials using Probabilistic Dynamics Models (PETS)Chua et al. (NeurIPS 2018) · support

    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.

  • Mastering Diverse Domains through World ModelsDeepMind · depth

    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.

  • Hands-on Modern RL - Model-Based and World-Model SectionsWalking Labs · support

    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/chapterNN folders do not follow the site chapter numbers.

  • Reinforcement Learning Control Laboratory - Model-Based StretchRoadmap-Final · support

    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.