Self-Models, Body Schemas, and Affordances › Modeling Other Agents and Theory of Mind

Michael BrenndoerferJune 18, 202611 min read
World Models HandbookAll chapters
Part 3 of 12Representing Agents and Worlds
Chapter 18Self-Models, Body Schemas, and Affordances › Modeling Other Agents and Theory of Mind
Reading section 5 of 11 · Modeling Other Agents and Theory of Mind · 11 minSection 5 of 11 · 11 min

Book contents

Section 5 of 11 · 11 min read

Self-Models, Body Schemas, and Affordances › Modeling Other Agents and Theory of MindOne section · Sections in this chapter5 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

So far, "the agent" has been singular. Real environments contain other agents: people in a kitchen, cars at an intersection, collaborative robots on a line. They are not passive matter. They may act toward goals and react to us, with beliefs or intentions that no sensor reads directly. When those hidden variables materially change behavior, representing them can improve prediction and planning. Simpler reactive motion models may still be adequate for short horizons or weakly coupled encounters; the need for mental-state structure depends on the interaction.

The error is structured rather than merely independent noise, but it does not have a universal sign. A constant-velocity pedestrian model is wrong when the pedestrian notices the robot and adjusts; whether it over- or under-predicts progress depends on whether the person slows, accelerates, or changes direction. A robot that assumes people will yield can also behave in ways that force them to yield, degrading safety and cooperation. In interactions where such responses matter, goal- or belief-conditioned variables offer information that a momentum-only model omits.

Theory of Mind

Theory of mind is the capacity to attribute unobservable mental states (goals, beliefs, intentions, preferences) to other agents and to use those attributions to predict and explain their behavior. Premack and Woodruff introduced the term in their 1978 question "Does the chimpanzee have a theory of mind?"; in computational form it becomes probabilistic inference over latent mental variables.

The phrase "theory of" in the name is apt: the observer holds an inferential model, not a direct record of another mind. Predictive performance is one important criterion for that model. Causal and representational validity matter as well when the goal is explanation, intervention, or transfer rather than trajectory forecasting alone. This is why the evaluation difficulties discussed in Limitations cannot be reduced to a single prediction score.

Other agents as latent structure in the world model

The modeling move is one you have already made twice in this book: treat another agent's mental state as a latent variable in a partially observable model, and infer it from behavior. This resembles inferring a hidden state in Bayesian Filtering and Belief States or a hidden physical parameter from motion. What changes is the interpretation and transition model: the latent may denote a goal or belief, and the observer adds a behavioral or policy model alongside the physical dynamics. That policy may be habitual, boundedly rational, or task-specific rather than perfectly rational. In the framework of Bayesian Filtering and Belief States, the observer's belief now factorizes as

bt(z1:t,g1:t)∝  p(o1:t∣z1:t,g1:t)  p(z1:t,g1:t),b_t(z_{1:t}, g_{1:t}) \propto \; p(o_{1:t} \mid z_{1:t}, g_{1:t})\; p(z_{1:t}, g_{1:t}),

where:

  • bt(z1:t,g1:t)b_t(z_{1:t}, g_{1:t}): the observer's belief, a posterior distribution over the closed-loop state trajectory z1:tz_{1:t} and the other agents' latent mental-state trajectory g1:tg_{1:t}
  • o1:to_{1:t}: the observations accumulated from time 11 through tt
  • z1:tz_{1:t}: the closed-loop state trajectory through time tt
  • g1:tg_{1:t}: the trajectory of the other agents' latent mental states (goals, beliefs, intentions); gtg_t collects their values at time tt
  • p(o1:t∣z1:t,g1:t)p(o_{1:t} \mid z_{1:t}, g_{1:t}): the likelihood of the observed history under a given state and mental-state trajectory
  • p(z1:t,g1:t)p(z_{1:t}, g_{1:t}): the joint prior over the closed-loop state trajectory and the mental-state trajectory, encoding the initial distribution and the transition dynamics

This is Bayes' rule over trajectories: the posterior weight on a hypothesis about the world and the other agents' minds is proportional to how well that hypothesis explains the observed history, scaled by its prior probability. Note what is being conditioned on and what is being inferred: the observer never sees gtg_t directly, only its behavioral shadows, the actions the other agent takes. The whole apparatus of theory of mind lives inside the likelihood term, which encodes the observer's model of how minds produce actions. If that model says agents act efficiently toward their goals, then observed efficient motion is evidence for the goal it serves; if the model says agents avoid what they believe to be dangerous, then observed avoidance is evidence about their beliefs. Change the behavioral model and you change which mental states the same behavior supports, which is why the behavioral model, not the Bayesian update, is where most of the modeling content resides.

The transition model must then close the loop: the other agent's actions are generated by their policy, which depends on their latent state, so the full transition becomes

atj∼πj(⋅∣btj,gt),zt+1=F(zt,atself,atj)+wt,\begin{aligned} a^j_t &\sim \pi^j(\cdot \mid b^j_t, g_t), \\ z_{t+1} &= F(z_t, a^{\text{self}}_t, a^j_t) + w_t, \end{aligned}

where:

  • atja^j_t: the other agent's action at time tt
  • πj(⋅∣btj,gt)\pi^j(\cdot \mid b^j_t, g_t): agent jj's policy, a distribution over actions conditioned on its belief btjb^j_t and its latent mental state gtg_t
  • btjb^j_t: agent jj's own belief at time tt, its posterior over the closed-loop state and the mental states it attributes to others
  • atselfa^{\text{self}}_t: the self-agent's own action at time tt
  • wtw_t: the process noise in the closed-loop dynamics

This is the formal heart of theory of mind in a world model: the environment's dynamics contain a term that is itself a policy conditioned on a hidden belief. Note the immediate consequence: from the self-agent's perspective, the environment is nonstationary. The other agent's policy changes as their beliefs change, often because of the self-agent's actions. This is the same nonstationarity that forced multi-agent frameworks like I-POMDPs (interactive POMDPs) to recursively nest belief representations.

It is worth tracing exactly how the self-agent's actions leak into the other agent's policy, because the pathway is indirect and easy to lose. The self-agent acts; the action changes the world; the other agent observes the changed world; the observation shifts their belief btjb^j_t; the shifted belief changes the distribution over their next action; the action enters the shared transition FF. The self-agent's influence on the other's mind therefore travels through the environment, with a lag, and the other agent's response travels back the same way. This two-hop causal path is what makes interaction qualitatively different from mere coexistence in a shared space:

The difference between a physics-only predictor and a response-aware predictor can be illustrated with a synthetic corridor simulation. The simulated pedestrian slows when the robot approaches. The constant-velocity baseline ignores that response, while the second predictor uses a deliberately slightly misspecified yielding rule based only on the robot-distance sequence available at prediction time.

In[9]:
Code
## Pedestrian at position 15 walking toward 0 (exit); slows while still far
## from the terminal boundary when the robot nears.
ped_pos = [15.0]
robot_dist = [8.0]
for t in range(20):
    d = robot_dist[-1]
    speed = 0.8 if d > 3 else 0.15  # pedestrian yields when robot close
    ped_pos.append(max(0.0, ped_pos[-1] - speed))
    robot_dist.append(max(0.0, d - 0.9))  # robot approaches steadily

ped_pos = np.array(ped_pos)
t_steps = np.arange(len(ped_pos))

## Physics-only prediction made at t=0: constant velocity from first steps
v0 = ped_pos[0] - ped_pos[1]
phys_pred = np.clip(ped_pos[0] - v0 * t_steps, 0.0, None)
## Response-aware prediction made at t=0 from an approximate yielding rule.
## Its threshold and speeds differ from the data generator, so it is not an oracle.
belief_pred = [ped_pos[0]]
for d in robot_dist[:-1]:
    modeled_speed = 0.75 if d > 3.2 else 0.20
    belief_pred.append(max(0.0, belief_pred[-1] - modeled_speed))
belief_pred = np.array(belief_pred)

phys_err = np.abs(phys_pred - ped_pos)
belief_err = np.abs(belief_pred - ped_pos)
Out[10]:
Visualization
Two lines comparing error growth for constant-velocity and response-aware pedestrian predictors.
Synthetic rollout error for a constant-velocity baseline versus a response-aware predictor with a slightly misspecified yielding rule.

In the chapter's hierarchy, two level-0 agents may react only after their motion models register a conflict, while level-1 agents can anticipate some responses from inferred goals. The resulting nonstationarity is not arbitrary drift: it comes from another decision process responding to observations. A model that tracks a useful hypothesis about that process can predict part of the change instead of treating it all as noise.

Levels of reasoning

For this chapter, it helps to use a local hierarchy for how deeply the model represents other minds. Other level-kk and cognitive-hierarchy conventions define the levels differently:

  • Level 0: model other agents as moving objects with dynamics. This can be adequate for short horizons and weak coupling, but it may fail when safe behavior depends on predicting how the other agent will respond.
  • Level 1: attribute goals and predict actions from goals, as in inverse planning: an agent's action is likely if it efficiently achieves some goal. Our worked example below is exactly level-1 goal inference.
  • Level 2 and beyond: attribute beliefs about beliefs. "The pedestrian thinks I see them, so they will cross, so I should slow down." Formally, the other agent's belief bjb^j includes a model of me, so my model of them must include their model of me. Recursive level-kk reasoning grounds game-theoretic solution concepts, and interactive POMDPs make the recursion explicit.

Each added level pays for representational depth with computation and new opportunities for error. The chapter's level 0 is weakest when behavior responds to the focal agent, while level 1 can represent goal-directed responses but not coordination driven by beliefs about what others know. Level 2 adds that higher-order structure and immediately raises the question of where to stop. Shallow recursive models are computationally practical and often explain behavior in experimental games, but useful depth is task-dependent; deeper reasoning is not confined to adversarial or high-stakes settings.

The recursion cannot go infinite, so practical agents truncate at some level and may combine shallow deliberate reasoning with fast reactive models. The reactive layer can handle routine, weakly coupled motion, while deeper modeling is reserved for interactions where another agent's response changes the decision. An autonomous-driving stack might therefore use constant-velocity prediction for distant cars, goal inference for cars at an intersection, and belief attribution for a pedestrian whose decision depends on whether they have been seen. This is an allocation decision whose adequacy must be tested against the scenarios the vehicle faces.

Why world models need other-agent models

Three concrete payoffs justify the complexity:

  • Prediction quality in interaction. In multi-agent scenes, the marginal distribution of others' motion depends on the self-agent's plan. A model that conditions others' behavior on the self-agent's intended actions makes fundamentally different (and better) predictions than one that does not.
  • Communication and cooperation. Handing someone a cup requires modeling what they know about the handover and when they will close their hand. That is a belief-tracking problem before it is a motor problem.
  • Safety. Many failures of deployed agents come from under-modeling people: treating a human as a static obstacle produces plans that are technically feasible and socially disastrous. Over-modeling has a mirror-image failure, which we return to in Limitations.

The first payoff deserves emphasis. When another agent materially responds to the focal agent, the environment's transition distribution depends on the focal agent's behavior. Omitting that dependence then structurally misspecifies the interaction model rather than merely adding observation noise. Weakly coupled scenes and short horizons may still admit a useful simpler approximation, so the modeling depth should follow the sensitivity of the decision to the other agent's response.

There is also an introspective payoff. A self-model that includes "what others can observe about me" supports epistemic behaviors like signaling, feinting, and privacy, and it is the seed of the social self. Notice that this closes a loop with the beginning of the chapter: the agent-environment boundary, introduced as a private modeling choice, has a public counterpart, since other agents maintain their own models of what lies inside ours. An agent that represents the fact that it is in someone else's environment model has crossed from modeling the world to modeling itself as part of the world. We will revisit agent models at foundation scale in Part IX: Foundation and World-Action Models. Some foundation models display theory-of-mind-like behavior on particular benchmarks, but performance is uneven, and neither the underlying mechanism nor the construct validity of those benchmarks is settled.