Skip to content

Inside LeWM's Two Rooms

World models · 2026 · LeWorldModel

We took the published LeWM checkpoint for AnyGoal’s two-room world and asked what its latent space knows about the room. It plans well to goals in the same room, but with its own L2 latent distance it reached a goal in the other room in 0 of 5 runs. A distance learned on its own exploration data, used with a planner that looks only 5 steps ahead, reached it in 4 of 5.

LeWM · AnyGoal TwoRoom · latent probe

What LeWM learned about the two rooms

LeWM is a JEPA world model. It squeezes every 224 × 224 frame into a vector of 192 numbers and learns to predict the next vector from an action. It never sees coordinates. Here we put the agent on every free spot of the room, read the vectors back out, and ask what kind of map is hiding in them.

The problem

Does a world model that only sees pixels learn a usable map?

The task. A dot-shaped agent lives in two rooms joined by a doorway in the middle wall. It is given a picture of a goal and must move there. In the AnyGoal benchmark the goal is where the agent will be 25 steps further along a route, and every route stays inside one room. Even so, LeWM gets there on only 48–60% of tries (3 seeds × 50 trips), while a model that plans from true coordinates gets 100%.

How LeWM plans. It turns the current picture and the goal picture into vectors. It imagines where many candidate action sequences would take it, and picks the one whose imagined final vector is closest to the goal's vector. So planning only works if the vector space behaves like a map: it must know where the agent is, measure distance the way the agent has to walk, and predict how actions move it.

What this page does. We put the agent on every free spot of the room, look at the vectors LeWM produces, and test those three things one at a time:

  1. Does the vector hold the agent's position? (sections 1 and 2)
  2. Does distance between vectors match walking distance around the wall? (section 3)
  3. Does the predictor move the vector the way real actions move the agent? (section 4)

Short answer: yes to position; distance only over short walks, so trips through the doorway fail; and yes to prediction, though the benchmark's planner scales actions differently from training. A learned distance plus a shorter look-ahead gets the frozen model through the doorway (How it finally crossed). None of these yet explains why LeWM misses half of the benchmark's same-room trips.

Watch it plan

From a start to a goal: imagine, pick, step, repeat

LeWM only gets two pictures: where the agent is now, and what the room looks like with the agent at the goal. It never gets coordinates. Every 5 steps it runs the same loop:

  1. Encode the current picture and the goal picture into vectors.
  2. Imagine 300 random 25-step action plans with the predictor (faint lines).
  3. Pick the plans whose imagined end vector is closest to the goal's vector, and refine them 30 times.
  4. Step: take the first 5 actions of the best plan for real, then start again.
The room. Hollow ring: start. Star: goal. Solid line: the path taken. Faint lines: futures the predictor imagined at this step, read back to positions. Thick dashed line: the plan it chose.
What the model sees. Distance between the current picture's vector and the goal picture's vector, at each planning step. Planning only tries to push this number down. The thin line is the true walking distance to the goal, scaled to the same start height.

Actions scaled

Watch the far trip. The agent walks straight toward the goal and stops against the wall, at the spot that is closest to the goal as the crow flies. From there every imagined plan ends further away in latent space, because the vector distance does not know a wall is in the way, so it never finds the door. It did this in all 5 runs. Even the trip next to the door, only 30 px away through the doorway, worked once in 5; in the other runs the agent drifted away to the far left wall. Same-room trips worked in 19 of 20 runs. The action scaling made no visible difference on any trip. The sections below show why: the latent space knows where the agent is, but its distances only make sense over short walks. How it finally crossed shows the fix: the same frozen model, with a learned distance and a shorter look-ahead, reaches the far goal in 4 of 5 runs. The benchmark never asks for a trip like this (its routes stay in one room), so the wall does not explain LeWM's 48–60% there; that gap is still open.

The planner is random, so each trip was run with several seeds; the counts under the controls say how often it worked. Here it replans every 5 steps and gets up to 100 steps (the benchmark allows 50). Four hand-picked trips show how it behaves; they are not a success rate.

How it finally crossed

Keep the model, change the ruler, look less far ahead

LeWM itself stays frozen. Two things around it change. First, the planner's ruler: instead of squared distance between vectors, a small network reads two LeWM vectors and predicts how many steps it takes to walk from one to the other. Second, the look-ahead: the planner imagines 5 steps instead of 25.

  1. Explore. 240 self-generated episodes, 72,000 frames, 236 real trips through the doorway. The test data had none, so nothing in it showed that the rooms connect.
  2. Label. Count steps along shortest paths over transitions that really happened, plus merges of near-identical frames. No imagined moves, so no shortcuts through the wall.
  3. Learn the ruler. A small network maps (vector now, goal vector) to steps-to-goal. Only LeWM's frozen vectors go in.
  4. Plan with it. The planner's cost becomes the predicted steps from the imagined end to the goal, with the old distance kept only to break ties.
Goal
Old ruler: squared latent distance to the goal.
Learned ruler: predicted steps to the goal.
near
far (rank)

The learned map bends around the wall: spots just left of it, a straight line away from the goal, are coloured far, because walking there means going round through the doorway.

The trip. Hollow ring: start. Star: goal, with its 16 px success zone. Line: the path the real agent took.

The twist: the new ruler alone was not enough. Looking 25 steps ahead with the learned ruler still got 0 of 5 far trips. From the stuck spot against the wall, the predictor imagines that moving right carries the agent through the wall and up into the other room, and the learned ruler scores that imagined end as close to the goal. The real agent pushes into the wall, does not move, replans the same plan, and stays stuck. Over just 5 steps the predictor's imagination stays close to what really happens, so it has little room to imagine a way through the wall, while the learned ruler supplies the long-range sense of direction. The short look-ahead alone does not do it either: with the old ruler and 5 steps, even the same-room trip fails every time.

Caveats. The exploration data is ours, and about a third of its episodes were deliberately steered through the doorway. Each cell is 5 seeds on one hand-picked trip, with a 200-step budget (the benchmark allows 50). This has not been run on the AnyGoal benchmark, where LeWM scores 48–60%, so it says nothing yet about that gap. The learned ruler is the same idea as the value function in TD-MPC: a learned estimate of how far the goal really is, so a short plan can stand in for a long one.
The room and the latent space

Nearby in latent space means nearby in the room, but only up close

Each dot on the left is one agent position, colored by where it is. The right panel shows the same dots placed by the first principal components of their latent vectors. Hover or touch a spot: its nearest neighbours in latent space light up in the room.

Room. rendered positions, every 4 px, with the wall and its doorway.
Latent space.
Hover a dot to see its 25 nearest latent neighbours.

The top components each explain only a few percent of the variance, so no flat 2-D picture captures the room. The map lives spread across many of the 192 dimensions. The neighbour view is the fairer test. For a typical spot, its 25 nearest latent neighbours lie a median 9 px away in the room; 25 random spots would lie about 105 px away. About one spot in ten has neighbours scattered much wider.

Reading position back out

A straight line through the latent space recovers x and y

Real test frames. Dot: where the agent really was. Line: where a linear read-out of the latent vector puts it.

We fit a linear map from the 192 numbers to (x, y) on the rendered grid, then test it on frames from the real test set, which it never saw.

The position is all there and linearly readable. That is the precondition for planning: if the vector did not carry position, no cost on it could steer the agent.

What the planner measures

The planner's distance does not see the wall

Planning picks actions whose imagined final vector is closest to the goal's vector, using squared distance. Click any spot to make it the goal. Left: that latent distance from every other spot. Right: the true walking distance around the wall. Both are colored by rank, so if they agreed the two maps would look the same.

Latent distance ‖z − zgoal‖², what the planner minimises.
Walking distance around the wall, through the doorway.
near
far (rank)

Within a short walk the two agree reasonably well. Across the room they barely agree, and latent distance tracks walking distance no better than straight-line distance, so the doorway leaves no mark. A planner looking 25 steps ahead works mostly inside the zone where the two still agree.

Imagining ahead

The predictor tracks the agent, if it is fed actions on the right scale

Start from one real frame, feed the real actions, and let the predictor imagine 5 steps of 5 actions each. Read each imagined vector back to a position with the linear map and compare with where the agent really went.

Median position error over rollouts on the test set.

A scaling mismatch. Before the predictor sees an action, it is standardised. LeWM was trained with its training set's statistics. The AnyGoal planner standardises with the test set's statistics instead, which for the route test have a y-mean of and a spread near . Fed that way, the predictor is worse than assuming the agent stands still for the first few steps and only slightly better by step 25. With the scaling that best fits its one-step predictions (mean 0, spread 0.9, our estimate of the training statistics), it stays within about after 25 steps.

We have not yet re-run planning with the corrected scaling, so we do not know how much of LeWM's 48–60% success it costs.

Summary

What the latent space holds

  • Position, precisely. A linear read-out recovers where the agent is to within a few pixels on real test frames.
  • Local geometry, not global. Latent distance tracks real distance over short walks and loses it across the room. The wall and doorway do not shape the distance.
  • Usable dynamics. With actions scaled as in training, imagined positions stay close to the real path for 25 steps; scaled the planner's way, the predictor barely moves.
  • Crossing needs a better ruler and a short look-ahead. A distance learned from real exploration (steps to reach the goal) bends around the wall; with it and a 5-step look-ahead, the frozen model reached the far room in 4 of 5 runs. With 25 steps it still failed, because over that range the predictor imagines walking through the wall.
  • Still open. Why LeWM misses about half of the benchmark's same-room trips. The crossing fix has not been tried on the benchmark.
Model: LeWM TwoRoom checkpoint (quentinll/lewm-tworooms), ViT-tiny encoder, 192-d latent, 3-frame predictor. Data: AnyGoal tworoom_route test set. Positions rendered with the environment's own renderer (identical to the stored test frames). Distances are Spearman rank correlations over all grid spots; "local" uses spots within 60 px of walking distance. Walking distance is a shortest 8-connected path keeping the agent's 7 px radius clear of walls.

Background: LeWorldModel