Lines of Thought in Large Language Models

Raphaël Sarfati, Toni J. B. Liu, Nicolas Boullé, Christopher J. Earls

TL;DR

Large Language Models (LLMs) are often viewed as inscrutable "black boxes," but this paper reveals that their internal "thinking" process follows surprisingly simple, low-dimensional paths. By treating an LLM as a physical dynamical system, the researchers show that token trajectories cluster along a specific manifold and can be accurately modeled using a physics-inspired stochastic differential equation.

What Problem Does This Paper Address?

While we understand the architecture of transformers—the "if-then" logic of self-attention and feed-forward layers—we lack a "macroscopic" understanding of how information is actually transformed as it travels through dozens of layers. The sheer scale of these models (billions of parameters and astronomical numbers of arithmetic operations) makes traditional interpretability difficult.

The authors seek to move past "microscopic" details (like individual neuron activations) to find the statistical laws governing how a model "transports" a prompt through its latent space to arrive at a prediction. They ask: Is there a simpler mathematical form that describes the "Line of Thought" (LoT) an LLM takes?

Methods

The researchers analyzed the "trajectories" of tokens—specifically the "pilot" token used for next-token prediction—as they pass through successive transformer layers.

  1. Latent Space Analysis: They used Singular Value Decomposition (SVD) to identify the intrinsic basis of the high-dimensional embedding space.
  2. Dynamical Modeling: They proposed a model where a token's position at a future layer is a linear transformation of its current position (involving a rotation matrix $R$ and a stretch matrix $\Lambda$) plus a stochastic "noise" term $w$.
  3. Langevin Dynamics: To treat the process as continuous, they derived a Langevin equation (a staple of statistical physics) to describe the movement. This allows them to treat the LLM's computation as a diffusive process with a linear drift.
  4. Comparison: They tested this model across various architectures, including GPT-2, Llama 2, Mistral, and Llama 3.2, comparing trained models against untrained (randomly initialized) "null" versions.

Datasets

  • Primary Corpus: Henry David Thoreau’s Walden, sourced from Project Gutenberg. The text was chopped into "pseudo-sentences" of 50 tokens to create an ensemble of trajectories.
  • Null Baselines: They generated "gibberish" sequences (random tokens) to see if the observed structures were a property of language or just the model's architecture.
  • Models: GPT-2 (355M), Llama 2 (7B), Mistral 7B v0.1, and Llama 3.2 (1B and 3B).

Key Insights and Ideas

  • The "Ribbon" Manifold: Instead of spreading out chaotically in the high-dimensional embedding space, token trajectories cluster into a tight, low-dimensional, non-Euclidean "bundle."
  • Dimensionality Collapse: In GPT-2 (which has a 1024-dimensional latent space), the authors found that the model's "thinking" is effectively quasi-256-dimensional. About 75% of the latent space dimensions can be discarded with minimal impact on the final output distribution.
  • Collective vs. Individual: The "average" path (the linear transformation) represents the collective processing the model applies to all tokens. The "noise" or variability around that path is where the specific, contextual "meaning" of a token likely resides.
  • Emergent Physics: The fact that a complex neural network can be reduced to a simple stochastic equation suggests that LLMs behave like large-scale physical systems (like gases or bird flocks), where simple macroscopic properties emerge from complex microscopic interactions.

Key Results

  • High Predictive Accuracy: The simple linear-plus-noise model (Eq. 1 in the paper) is remarkably accurate. A linear classifier trained to distinguish between "real" trajectories and those simulated by the authors' equation performed at only 50-60% accuracy—barely better than a coin flip.
  • Training Matters: In untrained models, tokens move in straight, quasi-parallel lines. The curved, clustered "Lines of Thought" only emerge after the model has been trained on language.
  • Layer Anomalies: The researchers discovered that in modern models (Llama, Mistral), the very first and very last layers often deviate from the statistical norm of the middle layers. This suggests these layers perform specialized "re-alignment" or "output-tuning" tasks that differ from the core "thinking" process.

Limitations and Future Work

  • Open-Source Only: This method requires access to "hidden states," meaning it cannot currently be applied to closed-source models like GPT-4 or Claude.
  • The "Last Mile" Problem: The study focuses on the latent space but notes that connecting these trajectories to the final vocabulary projection is difficult due to the highly non-linear "LayerNorm" step that precedes the output.
  • Hybrid Architectures: The authors suggest a provocative future direction: if the deterministic part of a trajectory can be described by a simple equation, we might design hybrid models where the "average" path is hard-coded, leaving the neural network to focus only on the "meaningful" variability. This could lead to much smaller, more efficient models.

Summary updated

BibTeX
@inproceedings{sarfati2025lines,
  author = {Raphaël Sarfati and Toni J. B. Liu and Nicolas Boullé and Christopher J. Earls},
  title = {{Lines of Thought in Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=zjAEa4s3sH},
}
Figure