What is a world model?
Introduction
Project introduction
What is a world model?
In reinforcement learning an agent acts in an environment, sees what happens, and collects rewards. A model-free agent learns which actions are good straight from that experience, by trial and error, and usually needs a very large number of tries.
A model-based agent first learns a world model, which is a network that predicts the next state and the reward from the current state and an action. It can then try out actions in imagination, which costs nothing in the real world, and pick the plan that the model predicts will earn the most.
Why plan in imagination?
In this project a rover learns its yard from 2,400 steps of random driving. Planning inside that model brings it to about 0.06 from the flag (planning with the real physics ends almost exactly on it). A simple model-free learner trained directly in the real yard needs about 40,000 steps to come close, and about 100,000 to do better. That ratio belongs to this small toy yard; the pattern, not the exact number, is what carries over.
The catch is that the model is only right where the data went. A planner searches for whatever the model predicts is best, so it is drawn to the model's mistakes. You will see the rover drive into a river the data never reached, and fix it with several models that warn you where they disagree.
Plan in imagination, act, repeat
real step 1Dashed lines are imagined plans. The blue one predicts the most reward, so the rover takes its first step, then imagines again.
What you will build
01
A world model
Training pairs from episodes, and how far imagined rollouts drift from reality.
02
Planners
Random shooting and the cross-entropy method, replanning after every real step.
03
Caution
An ensemble whose disagreement keeps the planner on ground the data covered.
Start with the training pairs
Turn recorded episodes into the inputs and targets a world model learns from.