Skip to content

World models: imagine, then act

A world model learns how observations change, then plans or trains inside its own predictions: Dreamer imagines rollouts, Genie infers actions from video, V-JEPA 2 plans to a goal, Cosmos is a platform.

Advanced ~16 min11 steps

What runs in CodeSplash

You will be able to

  • Describe a recurrent state-space world model and training a policy in imagined rollouts
  • Explain why imagined returns can mislead and how to measure real performance
  • Describe latent actions learned from unlabeled video and what they need not mean
  • Describe planning toward a latent goal with candidate action sequences
  • Compare any learned future against a constant-velocity baseline

Read first

01

Learn the dynamics, then use them

Read

A world modelWorld modelA learned model of how the environment responds to actions, used to plan or to imagine training data. predicts how observations, often video frames, change, usually in response to actions. Once trained, it can be used instead of the real world: to imagine what an action would do, to plan, or to train a policy without costly real interaction.

This is where video models meet reinforcement learning. Actions and rewards make it different from passive video prediction: the question isn't "what comes next?" but "what comes next if I do this?".

02

Dreamer: train the policy in imagination

Read
Reference · VID062 · Explained hereDreamerLearns a latent dynamics model from agent experience and improves behavior by imagining trajectories in that model.

Dreamer learns a recurrent state-space modelRecurrent state-space modelA world model whose state has a recurrent part and a random part; rollouts in this state train the policy without the real world.: a recurrent state hth_t plus a random state sts_t, trained to rebuild observations and predict rewards, with a KLKullback–Leibler divergenceHow many extra nats it costs to describe draws from one distribution with a code built for another; 0 when they match. term keeping the predicted state close to the one inferred from real observations:

L=Lobs+Lreward+β DKL(q(st∣ht,ot) ∥ p(st∣ht)).L = L_{\text{obs}} + L_{\text{reward}} + \beta\, D_{\mathrm{KL}}\big(q(s_t \mid h_t, o_t)\,\Vert\, p(s_t \mid h_t)\big).

Actor and value networks then learn from imagined rollouts. In the reference's toy, three imagined steps earn rewards −1.0, −0.1 and −1.29, a discounted return of −2.259.

DExplorable · Gridworld: Q-learning, policy gradients and PPO

How do value-based and policy-gradient learners find a good route, and what makes them fail?

Learner

Q-learning learns action values; REINFORCE and PPO adjust a policy's preferences directly.

500

Trips from the start until the goal, the pit or 100 steps.

0.95

How much a reward one step later is worth now.

0.50

Step size of every update.

0.10

Q-learning only: share of steps that take a random action.

0.20

PPO only: how far the policy may move from the one that collected the batch.

0.10

Chance that a move turns 90° to either side.

Simulating…
Working…

Working…

03

Imagined success

Predict

Predict first

A policy trained in a learned world model reaches a very high imagined return. What should you expect in the real environment?

It will do as well in the real environmentIt may have found a trick the model gets wrongImagined returns are always pessimistic
Reveal

It may have found a trick the model gets wrong. Optimizing against a model rewards whatever the model overrates, and errors compound along long rollouts. Only returns in the real environment, over several seeds, count.

04

Errors grow with the horizon

Explore

Each predicted step feeds the next, so uncertainty widens with distance, as in a forecast fan. Drag the horizon and watch the band spread.

DExplorable · The forecast fan

Why do forecast intervals widen, and how fast depends on what?

How many times wider is the interval at the horizon than one step ahead?

5.5
How sure?

Model

0.95
12

Interval

0.50

Commit your prediction above to see the result

Make your prediction first; the figure appears when you commit.

Make your prediction to see the result.

A world model that looks accurate one step ahead can be useless thirty steps ahead. Test prediction errors at the horizons your planner uses.

05

Genie: actions nobody labeled

Read
Reference · VID063 · Explained hereGenieLearns an interactive generative environment from videos without externally supplied action labels. A latent-action model discovers controls between observations, and a dynamics model uses those controls to generate…

Genie learns an interactive environment from videos with no action labels. A latent actionLatent actionA small code inferred from what changed between two frames, used as if it were the action that caused the change. model looks at two consecutive frames and infers a small discrete code for "what changed"; a dynamics model learns to generate the next frame from past frames and that code. At play time, choosing a code acts like pressing a button.

In the reference's toy, three observed changes map to action codes 0, 1 and 2. Those codes needn't match real controls: camera motion or a confounder can become an "action".

06

V-JEPA 2: plan toward a goal

Read
Reference · VID066 · Explained hereV-JEPA 2 and action-conditioned post-trainingExtends latent predictive video learning and adds action-conditioned world-model post-training for planning. It separates broad action-free representation learning from a later stage using robot interaction…

V-JEPA 2 first learns video features from a large amount of action-free video, then is post-trained on robot trajectories with actions to predict the next latent state. To act, it plans toward a latent goalPlanning toward a latent goalTry candidate action sequences in a learned model and pick the one whose predicted embedding lands closest to a goal image's.: try candidate action sequences in the model and pick the one whose predicted embedding is closest to the goal image's (for example with the cross-entropy methodCross-entropy method (CEM)Sample action sequences, keep the best-scoring few (the elites), refit the sampling distribution to them, repeat.).

In the reference's toy, three candidate sequences have costs 0, 4 and 16, so the first is chosen. The post-training stage uses action data; it isn't action-free.

07

Cosmos and a humble baseline

Read
Reference · VID067 · Explained hereCosmos World Foundation Model PlatformOrganizes video curation, tokenizers, pretrained world models and downstream adaptation into a platform for physical-AI research.

Cosmos is a platform: video data curation, tokenizers and several pretrained world models (some autoregressive over tokens, some diffusion), meant to be adapted to a domain. It isn't one architecture with one loss.

Any learned future should beat the simplest guess. In the reference's toy, a constant-velocity extrapolation predicts positions 3, 4 and 5; against the observed path, its rollout error is 0.647. Generated plausible futures aren't validated digital twins.

08

How to judge a world model

Read
  • Real outcomes: environment return or robot success over repeated trials and seeds, not imagined return.
  • Baselines: constant velocity, model-free agents at the same interaction budget.
  • Ablations: model versus policy contributions.
  • Out of domain: new scenes, objects or robots, and the gap from simulation to reality.
  • Separate claims: good video prediction, good control and calibrated 3D understanding are different things.
09

What runs here

Read
EntryIn CodeSplash
VID062 · DreamerExplained here
VID063 · GenieExplained here
VID066 · V-JEPA 2 and action-conditioned post-trainingExplained here
VID067 · Cosmos World Foundation Model PlatformExplained here
10

Check: world models

Checkpoint

Check yourself

How does Dreamer improve its behavior?

Show the answer

Answer: b

Imagination saves real interactions; the model's errors are the price.

Check yourself

Which result supports a Dreamer-style agent best?

Show the answer

Answer: a

Real returns across seeds are the evidence; imagined returns can be exploited errors.

Check yourself

What does the KL term in Dreamer's model loss do?

Show the answer

Answer: b

The prior must be good, because imagination runs on the prior alone.

Check yourself

Where do Genie's actions come from?

Show the answer

Answer: b

Latent actions are learned from unlabeled video; they behave like controls at play time.

Check yourself

A Genie-style model learns a latent action that pans the view. What is a risk?

Show the answer

Answer: a

Inferred actions need not be causal or real; test controllability and consistency outside training.

Check yourself

How does V-JEPA 2's action-conditioned model choose actions?

Show the answer

Answer: b

Planning by prediction: search over actions, score by distance to the goal in embedding space.

Check yourself

V-JEPA 2 pretrains on video without actions. How should the full planning system's supervision be described?

Show the answer

Answer: b

The post-training stage uses action information; say so when describing the system.

Check yourself

What is Cosmos?

Show the answer

Answer: b

The name covers several components; don't attribute one architecture to it.

Check yourself

A learned world model predicts object positions a few steps ahead. Which baseline should it beat first?

Show the answer

Answer: b

If a simple physical guess does as well, the learned model adds little for that horizon.

11

Recap

Recap
  • World models predict how observations change under actions, then plan or train in imagination.
  • Dreamer trains policies in imagined rollouts; imagined returns can be exploited errors.
  • Genie infers latent actions from unlabeled video; V-JEPA 2 plans toward a goal embedding after action post-training.
  • Cosmos is a platform; any learned future must beat constant velocity and real-world tests.

Concepts in this lesson