Cognitive Map in Large Language Models
Organizations: Department of Physics, Princeton University, Princeton, New Jersey · Princeton Neuroscience Institute, Princeton University, Princeton, New Jersey
Abstract
It has long been proposed that animals construct cognitive maps to support flexible behavior in novel environments. We tested whether large language models form similar representations using relational reasoning tasks and causal "mosaic experiments" that manipulate internal activations in open-weight language models. Models beyond the ten-billion-parameter scale successfully inferred unstated relationships between entities and generalized to synthetic entity names. Across model and task families, models generated abstract representations of relational structure and combined them additively with representations of entity identity, binding entities to roles within that structure. Models stored observed relationships as pairwise links that they composed retrospectively when queried, rather than prospectively positioning each entity in a global coordinate system. Binding was mediated by a sparse, distributed set of key--value pairs; by perturbing these pairs, we implanted "false memories" that altered model behavior in predictable ways. Overall, our findings reveal an internal organization analogous to a cognitive map that explains how language models reason with limited information.
Figures & tables
| Model | Hugging Face repository | Recorded revision |
|---|---|---|
| Gemma 3 4B | google/gemma-3-4b-it | 093f9f388b31de276ce2de164bdc2081324b9767 |
| Gemma 3 12B | google/gemma-3-12b-it | 96b6f1eccf38110c56df3a15bffe176da04bfd80 |
| Gemma 3 27B | google/gemma-3-27b-it | 005ad3404e59d6023443cb575daa05336842228a |
| Llama 3.1 8B Instruct | meta-llama/Llama-3.1-8B-Instruct | 0e9e39f249a16976918f6564b8830bc894c89659 |
| Llama 3.1 70B Instruct | meta-llama/Llama-3.1-70B-Instruct | 1605565b47bb9346c5515c34102e054115b4f98b |
| Qwen3 0.6B | Qwen/Qwen3-0.6B | c1899de289a04d12100db370d81485cdf75e47ca |
| Token index | prompt | prompt | prompt |
|---|---|---|---|
| 126 | Context | Context | Context |
| 127 | : | : | : |
| 128 | ␣Alice | ␣ | ␣ |
| 129 | ␣has | ␣ | ␣ |
| 130 | ␣daughter | ␣ | ␣ |
Cognitive Modeling
Cognitive modeling uses computational theories to explain and predict how people perceive, learn, remember, reason, and decide.
See all 118 papers