GLaM: Efficient Scaling of Language Models with Mixture-of-Experts

Nan Du, Yanping Huang, Andrew M. Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan Firat, Barret Zoph, Liam Fedus, Maarten Bosma, Zongwei Zhou, Tao Wang, Yu Emma Wang, Kellie Webster, Marie Pellat, Kevin Robinson, Kathy Meier-Hellstern, Toju Duke, Lucas Dixon, Kun Zhang, Quoc V. Le, Yonghui Wu, Zhifeng Chen, Claire Cui

Introduction

GLaM (Generalist Language Model) represents a significant leap in the efficiency of large-scale language modeling. By utilizing a sparsely activated Mixture-of-Experts (MoE) architecture, GLaM achieves a total capacity of 1.2 trillion parameters—seven times larger than GPT-3—while requiring significantly less energy for training and lower computational cost for inference.

The Challenge of Scaling

Traditional dense language models follow scaling laws where performance improvements come at a linear cost in computation. Doubling parameters typically doubles the FLOPs required per token, leading to massive energy consumption and high operational costs. GLaM addresses this "compute tax" by decoupling a model's total knowledge capacity from the amount of computation used per token.

Methodology: Sparse Mixture-of-Experts

The core of GLaM is its Sparsely Activated MoE architecture. Unlike dense models where every parameter is active for every input, GLaM only engages a small subnetwork for each token.

  • Expert Routing: Standard feed-forward layers are replaced with MoE layers containing 64 independent experts. A gating module dynamically routes each token to the most relevant two experts.
  • Parameter Efficiency: In the 1.2T parameter configuration, only 96.6B parameters (approximately 8%) are activated per token.
  • Architectural Enhancements: The model incorporates relative positional biases and Gated Linear Units (GLU) with GELU activations to further improve performance.
  • Infrastructure: Training such a massive model required advanced 2D sharding (GSPMD) across 1,024 Cloud TPU-v4 chips.

Datasets and Evaluation

GLaM was trained on a high-quality corpus of 1.6 trillion tokens. The authors prioritized data quality over raw volume, using a classifier to filter web crawls into a high-quality subset. The training mix included filtered webpages (42%), books (20%), and conversations (28%).

The model was evaluated across 29 public NLP benchmarks, spanning both Natural Language Generation (NLG) and Natural Language Understanding (NLU) tasks.

Key Results

GLaM demonstrates that sparsity can provide a "free lunch" in terms of scaling knowledge without proportional increases in latency.

GLaM performance across zero-shot, one-shot, and few-shot tasks compared to GPT-3, alongside training and inference cost metrics.
  • Performance Gains: GLaM outperformed GPT-3 on 21 of 29 tasks, showing a 10.2% average improvement in zero-shot accuracy and 4.4% in few-shot settings. Knowledge-heavy tasks like open-domain question answering saw the most significant benefits.
  • Efficiency: Training GLaM consumed 456 MWh, a 64.6% reduction compared to GPT-3 (1,287 MWh). Inference required 180 GFLOPs/token, nearly half of GPT-3's 350 GFLOPs/token.
  • State-of-the-Art: GLaM set a new benchmark for one-shot performance on TriviaQA, surpassing models that utilize external knowledge retrieval.

Discussion and Limitations

While GLaM is computationally efficient per token, its 1.2T parameters impose a high memory footprint. Deploying the model requires substantial VRAM, which may be cost-prohibitive for low-traffic applications. Additionally, like other large models, GLaM reflects societal biases present in its training data, though it showed improved robustness on specific gender-bias benchmarks like WinoGender.

Future research will likely focus on more sophisticated routing algorithms and automated curation of multi-trillion token datasets to further push the boundaries of efficient scaling.

Summary updated

BibTeX
@inproceedings{du2022glam,
  author = {Nan Du and Yanping Huang and Andrew M. Dai and Simon Tong and Dmitry Lepikhin and Yuanzhong Xu and Maxim Krikun and Yanqi Zhou and Adams Wei Yu and Orhan Firat and Barret Zoph and Liam Fedus and Maarten Bosma and Zongwei Zhou and Tao Wang and Yu Emma Wang and Kellie Webster and Marie Pellat and Kevin Robinson and Kathy Meier-Hellstern and Toju Duke and Lucas Dixon and Kun Zhang and Quoc V. Le and Yonghui Wu and Zhifeng Chen and Claire Cui},
  title = {{GLaM: Efficient Scaling of Language Models with Mixture-of-Experts}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=tTSbDRi53He},
}
Figure