Lines of Thought in Large Language Models

Raphaël Sarfati, Toni J.b. Liu, Nicolas Boulle, Christopher Earls

Abstract: Large Language Models achieve next-token prediction by transporting a vectorized piece of text (prompt) across an accompanying embedding space under the action of successive transformer layers. The resulting high-dimensional trajectories realize different contextualization, or 'thinking', steps, and fully determine the output probability distribution. We aim to characterize the statistical properties of ensembles of these 'lines of thought.' We observe that independent trajectories cluster along a low-dimensional, non-Euclidean manifold, and that their path can be well approximated by a stochastic equation with few parameters extracted from data. We find it remarkable that the vast complexity of such large models can be reduced to a much simpler form, and we reflect on implications.

Introduction

Despite their ubiquitous success, Large Language Models (LLMs) remain largely black boxes. While it is known that they map text to high-dimensional vectors and pass them through successive transformer layers, how these billions of microscopic arithmetic operations collectively generate coherent language is poorly understood. Most interpretability research attempts to find meaning in specific neurons, attention heads, or semantic directions.

This paper takes a macroscopic, physics-inspired approach. Instead of examining the microscopic "if-then" mechanics, the authors investigate whether there are large-scale, statistical properties governing how ensembles of token trajectories—termed "lines of thought"—flow through the model's latent space. The core question is whether the seemingly chaotic high-dimensional transport of tokens can be reduced to simpler, predictable mathematical rules.

Methodology

To study these trajectories, the authors generated thousands of text chunks from Henry David Thoreau’s Walden (split into 50-token "pseudo-sentences") and passed them through an LLM. They tracked the hidden states of the final "pilot" token at each transformer layer, creating a dataset of high-dimensional trajectories. A gibberish baseline of random tokens was also used to compare the latent pathways of actual language versus non-language. The primary model evaluated was GPT-2 Medium (355M), with validations on Llama 2 7B, Mistral 7B v0.1, and Llama 3.2.

Instead of analyzing these paths in standard Cartesian coordinates, Singular Value Decomposition (SVD) was applied at each layer to find the intrinsic, data-driven principal components of the token ensemble.

The movement of tokens from one layer to a future layer was then modeled using a linear approximation consisting of:

  1. A rotation matrix (capturing how principal directions shift).
  2. A stretch matrix (capturing how variance along those directions changes).
  3. A stochastic noise term (accounting for individual token deviation).

Finally, this discrete layer-by-layer process was interpolated into continuous time using Langevin dynamics and a Fokker-Planck equation, effectively modeling the transformer stack as a continuous diffusion process with a predictable drift.

Key Findings

Low-Dimensional "Highways"

Token trajectories do not scatter randomly in the high-dimensional latent space. Instead, they form tight bundles traveling along a curved, low-dimensional manifold.

Token trajectories forming tight bundles and clustering on a low-dimensional manifold.

The 25% Rule and Dimensionality Reduction

For GPT-2, which features a 1024-dimensional latent space, keeping only the top 256 principal components at each layer is sufficient to recover the final output probability distribution with minimal loss. The remaining 75% of dimensions are largely irrelevant for next-token prediction.

Singular value decay and KL divergence showing that only a fraction of principal components are needed.

Transformers as Stochastic Drift

The astronomically complex mathematics of a transformer layer can be macroscopically approximated by a simple linear transformation combined with isotropic Gaussian noise. The deterministic "drift" represents the average pathway of language, while the individual variability (the "noise" term) appears to encode the specific semantic meaning of individual prompts. Notably, untrained models do not exhibit this behavior; their tokens move in straight, parallel lines or diffuse aimlessly, indicating that the "physics" of the latent space is a learned property.

High Approximation Accuracy and Predictable Noise

The stochastic model accurately predicts token positions deep in the network. A linear classifier trained to distinguish between true token positions and extrapolated positions (using the mathematical model) achieves only 50-60% accuracy, meaning the approximation is nearly indistinguishable from the real transformer output. Furthermore, the residual noise term is highly predictable: it is Gaussian, isotropic (lacking spatial cross-correlations), and its variance scales exponentially with layer depth.

Detecting Fine-Tuning Anomalies

When testing newer models like Mistral 7B and Llama 3.2, the same general trajectory rules applied. However, a distinct "anomaly" was discovered at the very last layer where variance spikes and the linear approximation breaks down. The authors hypothesize this is a geometric signature of fine-tuning or alignment processes (such as RLHF) that heavily impact the final layers.

Limitations and Future Directions

A primary limitation of this method is that it requires access to internal hidden states, making it unsuitable for closed-source APIs. Additionally, connecting these latent trajectories directly to the final vocabulary output is mathematically complex due to the highly non-linear LayerNorm applied right before the final projection. The continuous-time interpolation between layers also serves mainly as a mathematical convenience rather than holding direct interpretive value.

Looking forward, the authors suggest this continuous-time dynamical view could pave the way for highly efficient "hybrid" architectures. If the deterministic "average path" of a prompt can be computed by a simple differential equation, future models might delegate only the variable "meaning" component to a much smaller neural network, potentially drastically reducing compute requirements.

Summary updated

BibTeX
@inproceedings{sarfati2025lines,
  author = {Raphaël Sarfati and Toni J.B. Liu and Nicolas Boulle and Christopher 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