Abstract
Transformer models have become the standard for Neural Machine Translation (NMT), but scaling them in depth has proven challenging due to optimization difficulties such as vanishing or exploding gradients. This paper presents a method to train deep Transformer models with up to 30 encoder layers. By relocating layer normalization to the input of each sub-layer (Pre-Norm) and introducing a Dynamic Linear Combination of Layers (DLCL), we achieve superior performance over shallow, wide models. Our 30-layer "thin" models outperform the standard Transformer-Big baseline while being 1.6x smaller and 3x faster to train.
Introduction
In the world of Neural Machine Translation (NMT), the Transformer architecture is king. However, for a long time, the community scaled these models "outward" (making them wider with more hidden units, known as Transformer-Big) rather than "upward" (making them deeper). Deep Transformers are notoriously difficult to optimize; once depth exceeds 6 or 12 layers, gradients tend to vanish or explode, leading to a "training disaster" where the model fails to converge. While wide models perform well, they are computationally expensive and memory-intensive. This paper tackles the open question: Can we build a deep, thin Transformer that beats a shallow, wide one?
Methods
The authors propose two fundamental changes to the standard Transformer architecture to enable extreme depth.
Pre-Norm Residual Units
In the original Transformer, Layer Normalization (LN) happens after the residual addition (Post-Norm). We show mathematically that this creates a "bottleneck" for gradients. In Post-Norm, the gradient must pass through every single LN unit, which compounds errors and vanishes the signal. By moving LN to the input of each sub-layer (Pre-Norm), we create a direct, clean path for gradients to flow from the output back to the earliest layers. This modification makes 20+ layer models stable and easy to optimize.
Dynamic Linear Combination of Layers (DLCL)
Standard residual networks only pass information from layer $L$ to $L+1$. As models get deeper, the network can "forget" features extracted in the very first layers. Inspired by numerical analysis (specifically linear multi-step methods for solving ODEs), DLCL learns a weighted sum of all previous layers to serve as the input for the next layer. These weights are learnable scalars, allowing the model to decide which previous representations are most relevant at any given depth.
Datasets and Evaluation
The models were evaluated on three major benchmarks:
- WMT’16 English-German (En-De): A standard 4.5M sentence pair dataset.
- NIST OpenMT’12 Chinese-English (Zh-En-Small): A smaller 1.9M sentence pair set.
- WMT’18 Chinese-English (Zh-En-Large): A massive 16.5M sentence pair dataset, augmented with 5M back-translated sentences to test scalability.
Key Insights and Results
The experiments yielded several critical insights for the NMT community:
- State-of-the-Art Depth: We successfully trained a 30-layer encoder, the deepest reported in NMT at the time of publication.
- Deep and Thin > Shallow and Wide: A 30-layer "Base" model (thin) consistently outperformed a 6-layer "Big" model (wide). This suggests that hierarchical depth—the ability to build increasingly complex representations—is more valuable than raw width. On WMT’16 En-De, the deep system outperformed the shallow Transformer-Big baseline by 0.4–2.4 BLEU points.
- Efficiency Bonus: Because the deep models are "thin" (smaller hidden dimensions), they have significantly fewer parameters. Compared to Transformer-Big, the 30-layer DLCL model is 1.6x smaller in parameter count, 3x faster to train, and 10% faster during inference.
- Robustness: The DLCL approach proved more robust than other "dense" connection methods, maintaining performance even as depth increased beyond 25 layers.
Conclusion
This work demonstrates that depth is a critical factor in Transformer performance. By optimizing the gradient path through Pre-Norm units and utilizing DLCL to preserve multi-scale features, we can train significantly deeper models that are both more accurate and more efficient than traditional wide architectures. Future work could explore the optimal balance of depth between the encoder and decoder, as well as further architectural simplifications suggested by the sparsity of learned weights in very deep models.
Summary updated