Twenty-five models. One interface.
PyTorch World is our open-source library for building, training and comparing world models, then planning with them. Every model shares the same three methods, four planners and 190 environments, so a new idea can be measured against the field instead of against its own codebase.
Why one library
A world model learns how an environment evolves. Given what it sees and the action it takes, it predicts what comes next. An agent with a world model can plan by imagining the consequences of candidate actions before it commits to any of them.
The field is moving quickly. Joint-embedding predictive architectures, world models on frozen DINO features, TD-MPC, Dreamer and world action models that denoise video and actions together each ship with their own code, data pipeline and evaluation. Comparing two of them usually means reconciling two repositories first.
torch_world builds them all from the same parts: vision transformers, conditioned predictors, masking strategies, objectives, planners, environments and metrics. Each model stays short, and any two can be compared directly. Training a latent world model and planning toward a goal image takes about a dozen lines:
from torch_world.envs import PointMassfrom torch_world.models import LeWMfrom torch_world.nn import CLSEncoderfrom torch_world.planning import CEMencoder = CLSEncoder(img_size=32, patch_size=8, embed_dim=64)model = LeWM(encoder, action_dim=2, embed_dim=64)# pixels (64, 4, 3, 32, 32), actions (64, 4, 2)episodes = PointMass(batch_size=64).collect(4)# next-embedding prediction + SIGRegloss = model(episodes["pixels"], episodes["actions"])["loss"]model.eval()z = model.encode(episodes["pixels"][:, :1])goal = model.encode(episodes["pixels"][:, -1:])[:, 0]actions = CEM(horizon=5, action_dim=2)(model, z, goal) # (64, 5, 2)The full quickstart collects data, trains for 40 epochs and plans in closed loop. It runs in a few minutes on a laptop CPU.
One interface for every model
Every model subclasses one of three base classes. You write a few methods, and the base class supplies the rest, including planning.
| Base class | You write | You get |
|---|---|---|
JEPA | forward returning a loss dict | 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, imagine | Planning with WAMPlanner, plus decode when the latents have a decoder |
A handful of conventions hold everywhere. forward returns a dict whose scalar "loss" is backpropagated, alongside named components for logging. Time is always dimension 1, so episodes and latents are (B, T, ...). The action actions[:, t] is applied at states[:, t]. A mask is a (B, K) tensor of token indices to keep. Because of these conventions, an image JEPA, a video model and a multi-robot world model can all share the same VisionTransformer, MaskedPredictor and AdaLNBlock layers.
Twenty-five models in five families
Models are grouped into families by how they learn. Models in the same family share a base class and can be swapped on the same data, environments and planners. Every model comes with a notebook that trains and evaluates it.
- JEPA
- I-JEPA, LeJEPA, V-JEPA, V-JEPA 2.1, LeVJEPA, VL-JEPA, VLA-JEPA, LeWM, PLDM, LpWM, Flow-JEPA, Variational JEPA, AdaJEPA, Causal-JEPA, CF-JEPA, TD-JEPA, HWM, H-JEPA, LeWAM, RoboJEPA
- DINO
- DINOv2, DINO-WM
- TD-MPC
- TD-MPC2
- Dreamer
- DreamerV3
- World action models
- DreamZero
Predict representations, not pixels
Most models in the library are JEPAs. A JEPA does not reconstruct every pixel. It encodes a context view and a target view, then trains a predictor to map one embedding to the other. The loss lives entirely in representation space, so the model spends its capacity on predictable semantic and physical structure rather than on texture and background noise.

MultiBlockMask((8, 8), min_keep=4). The context encoder sees 25 of 64 patches, and the predictor infers the latents of four disjoint target blocks.The central risk is collapse: a constant embedding predicts itself perfectly. The library implements five ways of preventing it:
- EMA teacher. A slow-moving copy of the encoder produces the targets. Used by I-JEPA, V-JEPA and DINOv2.
- SIGReg. Random one-dimensional projections of the embeddings are pushed toward a standard normal, with no teacher or stop-gradient. Used by LeJEPA, LeVJEPA, LeWM and LeWAM.
- Frozen encoder. Dynamics are learned over a fixed, pretrained representation. Used by DINO-WM and RoboJEPA.
- Contrastive alignment. InfoNCE pulls matching pairs together and pushes the others apart. Used by VL-JEPA.
- Reward and value. The latent must predict reward and value, which anchors it to the task. Used by TD-MPC2.


Imagination you can inspect
Action-conditioned world models learn dynamics either over frozen patch features (DINO-WM) or end to end from raw pixels (LeWM). We test both on single-cube manipulation with a simulated UR10e arm in MuJoCo, where 4-D actions move the end-effector at 5 Hz.

rollout predicts every future latent without seeing another image. Decoded predictions keep an SSIM of 0.71 at t = 2 and 0.63 at t = 10.LeWM trains its encoder and predictor jointly from 96×96 pixels, with no pretrained backbone and no teacher. After 30 epochs, the single vector it keeps per frame encodes the 3-D state of the scene:

Planning in imagination
Planners in torch_world.planning search for actions inside a model’s imagination. CEM needs only encode, rollout and cost, so it works with any world model without extra code. The other planners build on the same interface, so one model can be tried with several planners.
| Planner | Scores imagined futures by | Proposals from |
|---|---|---|
CEM | Distance of the final latent to the goal’s | A Gaussian refit to the best samples |
MPPI | Imagined reward plus learned value | A Gaussian and the policy prior |
GRASP | Goal cost along the path plus dynamics consistency | Gradient descent on actions and states |
WAMPlanner | The model’s own dynamics toward the goal | The model’s action head |

Macaw. Each wingbeat changes the frame, so the model must separate position from wing phase. DINO-WM with CEM replans at every step.
Because planners share one interface, comparing them is a loop. On one LeWM in the Two-Rooms task at horizon 8, MPPI reaches 98% success. CEM reaches 70% and GRASP 50%, the latter with learning rates we did not tune.
The same machinery extends to multiple robots. RoboJEPA learns one predictor over several camera views with an action projection for each embodiment. Passing an embodiment index to the planner lets a single model control robots whose action spaces differ:

190 environments, one batch at a time
Every environment steps a whole batch of worlds at once and renders it on whatever device it lives on, so collection, training and planning stay on the GPU. The library ships its own tasks and wraps the suites the field already benchmarks on: OGBench, DeepMind Control, Meta-World, ManiSkill, MyoSuite, RoboCasa and RoboDojo.
Its own tasks include planning puzzles such as Maze, KeyDoor and Sokoban, 18 MuJoCo scenes, two Newton control systems and three Isaac Lab tabletop tasks. A single call trains a model on a task, plans with it and records the results:
from torch_world.benchmarks import run_experimentfor task in ("Maze-v0", "KeyDoor-v0", "Sokoban-v0"): for seed in (7, 8, 9): run_experiment(task, seed=seed, output_dir="runs/benchmarks")Reproduced, not just reimplemented
A reimplementation is only useful if it matches the paper. We hold ours to that standard on the papers’ own tasks and protocols. Every number on our side comes from an executed notebook or a released checkpoint, and none is estimated.
On Push-T, our released DINO-WM checkpoint reaches 94.0%, against 92.0% in the paper. LeWM trained with PyTorch World reaches 83.8% in the reference simulator, against 84.2% for the authors’ own checkpoint under the same evaluation. All three checkpoints are on Hugging Face.
We also report where our numbers fall short. In our MuJoCo port of Push-T, LeWM scores 80.4%, against 96.0% in the paper. The paper averages three seeds over 50 tasks, and the port replays expert actions slightly less faithfully than the reference simulator. The reproduction report documents every gap, along with 25 smaller notebooks that illustrate each model and method. Those are labeled as not comparable with the papers’ numbers.
What the benchmarks show
Since every model is built from the same parts, controlled comparisons are cheap. In the Two-Rooms task, two rooms are joined by a door and seen as 64×64 images. All models train on the same 1,024 episodes, and an episode succeeds if the agent comes within 0.1 of the goal.
| Model | Same room | Other room | ms / step |
|---|---|---|---|
| PLDM | 100% | 88% | 23 |
| DINO-WM | 97% | 28% | 17,300 |
| V-JEPA 2-AC | 88% | 44% | 41,800 |
| LeWM | 78% | 34% | 1,220 |
| TD-MPC2 | 19% | 0% | 14 |
| Random actions | 56% | 3% |
PLDM and LeWM train their encoders end to end; DINO-WM and V-JEPA 2-AC plan on frozen ones. Small models trained for five epochs on one GPU. These compare methods at a small budget, not at the papers’ scale. TD-MPC2 is trained offline here and is listed for completeness, not as a fair measure of the method.
A few results stand out:
- Crossing the door is the hard part. In the same room, every world model except TD-MPC2 beats random actions. Only the end-to-end PLDM reliably plans through the door, at 88%.
- Frozen web-scale encoders are slow to plan with. DINO-WM and V-JEPA 2-AC plan well in the same room but take 15 to 35 times longer per step than LeWM.
- Stochastic predictors help over long horizons. Flow-JEPA, which plans on sampled futures, nearly triples LeWM’s success through the door, from 23% to 64%.
- Robustness differs widely. PLDM is unaffected by drifting distractors or a tinted floor. Under the tint, LeWM’s success through the door falls to zero.
- Good representations do not guarantee good plans. Across eight models, no probe, rank or prediction-error measure predicts planning success once corrected for multiple tests. The most accurate predictor plans at 50%, while PLDM, ten times worse at prediction, plans at 94%.
That last result is the kind of question torch_world exists to answer. With planning success, probes and prediction error measured the same way for every model, the field’s usual proxies can be tested directly. The full results include planner, encoder, hierarchy and robustness comparisons.
Vision and language, by predicting embeddings
Joint-embedding prediction extends beyond control. VL-JEPA does not generate answers token by token. It predicts the embedding of the answer from frozen image features and the question, and decodes by retrieving the nearest candidate. On MedicalVQA, a set of nearly 65,000 clinical questions built from MedMNIST across five imaging modalities, a 3.7M-parameter model answers 93.2% of held-out questions correctly.

Build your own
A new world model subclasses WorldModel and defines encode, predict and forward. Rollouts, costs and every planner then work without further code. Here is a complete convolutional world model with residual dynamics and SIGReg:
import torchfrom torch import nnfrom torch_world.losses import SIGRegfrom torch_world.models import WorldModelfrom torch_world.nn import MLPfrom torch_world.planning import CEMclass ConvJEPA(WorldModel): history = 1 def __init__(self, action_dim, dim=32, lamb=0.01): super().__init__() self.encoder = nn.Sequential( nn.Conv2d(3, 32, 4, 2, 1), nn.GELU(), nn.Conv2d(32, 64, 4, 2, 1), nn.GELU(), nn.Conv2d(64, 64, 4, 2, 1), nn.GELU(), nn.Flatten(), nn.Linear(64 * 4 * 4, dim), ) self.dynamics = MLP([dim + action_dim, 256, 256, dim]) self.sigreg = SIGReg(256) self.lamb = lamb def encode(self, pixels): z = self.encoder(pixels.flatten(0, 1)) return z.unflatten(0, pixels.shape[:2]) def predict(self, z, actions): return z + self.dynamics(torch.cat([z, actions], dim=-1)) def forward(self, pixels, actions): z = self.encode(pixels) pred = self.predict(z[:, :-1], actions[:, :-1]) pred_loss = (pred - z[:, 1:]).square().mean() sigreg = self.sigreg(z.transpose(0, 1)) loss = pred_loss + self.lamb * sigreg return {"loss": loss, "prediction": pred_loss, "SIGReg": sigreg}model = ConvJEPA(action_dim=2).to(device)planner = CEM(horizon=5, action_dim=2, num_samples=512, num_elites=48, iterations=10, bounds=(-1, 1))
Datasets and environments follow the same idea. TrajectoryDataset slices any dict of (N, T, ...) tensors into training windows, directly in GPU memory if the tensors are already there. An environment needs only reset, step, render, distance and success. With those five methods, it plugs into run_policy, every planner, evaluation.goal_reaching and the plotting tools.
Get started
PyTorch World needs Python 3.10 or newer and PyTorch 2.1 or newer, its only required dependency. It is released under the Apache 2.0 license.
pip install torch-world # or: uv add torch_world# notebooks, plots and MuJoCo taskspip install "torch-world[examples,action]"Optional extras add each external suite: ogbench, dmcontrol, metaworld, maniskill, myosuite, robocasa and robodojo. The documentation is also available in Portuguese, Spanish, Chinese and Japanese.
PyTorch World is built in the open, and more families are on the way. We welcome contributions of models, environments and ideas, and we look forward to seeing what you build with it.