NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depth

Yihe Dong, Jean-Baptiste Cordonnier, Andreas Loukas

TL;DR

Pure self-attention networks (SANs) suffer from a rapid "rank collapse," where the output tokens become identical and the model loses all expressive power. This paper proves that this collapse happens doubly exponentially with depth, revealing that skip connections and multi-layer perceptrons (MLPs) are not just helpful for training—they are fundamentally necessary to keep the model from degenerating into a useless, uniform state.

What Problem Does This Paper Address?

While Transformers have revolutionized AI, our theoretical understanding of why they work remains surprisingly thin. Most research focuses on the attention mechanism itself, but a standard Transformer block also includes skip connections, MLPs, and layer normalization.

The authors ask: What happens if we just stack attention layers? They discover a massive inductive bias toward "token uniformity." Without the "supporting cast" of skip connections and MLPs, the tokens in a deep network quickly lose their individuality, converging to a state where every token is the same (a rank-1 matrix). This paper quantifies this collapse and explains how the other components of the architecture fight back.

Methods

The authors introduce a novel framework called path decomposition. They show that a multi-head SAN can be viewed as a linear combination of many "paths." Each path represents a sequence of specific attention heads chosen across the layers of the network.

Figure 1: Two paths in a deep Self-Attention Network (SAN) with H heads and L layers. At each layer, a path can go through one of the heads or bypass the layer. Adding an MLP block after each attention layer forms the transformer architecture.

By analyzing these paths, they measure the residual norm—essentially, how much the tokens differ from their average. They use properties of stochastic matrices to prove that in a pure SAN, this residual vanishes at a cubic rate ($3^L$), leading to a doubly exponential convergence toward a rank-1 matrix. This is significantly faster than the linear convergence typically seen in Markov chains.

Datasets

The researchers validated their theory using several different approaches:

  • Real-world Architectures: They analyzed pretrained and initialized versions of BERT, Albert, and XLNet using excerpts from Wikipedia biographies.
  • Toy Tasks: A 2D circular sequence prediction task was used to visualize how different components prevent points from collapsing to a single center.
  • Synthetic Benchmarks: To test "path effectiveness," they used:
  • Sequence Memorization: Mapping English sentences to random binary labels.
  • Learning to Sort: Alphabetizing random sequences of letters.
  • Convex Hull Prediction: Determining if points in a 2D set belong to the convex hull.

Key Insights and Ideas

  • The "Aha" Moment on Cubic Convergence: Why is the collapse so fast? In standard theory, the rate is linear. Here, it's cubic because the attention matrix itself depends on the input. As the input becomes lower rank, the attention heads mix tokens even faster, creating a "cascading effect" of degeneration.
  • Skip Connections are the Heroes: Skip connections allow "short paths" to exist. A path that skips most layers doesn't have time to collapse. The authors hypothesize that Transformers behave like an ensemble of shallow networks rather than one deep one.
  • MLPs as a Tug-of-War: MLPs help by increasing the Lipschitz constant of the layer, which can counteract the rank-reducing effect of attention. However, this comes at a cost: higher Lipschitz constants can make models less robust to noise.
  • Layer Norm is Neutral: Interestingly, the math shows that layer normalization does nothing to stop rank collapse. It rescales the data but doesn't change the underlying rank.

Key Results

The experimental results strikingly confirm the theory. In Figure 2, you can see that for BERT, Albert, and XLNet, the "Pure SAN" (dotted green line) collapses to zero residual almost immediately.

Figure 2: Relative norm of the residual along the depth for three models before and after training. Pure attention (SAN) converges rapidly to a rank-1 matrix. Adding MLP blocks and skip connection gives a transformer. Skip connections play a critical role in mitigating rank collapse (i.e., a zero residual).

When testing path effectiveness (Figure 4), the authors found that short paths carry almost all the predictive power. As path length increases, performance drops toward the level of a random guess. This suggests that the "deep" parts of a Transformer might be significantly underutilized.

Figure 4: Task accuracy vs. path length. Performance deteriorates rapidly as paths get longer, supporting the "ensemble of shallow networks" theory.

Limitations and Future Work

The authors acknowledge that while they've proven an upper bound for the collapse, finding a tight lower bound for networks with skip connections remains an open challenge.

The most provocative takeaway is the "underutilized capacity" in long paths. If we can find architectural ways to prevent long paths from losing rank, we might be able to build Transformers that are truly "deep" in their processing, potentially leading to a new leap in model performance. This opens the door for researching new types of normalization or attention variants that explicitly preserve rank.

Summary updated

BibTeX
@inproceedings{dong2021attention,
  author = {Yihe Dong and Jean-Baptiste Cordonnier and Andreas Loukas},
  title = {{Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depth}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=cu-5fwOk7GM},
}
Figure