The emergence of clusters in self-attention dynamics
Borjan Geshkovski, Cyril Letrouit, Yury Polyanskiy, Philippe Rigollet
TL;DR
The paper develops a rigorous dynamical-systems view of Transformer self-attention by treating tokens as interacting particles with fixed weight matrices. It proves that, depending on the spectrum of the value matrix $V$, tokens asymptotically cluster into distinct geometric objects: in 1D the self-attention matrix converges to a low-rank Boolean form, in the $V=I_d$ case tokens approach the vertices of a shrinking convex polytope, and with a simple positive leading eigenvalue tokens align with up to three hyperplanes. When the leading eigenvalue has multiplicity, clustering combines polytope and subspace behavior, generalizing to richer mixed geometries. The work establishes well-posedness, ties the dynamics to a continuity equation, and supports the theory with numerical experiments on ALBERT-valued matrices. Overall, the results provide a principled explanation for the emergence of leaders and structured representations in self-attention dynamics, with implications for understanding Transformer interpretability and efficiency.
Abstract
Viewing Transformers as interacting particle systems, we describe the geometry of learned representations when the weights are not time dependent. We show that particles, representing tokens, tend to cluster toward particular limiting objects as time tends to infinity. Cluster locations are determined by the initial tokens, confirming context-awareness of representations learned by Transformers. Using techniques from dynamical systems and partial differential equations, we show that the type of limiting object that emerges depends on the spectrum of the value matrix. Additionally, in the one-dimensional case we prove that the self-attention matrix converges to a low-rank Boolean matrix. The combination of these results mathematically confirms the empirical observation made by Vaswani et al. [VSP'17] that leaders appear in a sequence of tokens when processed by Transformers.
