HomeVideos

AI World Models (Keyon Vafa)

Now Playing

AI World Models (Keyon Vafa)

Transcript

623 segments

0:00

Hi everyone, my name is Keon Vafa and in

0:02

this video I'm going to go over some

0:04

research that tries to answer the

0:06

question, what are the implicit world

0:08

models inside of generative models in

0:11

AI. Now to see what I mean by this,

0:13

let's go over some functionalities we

0:15

may want from AI systems like large

0:17

language models or LLMs. One exciting

0:20

functionality is that they can

0:21

synthesize concepts. We're also excited

0:24

they can apply concepts to new domains

0:26

such as in Fshot or in context learning.

0:29

Lately, we focused on reasoning, and

0:31

it's amazing that just with the right

0:33

prompting, Gemini can solve math

0:35

olympiad problems. Today's models can

0:37

also be creative while being grounded in

0:39

reality, as you can see, not only in

0:41

text, but also in video models. These

0:44

may all seem like different uses, but

0:46

they all have a shared kind of

0:48

functionality. They could all be

0:50

performed by a model that has understood

0:52

the world to some capacity, or in other

0:54

words, a model that has learned the

0:56

correct world model. Now this raises a

0:59

couple of questions like what would it

1:01

mean to have a correct world model and

1:04

how would we even be able to evaluate or

1:06

measure if a model has understood the

1:08

world. It may seem that one approach is

1:10

to evaluate understanding like how we do

1:12

most other kinds of evaluation in AI

1:15

using benchmark test questions. These

1:18

benchmarks such as the questions on AP

1:20

exams are used to signify understanding

1:23

in people. But do they signify

1:25

understanding in AI? Benchmarks test a

1:28

very narrow kind of understanding, the

1:30

ability to answer test questions. If a

1:33

person aces an AP math exam, we'd say

1:35

they understand math, but it requires

1:37

strong assumptions to extend this logic

1:39

to LLMs. And the evidence we have is

1:42

that LLMs learn things in nonhumanlike

1:44

ways. GBD5 does incredibly well on an

1:47

Amy math competition, but it thinks that

1:50

4.11 is larger than 4.9.

1:53

To give a bit of a crude analogy, using

1:55

human tests to evaluate the

1:57

understanding of LLMs is a bit like

1:59

evaluating the vision capacities of an

2:01

AI model using a vision exam like the

2:04

one we get at an optometrist. It's just

2:06

not what it's designed for. In this

2:08

video, I'm going to take a step back and

2:10

focus on the question of how to evaluate

2:13

a generative models implicit world

2:15

model. I'll start by discussing some

2:17

general strategies for evaluation and

2:20

then I'll focus on a couple of notions

2:21

of world models for my own research. For

2:24

each notion, I'll walk through what a

2:26

world model means in that setting. I'll

2:28

discuss evaluation metrics that can be

2:30

used to test it, and I'll go over

2:31

empirical results. At the end of this

2:33

video, I'll discuss related ideas and

2:36

offer some ways forward. So, let's start

2:38

with some background. It may seem like

2:40

evaluating understanding is challenging

2:43

and it is but there's been a general

2:45

strategy that different groups have used

2:47

and the strategy is to take constrained

2:49

problems for which we know true world

2:51

models and use those as test beds to

2:54

answer important questions like what is

2:56

a world model. One of the early test

2:59

beds was Eth. For those of you who don't

3:01

know, Ethell is a board game that

3:03

involves players taking turns placing

3:05

black and white tiles on a board a

3:08

little bit like Go. Every time a piece

3:10

is put down, it results in a cascade of

3:13

other changes in the board. To make a

3:15

test bed, researchers collected

3:18

sequences of transcripts from Athell

3:20

games and trained a transformer model to

3:23

predict next tokens on these sequences.

3:26

The model never saw the true world,

3:28

which in this case is the Athell board,

3:30

but it was trained to predict the moves

3:32

that were made in games. And the

3:34

evaluation question here is did this

3:37

transformer uncover the implicit

3:39

structure of the Athell board? Now, even

3:42

though the other domains are test beds,

3:46

they're used to create general

3:47

procedures that can be applied

3:49

elsewhere. In this video, I'm going to

3:51

focus on two research projects I've

3:53

worked on which form evaluation metrics

3:55

for world models in two kinds of

3:57

settings. One where we care about a

3:59

world model for a single task and one

4:02

where we care about a world model for

4:03

many tasks. So I'm going to start with a

4:06

single test setting. And here our test

4:08

bed is going to be Manhattan.

4:10

Specifically, we collected a data set of

4:13

taxi rides that took place in Manhattan.

4:16

And we tokenized each taxi ride into a

4:18

sequence of directions, sort of like a

4:20

language for Google Maps directions. We

4:23

took a transformer and only trained it

4:26

on these directions. We never allowed it

4:28

to see the map of Manhattan. But if a

4:30

model has succeeded at this task, you

4:33

can imagine using it to generate new

4:35

rides. It could provide the

4:36

functionality of Google Maps or Ways

4:38

without ever requiring hard-coded maps

4:41

or navigation algorithms, just sequences

4:43

of trips. So when we ran this exercise,

4:46

the model looked good. It proposed legal

4:49

terms nearly 100% of the time and it

4:51

could find valid routes between new

4:53

points 98% of the time. So had the model

4:56

discovered the world model of Manhattan?

4:59

Answering this question first requires

5:01

defining a world model. And there's a

5:03

natural definition here. The map of

5:06

Manhattan can be described by a

5:07

structure known as a deterministic

5:09

finite automaton or DFA. A DFA is pretty

5:13

much a way to represent a set of rules.

5:15

And it's made up of two things. A set of

5:18

states. Here, each state is an

5:20

intersection in Manhattan. And

5:22

transition rules, the legal turns at

5:24

each intersection and where they take

5:26

you. For each taxi ride being taken, its

5:29

trajectory can be tracked by a DFA,

5:31

which tells you where each turn ends up.

5:34

And while the DFA here is a map of

5:36

Manhattan, DFAs are a general way to

5:38

describe structure and can be used to

5:40

model many other kinds of tasks. This

5:43

notion gives rise to a definition which

5:45

is that a generative model like a

5:47

transformer recovers a DFA if every

5:50

sequence that generates is valid in the

5:52

DFA and vice versa. Now, there's a

5:55

little bit I'm glossing over here, which

5:57

is what does valid or invalid mean in

5:59

the context of a transformer? But you

6:01

can imagine this being determined by

6:02

some probability threshold that a

6:04

sequence is valid according to a

6:05

transformer if all of a token

6:07

probabilities are above 1% or something.

6:10

Now, while it may seem intractable to

6:12

compare these two enormous sets, this

6:14

definition gives rise to a nice result,

6:16

which is that if a model always predicts

6:19

legal single next tokens, it must have

6:22

recovered the DFA. This connects to how

6:24

most LLMs are trained, which is to make

6:26

accurate single next token predictions.

6:28

And it also suggests a test. Measure how

6:31

often a model's predicted single next

6:33

tokens are valid. But there's a problem

6:36

with this test. To see, let's consider a

6:39

simplified game called cumulative

6:41

connect 4. This is like the real game of

6:43

Connect 4 where players take turns

6:45

placing tiles in columns and moves are

6:48

allowed in unfilled columns except there

6:51

are n rows and people keep placing tiles

6:53

in the board even if there are four in a

6:55

row. The next token test here works by

6:58

providing a model with the beginning of

6:59

a connect four game and seeing what

7:02

percent of the time it predicts legal

7:03

next move. But it turns out there's a

7:06

very simple model that gets 99% accuracy

7:09

for a large enough board. always predict

7:12

everything is legal. The model has

7:14

clearly understood none of the structure

7:16

of the world, but it does well because

7:19

many states have the same possible next

7:21

tokens. For example, these two boards

7:24

are clearly different, but the set of

7:26

legal next moves allowed all of them is

7:29

the same. So, while perfect next token

7:32

prediction implies world model recovery,

7:35

nearperfect next token prediction

7:37

doesn't mean much. While single next

7:39

tokens aren't enough to differentiate

7:41

states, there's a classic result from

7:43

language theory that's here to help. The

7:45

mile and the road theorem states that

7:47

for every pair of states, there's some

7:49

number k where there's a continuation of

7:52

length k that's allowed by one state and

7:54

not the other. So for example, a and b

7:57

here are two separate intersections or

7:59

states in Manhattan. They have the same

8:01

legal next turns, so they would look the

8:04

same if you just looked at next token

8:05

prediction. They also have the same set

8:08

of legal next two turns. But crucially

8:11

they don't have the same set of legal

8:13

next three turns. So here the myhole

8:16

neurode boundary is three. There exists

8:19

some k that differentiates states but it

8:21

doesn't necessarily need to be one. Now

8:24

this result motivates new metrics for

8:26

testing world models which we call

8:27

compression and distinction. At a high

8:30

level, these metrics go beyond next

8:32

token prediction and instead go to the

8:34

full boundary defined by the myel road

8:36

theorem. There's more details in the

8:38

paper which is linked below, but briefly

8:41

compression tests whether a model

8:43

recognizes that the same state can be

8:45

reached in different ways like there are

8:47

multiple ways to get from 14th Street to

8:49

Time Square and a model should provide

8:51

the same continuations no matter how you

8:53

got to where you are now. distinction is

8:56

a little more general and it says that

8:57

if two sequences lead to distinct

8:59

states, a model shouldn't distinguish

9:01

their length K continuations where K is

9:04

defined by the my Holden road boundary.

9:06

So how about some results? We train

9:08

models on multiple kinds of data, not

9:11

just shortest paths, but also simulated

9:13

traffic and random walks and show that

9:15

all models have greater than 99.9% next

9:18

token accuracy. But they perform poorly

9:21

on these metrics. They fail to compress

9:23

sequences that lead to the same state

9:26

and they incorrectly differentiate

9:27

sequences that lead to different states.

9:30

Now, at this point, you may be thinking,

9:32

hold up, why should we care about world

9:35

models? After all, I just told you that

9:37

the model could find shortest paths. The

9:40

reason to care is that not having the

9:42

right world model means a model can

9:44

perform poorly on different but related

9:47

tasks. I'll show you one such task,

9:50

which is detours. When we add detours by

9:53

forcing models to take certain turns,

9:55

they often fail to reroute. Models that

9:57

navigate well without detours perform

9:59

poorly once they're there precisely

10:01

because they haven't learned a coherent

10:03

world model. We also try to visualize

10:06

each model's implicit map of Manhattan.

10:08

I I won't go into the details here, but

10:10

we did this by trying to reconstruct

10:12

each model's map of Manhattan in a way

10:14

that would be generous to the model. As

10:16

a sanity check, we tried doing graph

10:19

reconstruction on the true world model

10:21

and found that it reconstructed the true

10:22

map. We also tried adding transcription

10:26

errors to sequences from the true model

10:27

to match the transformers error rate and

10:30

found the reconstructed map to be

10:31

imperfect but largely sensible. But when

10:34

we tried to reconstruct the transformers

10:36

map, we found nonsense. The model

10:39

assumed many roads that didn't exist

10:41

existed and also added physically

10:44

impossible flyovers. And this was all

10:46

despite being generous to the model in

10:48

the way we reconstructed the graph. So

10:51

what's happening here? The most helpful

10:53

way for me to think about it is that you

10:55

and I have a single map of Manhattan. If

10:58

I'm on 14th Street and I go a block

10:59

north, I don't throw out my map. I just

11:02

shift my eyes because I know I'm on 15th

11:04

Street. Meanwhile, transformers have to

11:07

reconstruct a map at every turn they

11:09

make. If these reconstructions are

11:12

inconsistent, the world model is

11:14

incoherent. We also extended these

11:17

metrics to large language models

11:18

focusing on logic puzzles. And most LLMs

11:22

we tried incorrectly differentiated

11:24

between two ways of arriving at

11:25

equivalent states indicating poor world

11:28

models for these kinds of logic

11:29

problems. So to summarize, we've looked

11:32

at a definition of world model based on

11:35

DFAS and evaluation metrics inspired by

11:37

the myhill road theorem. On both our

11:40

Manhattan test beds and other

11:42

applications, models could achieve good

11:44

predictive performance while forming

11:47

poor world models. While these

11:49

definitions and tests are specific to

11:52

today's generative models, we've been

11:54

here before. These results relate to the

11:56

idea of the Rashimon effect which was

11:58

coined by Leo Briman in his 2001 paper

12:00

the two cultures. The effect describes

12:03

the fact that two separate regression or

12:05

classification models can have similar

12:07

performance in dramatically different

12:09

ways. And it's relevant here because it

12:12

shows that a model here can achieve

12:14

nearperfect prediction without

12:16

recovering structure from the true world

12:18

model. But what if a model gets perfect

12:22

predictions?

12:23

All of these results have been for one

12:25

notion of world model, but sometimes we

12:28

may want another notion. To see why,

12:30

it's helpful to look at an example. So

12:32

consider the problem of predicting how

12:34

planets move in the night sky.

12:37

Physicists and astronomers have worked

12:38

on this problem for centuries, and a

12:40

breakthrough model was offered by the

12:42

Dutch astronomer Johannes Kepler in the

12:44

17th century. He used geometric

12:46

properties to pinpoint the future

12:48

locations of planets in the night sky.

12:51

These properties couldn't explain why

12:53

the planets move the way that they did,

12:54

but they offered nearperfect

12:56

predictions. A little later, Isaac

12:59

Newton built off this progress to

13:00

develop rules, which we now know as

13:03

Newtonian mechanics, to predict orbits.

13:06

These mechanics could not only predict

13:08

orbits, but they could also explain

13:09

their movement. So, who was right?

13:14

In one sense, both were right. They both

13:16

made perfect orbital predictions. We'd

13:18

be fine with both if we only cared about

13:20

predicting future movements, which is

13:22

what the definitions so far have

13:24

addressed. But Newton provided more

13:26

generality. The same laws he developed

13:29

could be used to solve new problems.

13:31

Anything ranging from pendulums to

13:33

cannonballs to rockets. And many of the

13:35

uses of foundation models we're excited

13:37

by involve this kind of generality, such

13:39

as fuchter and context learning. So,

13:42

I'll now shift and focus on how we may

13:44

measure world models if we care about

13:46

performing well at many different tasks

13:48

that involve shared structure. It's

13:51

helpful to think about a foundation

13:52

model as a learning algorithm. It takes

13:55

in a small amount of data from a new

13:57

task and gives us a new predictive model

13:59

for that task. Now, I'm not going to

14:01

specify the way it adapts. We can think

14:03

about it generally, but we can think

14:05

about this as being via maybe

14:07

fine-tuning or end context learning. And

14:10

again, it's helpful to go back to a

14:12

theoretical result, the no launch

14:13

theorem for learning algorithms.

14:15

Loosely, this theorem states that every

14:17

learning algorithm has an inductive bias

14:19

towards some set of functions, or in

14:22

other words, problems that's better at

14:24

solving from a limited amount of data.

14:26

This gives rise to a natural notion of a

14:28

world model, a restriction over

14:30

functions described by a state space. In

14:33

the illustration to the right, every row

14:35

is a function, and the shadings describe

14:37

different values we'd allow the function

14:38

to take, which all obey a state

14:40

structure. With these tools, we can see

14:43

that a foundation model's inductive bias

14:45

reveals its world model. In other words,

14:47

how a model behaves when it extrapolates

14:50

to small amounts of data reveals its

14:52

structure. We came up with a method for

14:54

testing this, which we call an inductive

14:57

bias probe. The probe has two steps.

15:00

Given a foundation model, we apply it to

15:02

many small synthetic tasks that obey

15:04

some world model. We then look at

15:06

statistical patterns in the functions it

15:08

learns. We look at how it extrapolates

15:10

to see if it follows patterns that would

15:12

be dictated by the true world model. So

15:15

as an example, let's consider the case

15:17

where the state space is discrete. Here

15:20

two metrics pop out. One is whether a

15:22

model's learned functions respect state.

15:25

The picture in the middle shows what

15:27

happens when the learn functions don't

15:29

respect state. Another is the opposite,

15:31

whether a model's learn functions

15:33

successfully distinguish state. And a

15:36

failure of this is illustrated on the

15:37

right. So these metrics test both kinds

15:40

of failures and they're analogous to

15:42

type one and type two errors in

15:44

classification.

15:45

As an example, we consider a 1D state

15:48

tracking problem. Essentially a very

15:50

small map with K states in a line. And

15:53

while we find good inductive bias for

15:55

small states, we find that inductive

15:57

biases worsen quickly for many different

15:59

kinds of models, we also find that

16:02

generally states space models like RNN's

16:04

and Mamba are consistently better than

16:06

transformers.

16:08

So we also try these metrics with models

16:10

trained on planetary orbits. We train a

16:13

transformer to predict the future

16:15

locations of planets across many solar

16:17

systems. And we find that like Kepler,

16:20

the model makes good predictions.

16:23

But has it learned Newtonian mechanics?

16:26

When we use the inductive bias probe, we

16:28

find a low inductive bias toward

16:30

Newtonian mechanics. The model makes

16:32

similar predictions for orbits with

16:34

different states and different

16:35

predictions for orbits with similar

16:37

states. To illustrate this, we try

16:40

fine-tuning the model to predict the

16:41

force vectors between planets using a

16:43

small amount of data. Force vectors are

16:46

a cornerstone of Newtonian mechanics.

16:48

So, a model that's using Newtonian

16:50

mechanics should easily pick this up.

16:52

But we find that the transformer

16:54

struggles to learn force. It learns

16:56

something nonsensical.

16:58

When we use a symbolic regression to try

17:00

to estimate the implied force law of the

17:02

model, we find the law to not only be

17:05

nonsensical but also fickle. It changes

17:08

depending on the galaxy it's applied to.

17:11

And it's not just our domain specific

17:13

transformer. We find that LLM which have

17:15

surely been trained on the text of

17:17

Newton's laws struggle at this too. So

17:20

if inductive biases aren't toward the

17:22

true world models, what are they toward?

17:26

One possibility is that models which are

17:28

trained to predict next tokens conflate

17:31

sequences that have similar legal next

17:33

tokens even if they correspond to very

17:36

different states. As an example, two

17:39

different boards can have the same

17:40

allowed set of legal next tokens. When

17:43

we fine-tune a model trained on a moves

17:45

to predict the boards, we find that it

17:47

often reconstructs boards incorrectly

17:50

but reconstructs them well enough so

17:52

that the legal next moves from the

17:53

reconstructed board are correct.

17:56

This suggests that foundation models may

17:57

only recover enough of state to

17:59

calculate next tokens. So in this

18:02

multiple task setting, we've use a

18:04

definition of a world model to be

18:06

functions that obey a state space. We

18:08

developed inductive bias probes as

18:10

evaluation metrics and used planetary

18:13

orbits as a test bed that also extended

18:15

to other problems. Now I want to take a

18:17

few moments to go over some related

18:19

ideas. The metrics I've described have

18:22

taken a functional approach to

18:23

evaluation. They've evaluated models by

18:26

their performance on input output pairs.

18:28

But there's another possible approach

18:30

that's mechanistic. Evaluating a model

18:33

by its inner workings. The field of

18:36

mechanistic interpretability works on

18:38

developing tools for understanding the

18:40

inner workings of neural networks. There

18:42

are a few goals, but a big one is using

18:44

this understanding to steer model

18:46

performance in some way. For example,

18:48

the Claude team at Enthropic released a

18:50

demo of a Claude model, which would

18:52

always divert conversations to be about

18:54

the Golden Gate Bridge. Of course, you

18:57

wouldn't actually want a model that

18:58

always talks about the Golden Gate

19:00

Bridge, but you can use similar tools to

19:02

steer models so that they're used

19:03

safely. Now, there are many interesting

19:06

results which I don't have time to get

19:08

to about adapting these methods to study

19:10

world models. For example, the

19:12

researchers from the Athell paper I

19:14

discussed earlier show that you can

19:16

intervene on the model's activations so

19:18

that the model predictably acts like a

19:20

different board. Now, if we

19:22

comprehensively understand the inner

19:24

workings of a model, we could use this

19:26

understanding to evaluate if a model has

19:28

understood the world. But how feasible

19:31

is comprehensive understanding? It turns

19:33

out it's quite challenging. Chris Ola,

19:36

one of the leaders of the field, has

19:38

called this the dark matter of neural

19:40

networks, a large fraction that cannot

19:43

be easily understood or interpreted.

19:45

Neil Nandanda, another leader of the

19:47

field who's now a deep mind, had another

19:49

way to say it. If you're aiming to

19:51

explain 99.9% of a model's performance,

19:55

there's probably going to be a long tale

19:57

of random crap you need to care about.

20:00

We can see why this makes it challenging

20:01

to evaluate world models

20:03

mechanistically. The original GBT paper

20:06

found an emergent nonlinear internal

20:08

representation of board state. A

20:11

follow-up study found that there was

20:12

actually a linear representation and

20:14

that the reason for the discrepancy was

20:16

that a fellow boards can be represented

20:18

to humans in different but equivalent

20:20

ways. But another follow-up found that a

20:23

GBT actually learned a bag of huristics

20:26

instead. not a coherent board, but a

20:29

bundle of rules like if the move A4 was

20:32

just played and B4 is occupied and C4 is

20:35

occupied, update B4 plus C4 plus D4. A

20:39

rule that doesn't generalize across the

20:41

board. And I think this makes clear

20:43

where mechanistic tools are useful

20:45

because fortunately these tools can

20:47

still be used to edit models to make

20:49

specific improvements even if we don't

20:51

have comprehensive understanding. But

20:54

evaluating world models requires

20:56

comprehensive measurement. We want to be

20:58

able to take any general procedure and

21:00

see if it improves a world model. If we

21:03

only understand part of a model, we

21:05

can't compare two models by only looking

21:07

at the parts that we understand. Now,

21:09

another related idea is to study model

21:12

architectures by looking at their

21:13

theoretic capacities. For example, a

21:16

really interesting literature tries to

21:18

understand which formal languages can

21:20

theoretically be recognized by different

21:22

architectures. And these results can

21:24

guide the kinds of ways we use models.

21:27

Another related idea is the use of world

21:29

models in reinforcement learning or RL

21:32

in RL. A world model has a technical

21:35

definition that's somewhat different

21:36

from how I've been using it. A world

21:39

model in RL is a predictive model of an

21:41

environment's dynamics. For example, if

21:43

we want to train an agent to play a

21:45

video game, we may have it develop a

21:47

world model of the game or how its

21:49

actions result in different outcomes.

21:51

These world models are trained on state

21:53

explicitly which differs from our goal

21:55

of evaluating implicit states. And

21:57

moreover, the goal in RL isn't

21:59

necessarily recovering structure. It's

22:02

primarily about making better

22:03

predictions about an environment or

22:05

improving an agent's planning

22:07

capabilities.

22:08

So, we've seen that generative models

22:10

like transformers can do amazing things

22:12

with incoherent world models, but this

22:14

incoherence makes them fragile for other

22:16

tasks. So, where should we go from here?

22:19

One possibility is to accept the fact

22:21

that our world models are imperfect.

22:24

Fortunately, models don't need to have

22:25

correct world models to be useful. So,

22:27

one approach is to zoom in and evaluate

22:29

models in specific places such as based

22:32

on the places where people use them. But

22:34

of course, we should also work on

22:36

improving world models. And there are

22:37

many ways of doing this. One is to

22:39

design new architectures that are

22:41

designed to have better world models.

22:43

And we've seen some promising results

22:45

from state space models. Another

22:47

approach is a neurosy symbolic one,

22:48

combining neural networks with formal

22:50

reasoning modules like probabilistic

22:52

programs. We don't need to stop at new

22:54

architectures. We can also think about

22:56

new training procedures such as those

22:58

that go beyond next token prediction.

23:00

Another possibility is to find better

23:02

ways to incorporate human feedback into

23:04

world model training. Or we can also try

23:07

training models by taking inspiration

23:09

from ideas from causality and causal

23:11

representation learning. Overall, there

23:14

are many promising ways we can work on

23:16

improving world models, and evaluation

23:19

metrics will help get us there.

Interactive Summary

The video discusses the concept of implicit world models within generative AI systems like LLMs. It argues that while these models can achieve high performance on benchmarks and predictive tasks, they often do so without forming a coherent, accurate model of the underlying world, which leads to fragility in novel or altered scenarios. The speaker introduces evaluation strategies and metrics—such as those based on the Myhill-Nerode theorem and inductive bias probes—to test if a model truly captures the structure of a task rather than just relying on superficial patterns. Finally, the video suggests ways forward, including developing new architectures and training procedures that prioritize structural understanding.

Suggested questions

3 ready-made prompts