Skip to content
BIASED

Model-based reinforcement learning

Dyna, MPC/CEM, compounding model error, Dreamer, MuZero, and world models for LM agents.

Why a model

Optional depth: the rest of the course only needs the idea of a world model. Model-free methods (Q-learning, DQN, PPO) never ask what an untaken action would do. That is general and expensive — tens of millions of frames per Atari game. A model keeps transition structure, turns computation into extra experience, and can serve a new reward in the same world.

Dyna

Key idea. Learning and planning are the same update on different data. Dyna after each real step: one direct RL update, a model update, then nn planning updates that replay remembered transitions. In the 6×96\times 9 maze the first episode is long for everyone (~800 steps) until the goal is found; with n=50n=50 the agent then walks about 1717 steps from episode five, versus dozens of episodes without planning. A stale model can miss a newly opened shortcut (blocking maze).

MPC and CEM

In continuous control fit st+1≈fψ(st,at)s_{t+1}\approx f_\psi(s_t,a_t) by regression, then MPC: optimize an action sequence under the model (random shooting or CEM), execute the first action, replan from the real next state. On the pendulum, CEM with a feature model nearly matches planning with the true dynamics (return ≈−364\approx -364 vs −359-359); a plain linear model fails to swing up (−1513-1513). PETS adds ensembles so plans respect uncertainty and need far fewer samples than PPO on some tasks.

Compounding error

One-step error ϵ\epsilon with Lipschitz LL yields

eH≤ϵ LH−1L−1.e_H\le\epsilon\,\frac{L^H-1}{L-1}.

When L>1L>1 the bound grows geometrically. The linear pendulum model is off by 0.0180.018 rad in one step but 0.950.95 after ten — more than five times 10×0.01810\times 0.018. Remedies: short horizons and replanning, rollouts branched from real states (MBPO), ensembles, and not letting the planner exploit the model.

Dreamer and MuZero

World models learn latent dynamics instead of pixels. Dreamer trains actor and critic on imagined latent rollouts (H=15H=15) with λ\lambda-returns; DreamerV3 used one setup across 150+150+ tasks including diamonds in Minecraft from scratch. MuZero predicts only rewards, values and policies for tree search — value equivalence, not screen reconstruction — and matched AlphaZero without being given the rules.

World models and LMs

For LM agents, irreversible actions and costly steps make one- or two-step lookahead before acting natural — with the same compounding-error caveat. Learned simulators train agents offline; the sim-to-real gap is model error by another name. Next on the main line: treat the language model itself as the policy — tokens as actions, the prompt as state.

Check your understanding

The same questions as in Pulse. Answers are shared between modes.

Full notes

Answers are saved on the server and tied to this browser until you sign in.