Introduction
Transformers are the undisputed foundational architecture of modern AI, yet they remain notoriously finicky to train. Often, they require precise hyperparameter tuning to avoid pathological behaviors at initialization, such as vanishing or exploding gradients and rank collapse in depth. Rank collapse in depth occurs when, as a network grows deeper, token representations lose their individuality and converge toward a single point, effectively reducing the model's rank to one.
While previous research has primarily focused on how depth degrades rank, recent findings uncover a hidden, equally critical dimension to the problem: width (context length). Even within a single attention layer, simply increasing the number of tokens ($T$) causes representations to collapse. This phenomenon, termed rank collapse in width, acts as a catalyst that accelerates collapse in depth and severely destabilizes training.
The Root Cause: Spectral Gaps and Softmax Outliers
To understand why width induces collapse, researchers applied Random Matrix Theory (RMT) and Free Probability to analyze the spectral properties of softmax attention matrices at initialization.
By modeling the attention matrix as an independent and identically distributed (i.i.d.) Markov matrix, a mathematical bottleneck emerges. Because the rows of a softmax matrix must sum to 1, the matrix inherently possesses a "dominant" eigenvalue of exactly 1.
Crucially, as the context length $T$ grows, all other eigenvalues in the "bulk" shrink toward zero. This dynamic creates a massive spectral gap between the first and second largest eigenvalues. Consequently, the signal is forced to propagate almost exclusively along the direction of the dominant eigenvector (the all-ones vector), squashing signal diversity and leading directly to rank collapse. Furthermore, this spectral gap causes gradients to explode at a rate of $T^{L-1}$ (where $L$ is the depth of the network).
The Solution: Removing the Gap
Recognizing that the softmax outlier represents a mathematical artifact rather than "learned" attention, the authors propose a remarkably simple and computationally efficient fix: centering the attention matrix.
Instead of using the standard attention matrix $A$, they substitute it with a modified version, $A^\perp = A - \frac{1}{T}\mathbf{1}_{T \times T}$. By subtracting this rank-one outlier (effectively the mean), the matrix is centered. This restores the flow of information by allowing the remaining bulk of the eigenvalues to carry diverse signals, reducing gradient growth from an exponential $T^{L-1}$ to a much more manageable linear scale.
This theoretical framework also elegantly unifies recent empirical trends. High-performance architectures like the Differential Transformer (which subtracts two attention maps) or Centered Attention can now be understood as implicit, practical methods for closing this exact spectral gap.
Empirical Validation
The theoretical findings were rigorously validated across both synthetic and real-world setups:
- Stable Rank Recovery: In standard Transformers, the "stable rank"—a proxy for the matrix's information capacity—collapses to 1 as $T$ increases. With the $A^\perp$ modification, the stable rank scales linearly with $T$, successfully preserving information.
- Pre-trained Models: Analysis of initialization states in Hugging Face models (BERT, RoBERTa, and ALBERT) confirmed that standard architectures suffer from immediate rank collapse in width. Applying the proposed modification consistently slowed down rank collapse in depth across all tested families.
- Data Diversity: The tests held up not just on synthetic Gaussian embeddings, but also on real text data, proving the fix works on non-isometric inputs.
Limitations and Future Directions
While centering the attention matrix provides a robust initialization, this study focuses strictly on the network's state before training begins. Tracking how these spectral properties evolve during the actual learning process remains an open question.
Additionally, researchers observed that in very deep networks, secondary outliers can emerge beyond the primary one caused by softmax. Identifying the source of these additional outliers, and scaling this analysis to full-scale production models (like billion-parameter LLMs with complex LayerNorm and skip connection interplays), represent exciting frontiers for future empirical study.
Summary updated