Language Models Solve a Classic Theory-of-Mind Task Using Domain-General Mechanisms for Divergence Detection
Abstract
Large Language Models (LLMs) successfully solve tasks that require reasoning about the truth or falsity of an agent's beliefs, classically used to assess whether a system has theory of mind. However, how LLMs solve these tasks remains unclear. Do they deploy circuitry specialized for reasoning about other minds, memorize common false-belief vignette structures and outputs, or rely on more domain-general computations? We investigate this question primarily in Qwen2.5-14B-Instruct, with selected analyses in Gemma-2-27B-it, using causal mediation and representational similarity analyses across matched prompt sets. A population of mid-layer attention heads tracks divergence between a representation and the current state of the world. A distinct population of later-layer heads retrieves the answer token, and the two populations combine compositionally to determine the output. Notably, this signature holds across structurally similar tasks that differ heavily in content: tasks that require no perspective-taking (true vs. false photographs) and tasks that neither describe situations nor use natural language (aliasing vs. copying variables in python code). These findings show the importance of domain-general contributions to classic false-belief performance in LLMs, while leaving open additional belief-specific computations.