Emergent Mind

Language Models Represent Space and Time

(2310.02207)
Published Oct 3, 2023 in cs.LG , cs.AI , and cs.CL

Abstract

The capabilities of LLMs have sparked debate over whether such systems just learn an enormous collection of superficial statistics or a set of more coherent and grounded representations that reflect the real world. We find evidence for the latter by analyzing the learned representations of three spatial datasets (world, US, NYC places) and three temporal datasets (historical figures, artworks, news headlines) in the Llama-2 family of models. We discover that LLMs learn linear representations of space and time across multiple scales. These representations are robust to prompting variations and unified across different entity types (e.g. cities and landmarks). In addition, we identify individual "space neurons" and "time neurons" that reliably encode spatial and temporal coordinates. While further investigation is needed, our results suggest modern LLMs learn rich spatiotemporal representations of the real world and possess basic ingredients of a world model.

Space and time neurons in Llama-2 models; projected activations versus true coordinates by entity type.

Overview

  • The paper investigates whether LLMs like the Llama-2 family develop coherent and grounded representations of space and time, using three spatial datasets and three temporal datasets.

  • The study finds that LLMs learn linear representations of space and time that are robust to prompting variations, unified across different entity types, and identifiable through specific neurons.

  • The findings suggest that as LLMs scale, they improve not only in token prediction accuracy but also in the granularity and accuracy of their internal world models, paving the way for future research in AI interpretability.

Language Models Represent Space and Time

In the paper titled "Language Models Represent Space and Time" by Wes Gurnee and Max Tegmark, the authors investigate whether LLMs, specifically the Llama-2 family, develop coherent and grounded representations of the real world. Their exploration is centered around the internal representations of space and time that these models learn. The authors conducted a comprehensive analysis utilizing three spatial datasets (world, United States, and New York City places) and three temporal datasets (historical figures, artworks, and news headlines) to draw their conclusions.

Key Findings

The study provides substantial evidence suggesting that LLMs learn linear representations of space and time at multiple scales. These representations were shown to be:

  1. Robust to Variations in Prompting: The learned representations maintained their utility despite variations in how the questions were posed to the model.
  2. Unified Across Entity Types: The spatial and temporal representations were consistent regardless of the different kinds of entities (e.g., cities, landmarks, or historical figures).
  3. Identifiable Through Specific Neurons: The authors pinpointed individual "space neurons" and "time neurons" that reliably encoded spatial and temporal coordinates.

Experimental Methodology

Datasets

The researchers constructed six datasets covering different spatial and temporal scales:

  • Spatial Datasets: Included place names from the entire world, the United States, and New York City, sourced from DBPedia and other relevant databases.
  • Temporal Datasets: Covered historical figures' death years, the release dates of art and entertainment, and New York Times news headlines.

These datasets were designed to include a mix of entity types and were meticulously filtered to remove noise and obscure entries.

Probing Techniques

The primary method for analyzing the internal representations was probing. Linear regression probes were trained on the LLMs' activations to predict real-world coordinates or timestamps. The results showed that the models could indeed represent these features, and this capability increased with the model size, plateauing around halfway through the layers.

Robustness and Generalization

The study included several robustness checks:

  • Prompt Sensitivity: The representations were shown to be fairly robust to different types of prompts, with minor performance degradation when random or capitalized prompts were used.
  • Cross-Entity Generalization: The models demonstrated strong generalization across different types of entities within the same dataset.
  • Dimensionality Reduction: Probes trained on principal components of the internal activations confirmed the presence of spatial and temporal features even when the dimensionality was significantly reduced.

Moreover, the researchers conducted ablation experiments to verify the role of individual neurons in encoding these features.

Implications and Future Directions

The authors speculate that these linear spatiotemporal representations are foundational elements for more comprehensive world models that LLMs might develop, enabling reasoning about real-world phenomena. The findings have both practical and theoretical implications, suggesting that as models scale, they not only increase in token prediction accuracy but also in the granularity and accuracy of their internal world models.

Future work could dive deeper into understanding the hierarchical structure of these representations. For instance, exploring whether models organize spatiotemporal information into a discretized mesh could enhance our understanding of how these models extrapolate from training data to real-world contexts.

Conclusion

This paper substantiates the notion that LLMs like Llama-2 develop coherent spatiotemporal representations. The results presented, backed by robust experimental methodologies, provide a compelling argument that current LLMs possess the basic ingredients of world models. These findings open numerous avenues for further research in AI interpretability and the development of more sophisticated models capable of intricate world modeling.

Create an account to read this summary for free:

Newsletter

Get summaries of trending comp sci papers delivered straight to your inbox:

Unsubscribe anytime.