Foundation Transformers

Hongyu Wang, Shuming Ma, Shaohan Huang, Li Dong, Wenhui Wang, Zhiliang Peng, Yu Wu, Payal Bajaj, Saksham Singhal, Alon Benhaim, Barun Patra, Zhun Liu, Vishrav Chaudhary, Xia Song, Furu WeiarXiv 2022 · DOI

Abstract

The Transformer architecture has revolutionized deep learning, yet its practical implementation remains fragmented across different modalities. Vision, language, and speech models often utilize distinct "dialects" of Layer Normalization (LN) placement—specifically Pre-LN and Post-LN—to balance training stability with model expressivity. This paper presents MAGNETO, a "Foundation Transformer" that unifies these disparate designs. MAGNETO introduces a Sub-LayerNorm (Sub-LN) structure combined with a theoretically-derived initialization strategy. This combination guarantees training stability at scale and delivers state-of-the-art performance across language, vision, speech, and multimodal tasks, establishing a truly general-purpose backbone for the next generation of foundation models.

Introduction: One Transformer to Rule Them All

In recent years, the Transformer has emerged as the universal language of deep learning. However, a closer inspection of successful models like ViT (Vision Transformer) and BERT (Bidirectional Encoder Representations from Transformers) reveals significant architectural differences. These variations primarily concern the placement of Layer Normalization, a critical component for training deep networks. Researchers at Microsoft have proposed MAGNETO to resolve this fragmentation, offering a unified architecture that excels regardless of the input modality.

The Problem: Architectural Fragmentation

The field currently faces a trade-off between performance and stability. Post-LayerNorm (Post-LN) models, which place normalization after the residual block, often achieve higher performance but are notoriously difficult to train at scale due to gradient instability. Conversely, Pre-LayerNorm (Pre-LN) models, which normalize before the block, offer superior stability but can suffer from "representation collapse" or reduced expressivity. This dichotomy is particularly problematic for multimodal modeling, where a single model must often reconcile these conflicting architectural preferences.

Comparison of Transformer architectures across modalities and the proposed Sub-LN unification.

Methods: Sub-LayerNorm and Theoretical Initialization

MAGNETO addresses these challenges through two primary innovations:

  1. Sub-LayerNorm (Sub-LN): Rather than choosing between "Pre" or "Post" placement, MAGNETO introduces an additional LayerNorm layer within each sublayer. Specifically, LN is placed before the input projection and another before the output projection of both the Multi-Head Attention (MHA) and Feed-Forward Network (FFN) modules. This "sandwich" approach enhances expressivity while maintaining a smooth loss landscape.
  2. Theoretical Initialization: Leveraging DeepNet theory, the authors derived a specific initialization scheme to ensure stability. The weights of most layers are scaled by a factor $\gamma$—determined by the total number of layers—while query and key projections maintain standard scales. This mathematically ensures that expected model updates remain bounded, allowing for seamless scaling to massive model sizes without the need for extensive hyperparameter tuning.
Detailed Sub-LN architecture for encoder-decoder models and the initialization strategy.

Experimental Evaluation

MAGNETO was put through a gauntlet of benchmarks to prove its "foundation" status:

  • Language: Pretrained on a 16GB English corpus and evaluated on the GLUE benchmark and CC100.
  • Vision: Pretrained via the BEiT framework on ImageNet-1k and tested on downstream tasks like semantic segmentation (ADE20k) and robustness benchmarks.
  • Speech: Evaluated on the LibriSpeech 960h benchmark for automatic speech recognition.
  • Multimodal: Tested on Visual Question Answering (VQA 2.0) and Natural Language Visual Reasoning (NLVR2).
  • Translation: Evaluated on the OPUS-100 multilingual corpus.

Key Results and Insights

MAGNETO consistently outperformed specialized state-of-the-art baselines across the board:

  • Performance Gains: On the GLUE benchmark, MAGNETO achieved an average score of 86.3, surpassing both Post-LN (85.7) and Pre-LN (84.6) baselines. In vision, a 24-layer MAGNETO model reached 86.8% top-1 accuracy on ImageNet, outperforming vanilla ViT (86.2%) and showing significant gains in robustness (+5.3% on ImageNet-Adversarial).
  • Stability and Scale: The theoretically-derived initialization allows MAGNETO to tolerate significantly larger learning rates than standard Transformers. This stability enables the model to converge to better optima, resulting in higher final accuracy and easier scaling.
  • Unification: The results suggest that Sub-LN is not just a compromise but a fundamentally superior structural choice that often beats modality-specific architectures.

Conclusion and Future Work

MAGNETO represents a significant step toward a truly universal Transformer architecture. By unifying the backbone through Sub-LN and ensuring stability via principled initialization, it simplifies the development of large-scale multimodal models. Future research will explore the limits of MAGNETO at the trillion-parameter scale and investigate the potential for unifying modality-specific "front-ends" (tokenization and embedding) to create a completely end-to-end foundation model.

Summary updated

BibTeX
@misc{wang2022foundation,
  author = {Hongyu Wang and Shuming Ma and Shaohan Huang and Li Dong and Wenhui Wang and Zhiliang Peng and Yu Wu and Payal Bajaj and Saksham Singhal and Alon Benhaim and Barun Patra and Zhun Liu and Vishrav Chaudhary and Xia Song and Furu Wei},
  title = {{Foundation Transformers}},
  year = {2022},
  eprint = {2210.06423},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.06423},
}
Figure