Towards Machine Theory of Mind with Large Language Model-Augmented Inverse Planning

Rebekah A. Gelpí, Eric Xue, William A CunninghamSubmission to ICLR 2025 · Rejected

TL;DR

LLM-Augmented Inverse Planning (LAIP) combines the generative power of large language models with formal Bayesian inverse planning to infer agents' hidden mental states (beliefs and desires). By using the LLM to hypothesize possible mental states and candidate actions while relying on Bayesian updates to evaluate observations, LAIP overcomes the frame problem of classical models and eliminates the brittle reasoning shortcuts common in end-to-end LLMs.

What Problem Does This Paper Address?

Theory of Mind (ToM)—the capacity to infer the unobserved beliefs, desires, and intentions driving someone else’s behavior—is central to human cooperation. Building artificial agents with ToM has historically run into two separate walls:

  1. Bayesian Inverse Planning / Inverse Reinforcement Learning: Formulates ToM as inverting an agent's decision-making process (POMDPs). While these models align tightly with human cognitive data, they suffer from the frame problem: researchers must hand-code small, rigid hypothesis and action spaces. They cannot scale to natural, open-ended environments.
  2. End-to-End LLMs: While LLMs perform decently on canned ToM benchmarks, they are notoriously brittle. They rely on superficial heuristics (such as outcome bias: assuming an agent prefers whatever it ended up eating, ignoring constraints or false beliefs) and fail when scenarios are trivially perturbed.

The authors ask: Can we use LLMs as open-ended hypothesis and action generators within a rigorous Bayesian inverse planning framework to get the best of both worlds?

Methods

The authors introduce LAIP (LLM-Augmented Inverse Planning):

[World State] ──> LLM generates Hypotheses H & Prior P(H)
      │
      ├──> For each H_k: LLM simulates candidate actions & computes likelihood P(A|H_k)
      │
[Agent Action O] ──> Bayesian Update: P(H|O) ∝ P(A|O) · P(A|H) · P(H)
  1. Hypothesis & Prior Generation: Given the environment, an LLM samples a candidate set of mutually exclusive hypotheses $H$ regarding the target agent's preferences, along with initial prior probabilities $P(H)$.
  2. Likelihood Computation: At each timestep $t$, the LLM takes the target agent's perspective given its current state/knowledge, generates plausible actions $A$, and estimates action likelihoods $P(A_j \mid H_i)$.
  3. Bayesian Filtering: When the agent takes an observed action $O$:
  4. In constrained environments, the posterior $P(H \mid O)$ is calculated analytically via Bayes' rule.
  5. In open-ended action spaces, the model measures the semantic cosine similarity between the observed action and the LLM’s generated action set, $S(O, A_i)$, normalizes via softmax, and updates: $$P(H \mid O) = \text{softmax}(S(O, A_i)) P(A \mid H) P(H)$$

Datasets

The authors evaluate LAIP across three settings:

  • Restaurants Task (Gridworld Navigation): Adapted from the classic benchmark in Baker et al. (2011). Agents navigate a multi-room floorplan with partial visibility to choose among Chinese, Mexican, and Japanese restaurants that may be open or closed. Evaluated on 10 diverse trajectories testing different preference orderings and visibility conditions.
  • MMToM-QA (Jin et al., 2024): A benchmark of 300 complex multimodal scenarios where an agent searches for household items in an apartment. The paper evaluates the text-based goal inference tracks (Goal-True, Goal-False, Goal-Updated, Goal-Future).
  • Unconstrained Coworker Vignettes: A newly introduced naturalistic narrative task where agent "Carol" must deduce coworker "Alice's" dietary preferences across four realistic scenes involving context constraints (e.g., food court, sickness, small town with only fast food).

Key Insights and Ideas

  • LLMs as Proposal Engines, Bayes for Inference: LLMs struggle with multi-step probabilistic arithmetic and frequently fall into cognitive shortcuts. Separating the LLM into a sampler (generating plausible thoughts and candidate actions) and offloading the inference to Bayes' rule dramatically outperforms pure prompt-based reasoning.
  • Smaller Models Benefit the Most: Decomposing ToM into generative simulation and symbolic Bayesian updates yielded massive gains for smaller models (e.g., Gemma 2, Mixtral, LLaMA 3-8B). For instance, Gemma 2 improved significantly when posterior updates were offloaded mathematically ($d = 1.59, p = .007$) compared to computing them inside the model.
  • Diagnostic Understanding of Negative Constraints: When an agent only has access to fast food in a remote town, or eats plain crackers while sick, standard LLMs infer that the agent loves fast food or plain food. LAIP explicitly conditions likelihoods on environmental constraints, recognizing when an observed action is uninformative about true preferences.

Key Results

  • Alignment with Bayes-Optimal Ground Truth (Restaurants Task):
  • Full LAIP achieved near-perfect correlation with the analytical optimal model across all LLMs ($r \ge 0.546$, with GPT-4o reaching $r = 0.943$ and GPT-4o-mini reaching $r = 0.960$).
  • In contrast, generic Chain-of-Thought (CoT), Zero-Shot baselines, ReAct, and Reflexion all failed to correlate significantly ($r \le 0.264$, often negative).
  • When the preferred Japanese restaurant was closed, LAIP correctly placed 48.4% posterior on the target hypothesis ($H_2$), whereas Zero-shot CoT placed 11.9%, ReAct placed 3.7%, and Reflexion placed 0.3%.
  • MMToM-QA Goal Inference:
  • LAIP with GPT-4 achieved 67.5% overall accuracy, outperforming zero-shot GPT-4 (34.0%), Sim-ToM (40.7%), Symbolic-ToM (47.7%), and BIP-ALM with fine-tuned GPT-J (61.7%).
  • On the difficult Goal-Updated subset, LAIP reached 80.4% accuracy (compared to 2.7% for baseline GPT-4).
  • Open-Ended Action Spaces:
  • In the coworker lunch scenario, LAIP correctly assigned a 37.1% posterior to Alice’s true underlying preferences (Thai/Indian), compared to just 4.7% for the zero-shot baseline, which fell prey to context distractors and assigned 62.2% to "plain/comfort food."

Limitations and Future Work

  • Inference Latency & Cost: Calling an LLM to evaluate action likelihoods across multiple hypotheses at every timestep scales linearly with the number of hypotheses, making it computationally expensive.
  • Fixed Hypothesis Sets: The current implementation fixes hypothesis sets upfront. The authors suggest integrating Sequential Monte Carlo (SMC) / Particle Filtering to dynamically sample, prune, and re-propose hypotheses on the fly.
  • LLM Bias Propagation: Because candidate hypotheses and actions are sampled from pre-trained language models, there is a risk of generating socially biased or stereotypical hypotheses about human actors, which the Bayesian filter could subsequently entrench.

Summary updated

Abstract

We propose a hybrid approach to machine Theory of Mind (ToM) that uses large language models (LLMs) as a mechanism for generating hypotheses and likelihood functions with a Bayesian inverse planning model that computes posterior probabilities for an agent’s likely mental states given its actions. Bayesian inverse planning models can accurately predict human reasoning on a variety of ToM tasks, but these models are constrained in their ability to scale these predictions to scenarios with a large number of possible hypotheses and actions. Conversely, LLM-based approaches have recently demonstrated promise in solving ToM benchmarks, but can exhibit brittleness and failures on reasoning tasks even when they pass otherwise structurally identical versions. By combining these two methods, our approach leverages the strengths of each component, closely matching optimal results on a task inspired by prior inverse planning models and improving performance relative to models that utilize LLMs alone or with chain-of-thought prompting. We also exhibit the model’s potential to predict mental states on open-ended tasks, offering a promising direction for future development of ToM models and the creation of socially intelligent generative agent models.
BibTeX
@misc{gelpi2025towards,
  author = {Rebekah A. Gelpí and Eric Xue and William A Cunningham},
  title = {{Towards Machine Theory of Mind with Large Language Model-Augmented Inverse Planning}},
  year = {2025},
  eprint = {2507.03682},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.03682},
}
Figure