Model-Based Deep RL: World Models, Dreamer, and MuZero
A companion to the PETS lesson. PETS plans in the environment's native state space; these methods change what the model represents.
╌╌╌╌
This builds on Model-Based Deep RL: Sample Efficiency and PETS, which made the case that a good model turns experience into imagined planning, showed how a learned model's errors compound over a rollout, and built PETS — a probabilistic ensemble planned online with model-predictive control.
PETS still predicts full next states in the environment's native coordinates. That is the assumption the two methods here relax. The first learns a compact latent world and imagines inside it; the second predicts only the handful of quantities planning actually consumes. Both keep the same trade — cheap imagined computation for expensive real interaction — but change what the model has to get right.
Latent-space world models
PETS plans in the environment's native state space. That works when the state is a clean vector of joint angles, but not when it is a stream of images: a pixel-space dynamics model must reconstruct every future frame, spending its capacity predicting textures and shadows that are irrelevant to control. The alternative is to learn a latent state — a compact code that captures what matters for control — and do all the modeling and planning there.
World Models, Ha and Schmidhuber (2018), was the clean demonstration.1 It splits the agent into three parts. A vision model (V), a variational autoencoder, compresses each high-dimensional frame into a small latent . A memory model (M), a recurrent network with a mixture-density output (an MDN-RNN), models the dynamics in latent space: given and action it predicts a distribution over the next latent . A tiny controller (C) — a linear policy — maps the latent state and the RNN's hidden state to an action. Almost all the parameters live in V and M, which are trained unsupervised on collected rollouts; the controller is small enough to optimize with a black-box search.
The central result was that the controller can be trained entirely inside the model's dream. Once M has learned the latent dynamics, it is itself a simulated environment: sample a latent, feed it and an action to M, get the next latent and a predicted reward, repeat. Ha and Schmidhuber trained a car-racing and a VizDoom controller by evolution against M's hallucinated rollouts and then transferred the policy back to the real environment, where it performed well — learning to act without touching the environment during policy optimization at all. A temperature knob on M's sampling controlled how noisy the dream was, which mattered: too deterministic a dream let the controller exploit the model's flaws, the same failure PETS guards against with ensembles.
The Dreamer line
World Models optimized a fixed learned model, then a controller, in separate phases. The Dreamer line, Hafner et al. (2020–2023), made the whole thing one end-to-end, continually-improving loop and turned it into a top general agent.2 The core is a recurrent state-space model (RSSM) that learns a latent MDP: a latent state combining a deterministic recurrent part and a stochastic part, with heads that predict, from the latent, the next latent, the reward, the discount (episode continuation), and, for training the representation, a reconstruction of the observation.
What makes Dreamer more than a bigger World Model is how the policy is learned. The agent learns an actor and critic purely from imagined latent trajectories. From latent states drawn from real experience it rolls the learned model forward a short horizon , entirely in latent space, producing imagined states, actions, and predicted rewards . The critic regresses onto a -return over the imagined rollout, bootstrapped past the horizon by its own value,
and the actor maximizes the imagined return . Because the entire imagined rollout is differentiable through the learned model, the actor is trained by backpropagating value gradients straight through the dynamics — a signal no model-free method has access to.
- 1initialize world model, actor , critic , replay buffer
- 2repeat
- 3// model learning
- 4sample a sequence batch from
- 5update the RSSM to predict next latent, reward, discount, and reconstruct observations
- 6// behavior learning, entirely in latent imagination
- 7for each latent from the batch do
- 8imagine a rollout for
- 9compute -returns over the imagined rollouts
- 10update critic to regress ; update actor to maximize
- 11// data collection
- 12act with in the real environment; add transitions to
- 13until converged
Successive versions sharpened it. DreamerV2 discretized the stochastic latent into categorical variables and was the first world-model agent to reach human-level on the Atari 200M benchmark. DreamerV3 fixed a single set of hyperparameters and, without tuning, learned across more than 150 tasks spanning continuous and discrete control, proprioception and pixels — and collected diamonds in Minecraft from scratch, a long-horizon exploration task that had resisted every prior method. The idea is constant: learn a latent world, then do almost all the learning by imagining inside it, spending real interaction only to keep the model accurate.
MuZero: planning with a learned latent model
AlphaZero reached superhuman play in
Go, chess, and shogi by combining MCTS with a learned policy-and-value network — but
it planned with the real game rules, a perfect simulator handed to it. That is
exactly the assumption the tabular chapter's MCTS made, and it fails the moment the
rules are unknown or the rules
are the physics of an Atari game. MuZero,
Schrittwieser et al. (2020), removes it: it learns a model and plans with MCTS
against that learned model, matching AlphaZero in board games and DQN-class methods
in Atari, all with no given rules.3
MuZero's decisive idea is what its model predicts. A pixel-accurate model like World Models reconstructs future observations; MuZero does not — it never predicts an observation at all. Its learned model predicts only the three quantities that MCTS actually consumes: the reward, the value, and the policy. This is the payoff of the compounding-error discussion taken to its conclusion: if planning only ever reads reward, value, and policy off the model, then the model only needs to get those right, and the enormous burden of predicting irrelevant visual detail disappears.
Three learned functions do the work, all operating on an abstract latent state with no required meaning beyond being useful for planning.
Inside MCTS these functions replace the game rules. The representation function turns the current observation into the root latent state. Then the search expands the tree entirely in latent space: to expand a node, the dynamics function produces the child's latent state and the reward on that edge, and the prediction function supplies a value to back up and a policy prior to bias which children to explore. The tree search is the same selection–expansion–backup loop as AlphaZero's; only the transitions and evaluations now come from learned functions instead of a simulator.
Training ties the three functions together through the search. The network is unrolled steps from a real state, applying to the actions the agent actually took, and at each unrolled step three losses are summed: the predicted policy matches the MCTS-improved policy (as in AlphaZero, the search is a policy-improvement operator), the predicted value matches the observed -step return or game outcome , and the predicted reward matches the real reward ,
There is no reconstruction loss — the latent states are shaped only by these three prediction targets, so the model learns whatever internal representation makes reward, value, and policy predictable, and nothing more.
The result placed MuZero as the natural successor to AlphaZero. It matched AlphaZero's superhuman strength in Go, chess, and shogi without being told the rules, and on the Atari benchmark it set a new state of the art among methods of its class, learning to play from pixels with the same learned-model-plus-MCTS architecture. It is the tabular chapter's closing promise made good at scale: MCTS gives the deep, focused lookahead; the learned representation, dynamics, and prediction functions supply the model MCTS needs — a model that predicts only what planning reads, and so has nothing to get wrong except the things that matter.
Beyond the three: short rollouts, latent planning, and sample-efficient MuZero
PETS, Dreamer, and MuZero mark out the design space along two axes — what the model represents, and how planning consumes it:
| Method | Model represents | Planning | Trust mechanism |
|---|---|---|---|
| PETS | full next state (native coords) | online MPC, replan each step | probabilistic ensemble |
| Dreamer | compact latent state | actor-critic on imagined rollouts | short horizon , reconstruction |
| MuZero | reward, value, policy only | MCTS over learned model | no reconstruction; three prediction targets |
The work after them mostly finds better points inside this space; three lines are worth naming because they became defaults.
MBPO: short model rollouts inside a model-free learner. The compounding-error
arithmetic above says long imagined rollouts are untrustworthy — so MBPO (Janner
et al., 2019) uses very short ones and lets a model-free learner do the rest.4 It
trains an ensemble model as in PETS, but instead of planning with MPC it generates
short (often single-step) imagined transitions branched from real states in the
replay buffer and feeds them, alongside real data, to an off-policy SAC. Branching
from real states keeps every imagined transition close to the data the model was fit
on, so never has room to blow up, while the imagined transitions still
multiply the effective sample count. Janner et al. gave a monotonic-improvement
analysis bounding the model-induced error by the rollout length, formalizing the
keep short
instinct, and MBPO matched or beat PETS and SAC on the MuJoCo
benchmarks. It is the clean hybrid: model-based sample efficiency, model-free
robustness, with the model trusted only one step at a time.
- 1initialize policy , model ensemble , env buffer , model buffer
- 2repeat
- 3take an action with in the real environment; add the transition to
- 4fit the ensemble on
- 5for several branch rollouts do
- 6sample a start state from
- 7roll forward steps under ( small); add imagined transitions to
- 8update with SAC on batches drawn from
- 9until converged
TD-MPC: plan in a latent value model. TD-MPC (Hansen et al., 2022) fuses the PETS and Dreamer ideas.5 It learns a latent dynamics model like Dreamer, but rather than reconstruct observations it trains the latent purely from a value signal (a TD loss on a learned latent Q), the MuZero move of predicting only what planning reads. At decision time it plans with MPPI (a CEM relative) over short latent rollouts, and it bootstraps the finite-horizon plan with the learned value at the end — so a short plan sees past its own horizon through the value function. That combination — learned latent value model, short latent planning, value bootstrap — set strong sample-efficiency results on continuous control and carried directly to real robots. It reads as the natural join of this lesson's three lines: a latent world model (Dreamer), planned online by MPC (PETS), with a learned value that predicts what matters (MuZero).
EfficientZero: MuZero made sample-efficient. MuZero's headline results used enormous amounts of data. EfficientZero (Ye et al., 2021) added three targeted fixes — a self-supervised consistency loss tying the latent dynamics to the encoder's own next-state features, a learned prediction of the sum of rewards over the search horizon, and a correction for off-policy staleness in the value target — and reached human-level median performance on the Atari 100k benchmark, i.e. after only about two hours of gameplay.6 It was the first time a MuZero-style learned-model planner was competitive in the extreme low-data regime, closing much of the gap between model-based planning and the sample budgets real applications allow.
The one idea
Strip the three systems to their common shape and they answer one question three ways: what must a learned model predict for planning to be worth it? PETS predicts full next states but distrusts itself through an ensemble and replans every step, so error never accumulates. World Models and Dreamer predict a compact latent state and do their learning inside it, imagining thousands of trajectories per real one. MuZero predicts neither states nor pixels but only reward, value, and policy — the minimal quantities MCTS reads — and plans against those. Across all three the same sentence holds: a good model turns experience into imagined planning, and the work is in building a model that is trustworthy exactly where planning queries it.
Footnotes
- Ha & Schmidhuber (2018),
World Models,
NeurIPS (and arXiv:1803.10122). The V (variational autoencoder), M (mixture-density recurrent network modeling latent dynamics), and C (small linear controller) decomposition; the controller trained by evolution inside M'sdream
and transferred to the real car-racing and VizDoom environments, with a sampling-temperature control on the dream. ↩ - Hafner, Lillicrap, Ba, Norouzi (2020),
Dream to Control: Learning Behaviors by Latent Imagination,
ICLR (Dreamer); Hafner et al. (2021),Mastering Atari with Discrete World Models,
ICLR (DreamerV2); Hafner, Pasukonis, Ba, Lillicrap (2023),Mastering Diverse Domains through World Models,
arXiv:2301.04104 (DreamerV3). A recurrent state-space model learns a latent MDP; actor and critic are learned purely from imagined latent rollouts, with value gradients backpropagated through the differentiable dynamics. DreamerV3 with fixed hyperparameters spans 150+ tasks and collects diamonds in Minecraft from scratch. ↩ - Schrittwieser, Antonoglou, Hubert, Simonyan, Sifre, Schmitt, Guez, Lockhart, Hassabis, Graepel, Lillicrap, Silver (2020),
Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model,
Nature 588. MuZero's representation (), dynamics (), and prediction () functions operate on abstract latent states with no reconstruction loss; MCTS plans over the learned model, and training matches the reward, value, and MCTS-improved policy at each unrolled step; matched AlphaZero in Go/chess/shogi without given rules and set a new state of the art on Atari. ↩ - Janner, Fu, Zhang, Levine (2019),
When to Trust Your Model: Model-Based Policy Optimization,
NeurIPS. MBPO: an ensemble dynamics model generates short (often one-step) rollouts branched from real replay states, fed with real data to an off-policy SAC; a monotonic-improvement bound ties the model error to the rollout length, and the method matches or exceeds PETS and SAC on MuJoCo. ↩ - Hansen, Wang, Su (2022),
Temporal Difference Learning for Model Predictive Control,
ICML. TD-MPC: a latent dynamics model trained from a TD/value loss (no observation reconstruction), planned online with MPPI over short latent rollouts and bootstrapped by a learned terminal value; strong sample efficiency on continuous control and transfer to real robots. ↩ - Ye, Liu, Kurutach, Abbeel, Gao (2021),
Mastering Atari Games with Limited Data,
NeurIPS. EfficientZero: MuZero plus a self-supervised latent-consistency loss, a predicted value-prefix (reward-sum) head, and an off-policy value correction, reaching human-level median performance on the Atari 100k (two-hour) benchmark. ↩
╌╌ END ╌╌