Transformers learn factored representations
Adam Shai, Loren Amdahl-Culleton, Casper L. Christensen, Henry R. Bigelow, Fernando E. Rosas, Alexander B. Boyd, Eric A. Alt, Kyle J. Ray, Paul M. Riechers
TL;DR
Transformers trained with next-token prediction naturally factor their world into independent parts, representing each factor in orthogonal subspaces and achieving substantial dimensionality reduction. The authors formalize this via generalized hidden Markov models, defining predictive vectors and two representation geometries (joint vs factored), and prove that a lossless factorization exists under conditional independence through a linear mapping to a direct-sum embedding. Through synthetic experiments with five factors (Mess3 and Bloch Walk) and GPT‑2–style transformers, they show that the factored form emerges early, with dimensionality ≈ ∑_n (d_n−1) and approximate orthogonality between factor subspaces, while still allowing a joint representation when needed. They also demonstrate an inductive bias toward factoring, observed even when cross-factor correlations are introduced or noise corrupts observations, and extend findings to RNNs, underscoring potential interpretability benefits from persistent low-dimensional structure in residual streams.
Abstract
Transformers pretrained via next token prediction learn to factor their world into parts, representing these factors in orthogonal subspaces of the residual stream. We formalize two representational hypotheses: (1) a representation in the product space of all factors, whose dimension grows exponentially with the number of parts, or (2) a factored representation in orthogonal subspaces, whose dimension grows linearly. The factored representation is lossless when factors are conditionally independent, but sacrifices predictive fidelity otherwise, creating a tradeoff between dimensional efficiency and accuracy. We derive precise predictions about the geometric structure of activations for each, including the number of subspaces, their dimensionality, and the arrangement of context embeddings within them. We test between these hypotheses on transformers trained on synthetic processes with known latent structure. Models learn factored representations when factors are conditionally independent, and continue to favor them early in training even when noise or hidden dependencies undermine conditional independence, reflecting an inductive bias toward factoring at the cost of fidelity. This provides a principled explanation for why transformers decompose the world into parts, and suggests that interpretable low dimensional structure may persist even in models trained on complex data.
