All lessons in World Models: Learn, Generate, Plan, and Evaluate
Define the World-Model Task
Specify actions, observations, the decision and evidence for a useful model.
30 minutes · Free lesson
What you will learn
- Specify a decision that requires predicting the consequences of actions.
- Distinguish a learned dynamics model from its environment and controller.
- State measurable completion criteria for a bounded world-model project.
A cart is approaching a target. You can push left, coast, or push right. You know its recent measurements, but you do not know exactly how friction and actuation affect its next movement. Before sending a command, you want to compare what could happen under several choices. That is the decision this course makes testable.
The project uses a synthetic cart, not physical equipment. You collect experience, fit a transition model, use that fit to choose actions, and measure the consequences in a reference environment. You need basic Python, vectors, probability and supervised fitting. Required work runs on a CPU with Python 3.10 or later and no external packages.
Define the thing being modeled
Our first model predicts the next position and velocity from the current state and chosen push. A photograph generator could instead predict a future image. A search model could predict rewards and values in an internal representation. These are different contracts. A realistic image is evidence about appearance; it does not by itself establish that changing an action causes the right consequence.
Specify the observation, action, time interval and output before choosing a model family. For the cart, one step is 0.25 seconds and available actions are -1, 0 and 1. Position and velocity are measured initially. Later lessons remove information to expose partial observability.
Keep the environment, model and controller separate
The environment produces the next actual state after an executed action. The fitted model predicts candidate next states without moving the cart. The controller uses predictions to select an action. Logging distinguishes imagined transitions from environment transitions so simulated experience cannot silently count as real interaction.
The workbook makes this boundary visible. The reference function is used for collection and executed actions. The planner receives fitted coefficients and calls the prediction function. It must not call the reference environment while deciding what to do. Otherwise the experiment would demonstrate planning with a known simulator, not planning with learned dynamics.
The early World Models project provides a useful example of separating representation, recurrent prediction and control. This course uses a smaller system whose errors you can inspect directly; success on the cart does not establish general intelligence or physical transfer.
Worked example
Define a useful completion claim
- A synthetic episode lasts 40 steps, or 10 seconds. The controller receives one observation at the beginning of each step.
- The objective penalizes position error, excessive velocity and action effort. Report its total over all 40 executed transitions.
- Also count steps outside the position boundary of plus or minus 3. A lower cost must not conceal more boundary violations.
- Compare the learned-model controller with both coasting and a fixed feedback controller on the same initial states and noise seeds.
- The defensible claim is a measured improvement or diagnosed failure under those conditions, not that the model has learned all possible worlds.
Set up the workbook and its evidence
Download the workbook, extract it, and open a terminal in world-models-labs. All subsequent commands assume that directory. Run python3 --version, then python3 -m unittest discover -s tests -v. The tests check data isolation, learned action effects, prediction error, planner independence and several intentional counterexamples.
Create experience with python3 worlds.py collect --out .work/transitions.json. The default collection contains 60 episodes of 40 steps, or 2,400 transitions. The command creates .work automatically. It is synthetic data generated for learning, not a public benchmark result.
Keep four forms of evidence: the collection settings, fitted model, prediction diagnostics and control report. Each answers a different question. The capstone requires all four plus an explanation of a failure. Optional programmes add separate cumulative investigations; none is necessary for completing this core project.
Choose a programme for a different outcome
The original programmes investigate latent imagination, learned search and embodied video. Predictive Representations adds energies, learning without collapse, associative memory and temporal hierarchy. Model Architectures compares token simulation, diffusion, continuous latent planning and multimodal systems. Data and Evaluation builds a robot-data contract, a benchmark protocol and a transfer audit.
Creative Video Production is available after this orientation. It develops an original eight-second reading-lamp story through shot direction, references, continuity, editing, sound and delivery. Its required project is an offline production dossier; paid video generation is optional. The mathematical and planning workbook needs only Python, while its optional media-export fixture requires FFmpeg. Completing that creative programme demonstrates a different outcome from completing the control project.
Exercise
A model generates convincing videos but accepts no action input. Can you conclude that it will predict what happens when this cart receives a left push?
Check your answer
No. Establish an action-conditioned interface, align the push with the predicted transition, and evaluate the effect against recorded interventions. Visual plausibility alone does not test the required action consequence.
Exercise
The planner calls the true reference transition function to evaluate every candidate. What capability has it demonstrated, and what must change for this course project?
Check your answer
It has demonstrated planning with an available reference simulator. Replace those planning calls with a model fitted from recorded training transitions. Retain reference calls only for collecting experience and executing or evaluating selected actions.
Summary
Start with the decision, information, action boundary and measurable outcome. Keep the learned predictor separate from the environment, and evaluate the controller through realized consequences.
Next action
Write an exact time-indexed contract for states, observations and actions before collecting more experience.