BranchNorm: Robustly Scaling Extremely Deep Transformers

Yijin Liu, Xianfeng Zeng, Fandong Meng, Jie Zhou

Abstract

Scaling Transformers to extreme depths is challenging due to training instabilities. While methods like DeepNorm enable 1,000-layer models, they often suffer from "undertraining" where fixed constraints limit representational capacity. We introduce BranchNorm, a normalization technique that uses a dynamic scaling factor to transition from high stability at the start of training to high capacity at convergence. BranchNorm achieves state-of-the-art results on machine translation and summarization while demonstrating remarkable robustness to hyperparameters.

The Challenge of Extreme Depth

Scaling Transformers to 100+ layers typically leads to vanishing or exploding gradients. While Pre-LayerNorm (Pre-LN) offers stability, it often underperforms Post-LayerNorm (Post-LN) because its heavy reliance on residual connections limits the model's ability to learn complex features.

DeepNorm recently enabled scaling Post-LN models to 1,000 layers using a fixed scaling factor ($\alpha$) to upweight the residual branch. However, this fixed constraint creates a performance gap. As shown in Figure 1, DeepNorm-based models can be "undertrained" compared to vanilla Transformers on shallower tasks because the parameters are never fully "unleashed."

Performance gap between DeepNorm and vanilla Transformers on WMT14 En-Fr, highlighting the undertraining issue.

BranchNorm: Dynamic Scaling for Stability and Capacity

BranchNorm addresses the undertraining problem by shifting the scaling logic. Instead of a fixed scale on the residual branch, BranchNorm rescales the non-residual branch (the part containing the Attention or FFN layers) using a dynamic factor $\alpha_t$.

The core equation for a sub-layer becomes: $$x_{l+1} = LN(x_l + \alpha_t \mathcal{F}(x_l; \theta_l))$$

Key features include:

  • Dynamic Scaling: $\alpha_t$ starts near 0 at the beginning of training and linearly increases to 1.0 over a predefined number of steps ($T$).
  • Stability to Convergence: In early stages, a small $\alpha_t$ makes the layer behave like an identity transformation, stabilizing the warmup phase. As $\alpha_t$ reaches 1.0, the architecture behaves like a standard Post-LN Transformer, allowing for better convergence and higher model capacity.
  • Curriculum Learning: Unlike DeepNorm's fixed constraint, BranchNorm's schedule acts as a curriculum that ensures parameters are fully utilized by the end of training.
Comparison of DeepNorm (fixed alpha, 'frozen' layers) vs. BranchNorm (dynamic alpha, 'active' layers).

Key Results and Insights

BranchNorm was evaluated across standard NLP benchmarks including WMT translation tasks, CNN/DailyMail summarization, and WikiText-103.

  • State-of-the-Art Performance: A 1,000-layer (500L-500L) BranchNorm model achieved 44.4 BLEU on WMT14 En-Fr, outperforming all previous deep Transformer variants.
  • Hyperparameter Robustness: BranchNorm is remarkably stable; it can be trained without a warmup phase and is much more tolerant of high learning rates compared to DeepNorm.
  • Efficiency via Depth: To make 1,000-layer models practical, the authors show that a "Deep Encoder / Shallow Decoder" configuration (e.g., 475 encoder layers, 25 decoder layers) maintains high performance while providing a nearly 2x speedup in inference.
  • Increased Sparsity: BranchNorm models exhibit higher activation sparsity than DeepNorm, suggesting the model learns more efficient, robust representations.

Conclusion

BranchNorm provides a mathematically simple yet effective way to scale Transformers to unprecedented depths. By replacing fixed constraints with a dynamic scaling schedule, it resolves the stability-performance trade-off, enabling the training of 1,000-layer models that are both stable and highly expressive.

Summary updated

BibTeX
@inproceedings{liu2024branchnorm,
  author = {Yijin Liu and Xianfeng Zeng and Fandong Meng and Jie Zhou},
  title = {{BranchNorm: Robustly Scaling Extremely Deep Transformers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.695},
}
Figure