Deep Transformers without Shortcuts: Modifying Self-attention for Faithful Signal Propagation

Bobby He, James Martens, Guodong Zhang, Aleksandar Botev, Andrew Brock, Samuel L. Smith, Yee Whye Teh · DOI

Introduction

In modern deep learning, skip connections (Residual connections) and Layer Normalization have become indispensable components of the Transformer architecture. While these "architectural crutches" enable the training of extremely deep models, they also mask underlying issues in signal propagation. This research investigates whether it is possible to train deep Transformers without these components by addressing the fundamental mathematical reasons they fail in their "vanilla" form.

The Challenge: Rank Collapse

The primary obstacle to training deep vanilla Transformers is a phenomenon known as rank collapse. As a signal passes through successive self-attention layers without skip connections, the representations of different tokens tend to converge and become identical. Mathematically, the data matrix reduces to rank-1, meaning the model loses the ability to distinguish between different inputs or maintain spatial information. When rank collapse occurs, gradients vanish, and the optimization process stalls, rendering the model untrainable.

Signal Preserving Attention (SPA)

To overcome rank collapse, the authors propose Signal Preserving Attention (SPA). This method involves "reverse-engineering" the self-attention mechanism to ensure that geometric information is preserved across layers at initialization. SPA consists of three primary modifications to the standard softmax attention mechanism:

  1. Query Weight Initialization: The Query weights ($W^Q$) are initialized to zero. This ensures that at the start of training, the attention matrix is data-independent, preventing early-stage stochasticity from collapsing the signal.
  2. Bias Matrices ($B$): A non-trainable bias matrix is added to the attention logits. This matrix is designed to enforce a specific "kernel" pattern, ensuring that the attention mechanism maintains a structured flow of information.
  3. Location-Dependent Rescaling ($D$): A post-softmax scaling factor is applied to the activations. This ensures that the norm of the signal neither explodes nor vanishes as it propagates through the depth of the network.

Variants of SPA

The researchers explored two specific implementations of the bias matrices:

  • U-SPA (Uniform): This variant treats all tokens equally, with every token attending to every other token with uniform weight.
  • E-SPA (Exponential): This variant introduces a "recency bias," where tokens attend more strongly to their immediate neighbors. This effectively integrates a form of inductive bias similar to positional encoding directly into the signal propagation logic.

Experimental Results

The authors evaluated SPA on large-scale language modeling benchmarks, including WikiText-103 and the C4 (Colossal Clean Crawled Corpus) dataset.

Training Depth and Stability

The study successfully demonstrated the training of a 36-layer Transformer entirely devoid of skip connections and normalization layers. This represents a significant milestone, as previous attempts to train vanilla Transformers of this depth typically failed to converge.

Performance and Convergence

On the C4 dataset, the vanilla E-SPA Transformer eventually reached the same validation perplexity as a standard Pre-LN (Layer Normalized) Transformer. However, a significant "efficiency gap" was observed: the vanilla model required approximately 500,000 iterations to reach the same performance level that a standard Transformer achieved in 100,000 iterations. This suggests that while skip connections are not strictly necessary for expressivity, they act as powerful accelerators for optimization.

Downstream Utility

Models trained with E-SPA were not merely theoretical exercises; they demonstrated strong zero-shot performance on downstream tasks such as BoolQ and Winogrande. This confirms that the representations learned by vanilla Transformers are as robust and useful as those learned by standard architectures.

Key Insights

  • Rank Collapse vs. Vanishing Gradients: The research confirms that rank collapse, rather than just vanishing gradients, is the definitive "killer" of deep vanilla Transformers.
  • The Importance of Locality: E-SPA significantly outperformed U-SPA, suggesting that an inductive bias toward local context is critical for stable signal propagation in the absence of shortcuts.
  • Normalization-Free Architectures: The authors found that by combining E-SPA with skip connections, they could remove Layer Normalization entirely without suffering the 5x training slowdown, matching the speed of state-of-the-art models.

Conclusion and Future Work

This work proves that the "crutches" of modern architectures can be removed if the underlying signal propagation is handled with mathematical precision. While the current 5x training time penalty makes purely vanilla models impractical for immediate industrial application, the insights gained here open new doors for architectural design. Future research may focus on using advanced optimization techniques, such as second-order optimizers like K-FAC, to close the training speed gap and further refine normalization-free deep learning.

Summary updated

BibTeX
@inproceedings{he2023deep,
  author = {Bobby He and James Martens and Guodong Zhang and Aleksandar Botev and Andrew Brock and Samuel L. Smith and Yee Whye Teh},
  title = {{Deep Transformers without Shortcuts: Modifying Self-attention for Faithful Signal Propagation}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=NPrsUQgMjKK},
}
Figure