Anisotropic Representation Dynamics in Transformers
Organizations: Department of Computer & Information Science & Engineering, University of Florida, Gainesville, FL, USA
Abstract
Small differences between internal representations can shrink or grow as they pass through a Transformer layer, affecting how information is preserved and how sensitive the model is to perturbations. Yet it remains unclear when changes in attention weights can turn a representation difference that would otherwise shrink into one that grows. We develop a Mixture-Gated Theory of Anisotropic Representation Dynamics that separates self-attention into value transport, query gating, and key gating. Our analysis reveals how the geometry of attended representations constrains gating and how interactions between these mechanisms can reverse contraction induced by value transport. We formalize this phenomenon as gating-induced regime switching, where a representation difference contracts under fixed attention routing but expands under full attention. We derive a necessary and sufficient spectral criterion that certifies the existence or absence of switching and identifies switching directions without exhaustive search. Beyond existence, our theory characterizes maximum relative switching strength, certifies the severity of contraction that gating can overcome, and determines the largest dimension of a subspace in which every nonzero direction switches. Experiments across four Transformer architectures validate these predictions through analytical and finite-forward comparisons, revealing distinct and joint query--key gating mechanisms and nontrivial switching subspaces. Our results provide a mechanistic and spectral understanding of how attention routing can alter local representation dynamics.
Figures & tables
| Notation | Meaning |
|---|---|
| Local representation dynamics | |
| Layer index, incoming representation, local perturbation, and Transformer block map. | |
| Block Jacobian, nonzero perturbation direction, and symmetric positive-definite representation metric. | |
| Local growth operator , governing directional expansion and contraction. | |
| Self-attention and query-gating geometry | |
| Token representation; query-token, attended-token, and perturbed-token indices. | |
| Direction | ||||||
| Severe switch |
Transformer
Transformers are neural architectures that use attention to model relationships among sequence elements in language, vision, and scientific data.
See all 524 papers