World Models 101
Contents
02

The Idea

11 min read · interactive

The oldest of the five definitions, and the one the term was coined for. What a learned simulator is, what having one buys you, and the way it fails that no amount of engineering has removed.

A professional tennis serve arrives in about half a second.

Getting a signal from your retina to your visual cortex takes somewhere around sixty to a hundred milliseconds. Getting a large muscle group to actually move takes another hundred and fifty. Add the swing and the returner is over budget before they have decided anything at all.

So they are not reacting to the ball. They cannot be. They are reacting to a prediction of it, produced by something that took the toss, the racket angle and the first few frames of flight, and ran them forward.

That is the Dynamics Model, the definition Chapter 1 said the term was coined for. This chapter is about what it is, what having one buys you, and the way it fails that no amount of engineering has removed.

Cached answers

Two identical cars approach two identical walls.

The first brakes when the wall is closer than some fixed distance. Somebody tuned that distance once, it worked, and it shipped. The second carries a model of its own braking, rolls it forward every tick, and brakes the moment its imagined stopping point ends up inside the wall.

Fig. 2.1At the default speed the two are indistinguishable, and that is the important half of the demonstration. Drag the speed up and watch which one notices.

Below about forty they behave identically. That is not a warm-up, it is the point. A reflex is cheap, fast, and correct across the whole range it was tuned in, which is why evolution and engineering both spend most of their time building them.

Push past the tuned range and the reflex does not degrade gracefully. It fails at a threshold, completely, and it fails with no internal signal that anything has changed. The fixed trigger distance encodes an assumption about speed, and nothing in the controller knows it is making one.

The model car slows earlier because its stopping distance grew and it can see that it grew.

What it buys you

Three things, and they are all the same thing wearing different clothes: you can ask questions about situations that have not happened.

You can try an action before paying for it. Chapter 1 defined this category by whether you can search inside it. Here is what that means in practice.

Closest so far, still short.

Considered

1

Would have hit the wall

0 / 1

Best distance from goal

136

Fig. 2.2The planner samples action sequences, rolls each one through its model, scores them, and keeps the best. Faint lines are the ones it rejected. Drag the count up and the plan improves, which is the entire argument for carrying a model.

With one sample it is guessing. With two hundred it reliably finds the way round. Nothing about the world changed between those two states; the only thing that changed is how much thinking happened before acting, and a model is what converts thinking into a better action.

You can practise where mistakes are free. Reality is a slow and expensive teacher. Every trial costs wall-clock time, and some trials cost a drone. A model runs faster than real time and breaks nothing, so once you have one you can generate as much experience as you have compute for. This is the largest practical argument for model-based methods and the subject of Chapter 6.

You can ask what would have happened. Given a model, what if I had braked earlier is answerable. Without one it is not, because the world only ever runs the experiment once. Credit assignment, regret, and most of what we informally call reasoning depend on being able to ask it.

Where it breaks

Everything above assumed the model is right. It is not, and the way it is wrong is worse than being noisy.

A learned model is wrong in specific, structured places: the parts of the world it saw least during training. That would be tolerable if you sampled plans at random. But you do not. You search for the plan the model scores highest, and a search that is good at its job will find exactly the places where the model is most optimistic, which are disproportionately the places where it is most wrong.

The optimiser is not fighting you. It is doing precisely what you asked.

gap the model believes inthe only real gap

Not enough search to find the flaw. It takes the long way round, and it works.

In the model

Reached the goal

In reality

Reached the goal

Fig. 2.3The model believes there is a gap in the wall. There is not. Start with the search effort low and the planner never finds it, so it takes the long way round and succeeds. Turn the effort up.

Read that figure twice, because it inverts something most engineering intuition takes for granted. A weak optimiser produced a plan that worked. A strong one produced a plan that was perfect in imagination and hit a wall. More search made the outcome worse, and it did so by getting better at its stated job.

This has a name, model exploitation, and it is why so much of the field's machinery exists. Ensembles, uncertainty penalties, pessimism, short rollouts and trust regions are all versions of one instruction: do not let the planner go where the model has not earned the right to be confident.

Planning is the process of taking a model as input and producing or improving a policy for interacting with the modelled world.

Sutton on planning as computation over a learned model, in the paper that set up the whole problem (Dyna, an Integrated Architecture for Learning, Planning and Reacting, 1991)

Which is exact, and contains the whole difficulty in the phrase the modelled world. The policy you get is good for the world in the model. Whether that is the world you are standing in is a separate question, and nothing inside the model can answer it.

What to carry into Chapter 3

  • A reflex is a cached answer. A model recomputes when the question changes, and earns its cost only outside the range the cache was built for.
  • The defining property is searchability, not fidelity. If you cannot roll it forward under actions nobody has taken, it is not doing this job.
  • A model buys you three things that are one thing: trying actions before paying for them, practising where mistakes are free, and asking what would have happened.
  • A better optimiser can produce a worse outcome, because it finds the places your model is confidently wrong. That is the shape of the problem, not a bug in your implementation.

Everything here assumed you already had a state to predict from. You do not. You have pixels.

Thanks for reading. Chapter 3 is about why predict the next thing, an objective that sounds far too simple to work, turns out to be enough to pull the structure of a world out of raw experience.

Try it

1 / 8Score 0

Below about forty on the braking demo, the reflex car and the model car behave identically. What does that tell you?

Pick one

Fig. 2.4Eight questions on this chapter. The last two are the ones worth getting wrong here rather than in a review.

Sources

Fig. 2.5Ordered for someone building on this rather than for historical completeness.