Self-attention Networks Localize When QK-eigenspectrum Concentrates
Han Bao, Ryuichiro Hataya, Ryo Karakida
TL;DR
<p>The paper investigates when self-attention localizes in sequences and reveals that localization is governed by the eigenspectrum of the query-key parameter matrix $W_{QK}$, specifically its mean and variance. By introducing a signal-propagation framework and a piecewise-linear softmax approximation, it shows that small spectral-variance with a nonzero mean promotes localization, which simultaneously mitigates rank and entropy collapse, improving expressivity and training dynamics. A unifying perspective links previously separate collapse phenomena, arguing that controlling the $W_{QK}$ eigenspectrum can reconcile them and enhance performance. The LocAteR regularization concretely embodies this idea by shrinking the spectrum’s scale while preserving its mean, with empirical evidence from WikiText-2 showing improved perplexity and higher attention entropy under localization.</p>
Abstract
The self-attention mechanism prevails in modern machine learning. It has an interesting functionality of adaptively selecting tokens from an input sequence by modulating the degree of attention localization, which many researchers speculate is the basis of the powerful model performance but complicates the underlying mechanism of the learning dynamics. In recent years, mainly two arguments have connected attention localization to the model performances. One is the rank collapse, where the embedded tokens by a self-attention block become very similar across different tokens, leading to a less expressive network. The other is the entropy collapse, where the attention probability approaches non-uniform and entails low entropy, making the learning dynamics more likely to be trapped in plateaus. These two failure modes may apparently contradict each other because the rank and entropy collapses are relevant to uniform and non-uniform attention, respectively. To this end, we characterize the notion of attention localization by the eigenspectrum of query-key parameter matrices and reveal that a small eigenspectrum variance leads attention to be localized. Interestingly, the small eigenspectrum variance prevents both rank and entropy collapse, leading to better model expressivity and trainability.
