Transformers learn factored representations

Adam Shai, Loren Amdahl-Culleton, Casper L. Christensen, Henry R Bigelow, Fernando Rosas, Alexander Boyd, Eric A. Alt, Kyle J Ray, Paul M. Riechers

TL;DR

This paper investigates how large language models (LLMs) like transformers learn to represent complex information by breaking it down into simpler "parts." They propose and experimentally validate that transformers naturally develop "factored representations" in orthogonal subspaces, which is a more efficient way to store information than a monolithic representation, even when it slightly sacrifices accuracy. This finding offers a principled explanation for why transformers can learn from complex data and suggests that interpretable low-dimensional structures are inherent to their learning process.

What Problem Does This Paper Address?

The paper tackles a fundamental question in understanding LLMs: how do these models, trained on vast amounts of sequential data, manage to represent the complex, structured world described by that data? Specifically, it addresses the "black box" nature of transformers by asking if they learn to decompose information into meaningful "parts" or factors, analogous to how humans understand the world. The authors hypothesize that transformers might learn to represent these factors in distinct, orthogonal subspaces within their internal activations, leading to a more efficient and interpretable representation. This contrasts with a less efficient "joint" representation where all factors are intertwined. The core challenge is to empirically verify this "factored world hypothesis" and understand the geometric properties of these learned representations.

Methods

The authors develop a theoretical framework that connects the structure of the data-generating process to the geometry of transformer activations. They formalize two hypotheses: a "joint" representation in a product space (exponentially growing dimension) and a "factored" representation in orthogonal subspaces (linearly growing dimension). They then design synthetic datasets with known latent structures (e.g., independent or conditionally independent factors) to train transformers.

Key techniques include:

  • Generalized Hidden Markov Models (GHMMs): Used to model the data-generating processes, allowing for complex dependencies.
  • Predictive Vector Geometry: Analyzing the geometry of "predictive vectors" (representing beliefs about future tokens) to understand how contexts map to predictions.
  • Activation Geometry Analysis: Using Principal Component Analysis (PCA) and Cumulative Explained Variance (CEV) to quantify the dimensionality and structure of transformer activations.
  • Vary-One Analysis: A novel technique to isolate the contribution of individual factors by varying only one factor's subsequences while keeping others fixed, allowing for the identification of factor-specific subspaces.
  • Regression Analysis: Employed to probe the relationship between transformer activations and ground-truth predictive vectors, and to identify factor subspaces.
  • Subspace Overlap Metric: Quantifying the orthogonality between learned factor subspaces.

Datasets

The paper does not use standard benchmark datasets. Instead, it relies on synthetically generated datasets designed to have specific latent structures. These datasets are created by composing elementary stochastic processes (Mess3 factors and Bloch Walk factors) to simulate scenarios with:

  • Independent Factors: Five processes running in parallel, emitting tokens independently.
  • Conditionally Independent Factors: A chain of dependencies where factors influence each other's dynamics, but the overall structure allows for factorization.
  • Noised Factors: Introducing noise to break perfect conditional independence, creating a trade-off between factored representation efficiency and predictive fidelity.

These synthetic datasets are crucial for precisely controlling the ground truth structure and testing the authors' hypotheses.

Key Insights and Ideas

  • Factored Representations as an Inductive Bias: Transformers don't just can learn factored representations when it's optimal; they actively seek them. This is demonstrated by their preference for factored representations even when it slightly hurts predictive accuracy (i.e., when factors are not perfectly independent).
  • Orthogonal Subspaces for Factors: The learned representations for different factors are organized into distinct, orthogonal subspaces within the transformer's residual stream. This is a key geometric signature of factorization.
  • Dimensionality Savings: Factored representations offer significant dimensionality reduction compared to joint representations, especially as the number of factors increases. This is crucial for efficient learning in high-dimensional spaces.
  • Factorization Starts Early: The process of factorization begins at the token embedding layer, suggesting it's a fundamental mechanism utilized throughout the network.
  • Robustness to Noise and Dependencies: While perfect factorization is ideal, transformers can still learn and maintain factored representations even when the data is noisy or dependencies exist, albeit with a gradual expansion of dimensionality to recover fidelity.

Key Results

  • Empirical Confirmation of Factored Representations: Experiments consistently show that transformers learn representations that align with the predicted geometry of factored representations, using significantly fewer dimensions than a joint representation would require. For example, in the independent factors case, the model converged to a 10-dimensional factored representation instead of the 242-dimensional joint representation.
  • Orthogonality of Subspaces: Analysis using the "vary-one" method and subspace overlap metrics confirmed that the learned factor subspaces are largely orthogonal.
  • Preference for Factoring: Even when introducing noise (ɛ > 0), transformers initially converge to a factored representation before gradually expanding dimensionality to improve performance. This suggests an inductive bias rather than simply finding the lowest-loss solution.
  • RNNs and LSTMs Also Factor: The phenomenon of learning factored representations is not exclusive to transformers; RNNs and LSTMs also exhibit this behavior, suggesting it's a more general property of recurrent architectures.

Limitations and Future Work

  • Quantifying the Inductive Bias: The authors acknowledge that the strength of the inductive bias towards factoring is not yet precisely quantified.
  • Capacity Limitations: An open question is whether transformers would still factor representations if they lacked the capacity to hold the full joint representation.
  • Architectural Bottlenecks: Future work could involve identifying specific architectural components responsible for this factoring behavior.
  • Interpretability Tools: The discovery of low-dimensional factored subspaces opens avenues for developing new unsupervised interpretability tools to understand these subspaces.
  • Extrapolation to Larger Models: The authors suggest that the factored world hypothesis is likely to extrapolate to larger models, offering hope for understanding complex LLMs.

Summary updated

BibTeX
@inproceedings{shai2026transformers,
  author = {Adam Shai and Loren Amdahl-Culleton and Casper L. Christensen and Henry R Bigelow and Fernando Rosas and Alexander Boyd and Eric A. Alt and Kyle J Ray and Paul M. Riechers},
  title = {{Transformers learn factored representations}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=flDGB9On0h},
}
Figure