Concepts
What a world model is
A world model is a learned model of how an environment changes. An agent acts, its actions change a hidden state of the world, and it receives partial observations of that state. A world model captures this loop: from what has been observed and an action, it predicts what comes next. An agent that can predict the consequences of its actions can rehearse them before taking them: it can plan, learn a behavior inside its own imagination, or simulate rare events instead of waiting for them.
The idea is old. Kenneth Craik suggested in 1943 that minds reason with "small-scale models" of reality, Schmidhuber trained recurrent networks to predict their own future inputs in 1990, and Ha and Schmidhuber's World Models (2018) trained agents inside a dream of their own making. Since then the field has split along two questions: what the model outputs, and what it is trained to predict.
What a world model outputs
Different consumers need different projections of the same agent–world loop. World Labs' functional taxonomy sorts world models by output:
| kind | outputs | judged by | examples |
|---|---|---|---|
| renderer | observations: pixels for a viewer, often in real time from user input | visual fidelity | Genie 3, interactive video generators |
| simulator | state: geometry, physics and dynamics a program or a person can query | structural and physical accuracy | 3D scene generators, physics-engine digital twins |
| planner | actions: what to do next, given an observation and a goal | whether the agent reaches the goal | model-based control, vision-language-action models, world action models |
The kinds share what they must know about geometry, physics and dynamics, and they are converging: renderers become action-conditioned, and planners use pretrained video renderers as their backbone.
torch_world is about planners: every world model here exists to choose actions. Internally, each still renders or simulates in its own way, and the families differ in what they predict.
What a world model predicts
| approach | predicts | trained by | in torch_world | elsewhere |
|---|---|---|---|---|
| latent prediction | the embedding of the next observation | prediction error in embedding space, plus a term against collapse | JEPA (LeWM, RoboJEPA), DINO-WM | V-JEPA 2-AC |
| value-equivalent latents | the next latent, the reward and the value of what follows | latent consistency and temporal-difference learning, no decoder | TD-MPC2 | MuZero |
| generative video and action | future frames (as video-VAE latents) and the action chunk that produces them | denoising (flow matching) | world action models (DreamZero), LeWAM | video-pretrained robot policies |
| reconstruction | the next latent state, and pixels from it | likelihood of the observations | PlaNet, Dreamer |
Predicting pixels makes the model account for everything in the frame, including texture and noise that do not matter for control; predicting only embeddings or values lets it spend capacity on what is predictable and relevant, at the cost of needing another way to keep the representation from collapsing. Generative models pay for pixels but inherit what large video datasets know about how the world moves.
The families also include representation learners that are not world models on their own, such as I-JEPA, V-JEPA, LeJEPA and DINOv2. They pretrain the encoders that world models build on: DINO-WM plans on frozen DINOv2 features.
Predict representations, not pixels
The latent approach is the oldest family in torch_world. A joint-embedding predictive architecture (JEPA) encodes a context and a target and trains a predictor to map the context's embedding to the target's. It never reconstructs pixels, so capacity goes to what is predictable rather than to texture and noise.
The hard part is collapse: a constant embedding predicts itself perfectly. Models in torch_world avoid it in one of these ways:
| strategy | how | models |
|---|---|---|
| EMA teacher | targets come from a slowly updated copy of the encoder, with stop-gradient | I-JEPA, V-JEPA, DINOv2 |
| distribution regularizer | SIGReg pushes embeddings toward an isotropic Gaussian | LeJEPA, LeVJEPA, LeWM, LeWAM |
| frozen encoder | a pre-trained encoder is not trained at all | DINO-WM, RoboJEPA |
| contrastive | InfoNCE pushes non-matching pairs apart | VL-JEPA |
| reward and value | the latent must predict reward and value, which a constant cannot | TD-MPC2 |
From JEPA to world model
When the context is the present and the target is the future, and the predictor also reads the action taken, the JEPA becomes a latent world model: it imagines the consequence of an action in embedding space. Planning then searches for the actions whose imagined outcome lands closest to the embedding of a goal.
Three ways to choose actions
Every world model here imagines with the same rollout; they differ in what the imagined future is scored against and where candidate actions come from.
| planning | scores imagined futures by | proposals from | models |
|---|---|---|---|
goal reaching with CEM | distance of the final latent to the goal's (cost) | a Gaussian, refit to the best | LeWM, DINO-WM, RoboJEPA, any WorldModel |
reward with MPPI | imagined rewards plus a learned value at the horizon | a Gaussian and the policy prior | TD-MPC2 |
policy sampling with WAMPlanner | the model's own dynamics, toward the goal | the model's action head (sample_actions) | DreamZero (closed loop with DreamZeroPolicy), LeWAM |
Base classes
Every model subclasses one of three classes in torch_world.models.
| base class | you write | you get |
|---|---|---|
JEPA | forward(...) -> {"loss": ...} | make_target_encoder, update_target(momentum) |
WorldModel | encode, predict(z, actions), forward | rollout, cost, planning with CEM |
WorldActionModel | a WorldModel, plus sample_actions, predict_future and imagine | planning with WAMPlanner; decode when latents have a decoder |
Conventions
Loss dicts. forward returns a dict with a scalar "loss" to backpropagate, plus its named components ("pred_loss", "sigreg_loss", ...) for logging.
Time is dim 1. Episodes and latents are (B, T, ...). For WorldModel, predict(z, actions) maps z[:, t] and actions[:, t] to a prediction of z[:, t + 1], for every t at once (teacher forcing).
Actions align with states. In collected episodes, actions[:, t] is applied at states[:, t] and produces states[:, t + 1]. The last action is padding.
History. WorldModel.history is the number of past latents the predictor sees. rollout slides a window of that length; None means the full past.
Masks are index tensors. A mask is a (B, K) tensor of token indices to keep, and a masking strategy returns lists of them, one per block. apply_masks gathers them and stacks multiple masks on the batch dim.
Videos are channels-first. VisionTransformer takes images (B, C, H, W) or videos (B, C, T, H, W); episodes from environments are (B, T, C, H, W), so transpose dims 1 and 2 before a video encoder.
Further reading
- World Labs, A functional taxonomy of world models, 2026: renderers, simulators and planners.
- World model (artificial intelligence), Wikipedia: history and approaches.
- Ha and Schmidhuber, World Models, 2018.
- LeCun, A Path Towards Autonomous Machine Intelligence, 2022: the JEPA proposal.
- Hafner et al., Learning Latent Dynamics for Planning from Pixels (PlaNet), 2019, and Mastering Diverse Domains through World Models (DreamerV3), 2023.
- Schrittwieser et al., Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model (MuZero), 2020.
