Efficiently Scaling Transformer Inference

By Reiner Pope, Sholto Douglas, Aakanksha Chowdhery, Jacob Devlin, James Bradbury, Anselm Levskaya, Jonathan Heek, Kefan Xiao, Shivani Agrawal, Joseph Dean. 2022

688 citations recorded by the source corpus.

We study the problem of efficient generative inference for Transformer models, in one of its most challenging settings: large deep models, with tight latency targets and long sequence lengths. Better understanding of the engineering tradeoffs for inference for large Transformer-based models is important as use cases of these models are growing rapidly throughout application areas. We develop a simple analytical model for inference efficiency to select the best multi-dimensional partitioning techniques optimized for TPU v4 slices based on the application requirements. We combine these with a suite of low-level optimizations to achieve a new Pareto frontier on the latency and model FLOPS utilization (MFU) tradeoffs on 500B+ parameter models that outperforms the FasterTransformer suite of benchmarks. We further show that with appropriate partitioning, the lower memory requirements of multiquery attention (i.e. multiple query heads share single key/value head) enables scaling up to 32x larger context lengths. Finally, we achieve a low-batch-size latency of 29ms per token during generation (using int8 weight quantization) and a 76% MFU during large-batch-size processing of input tokens, while supporting a long 2048-token context length on the PaLM 540B parameter model.

Subfields: Artificial Intelligence, Computer Vision and Pattern Recognition, Model Architectures, Efficiency & Compression

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Mohit Bansal
  2. Luke S. Zettlemoyer
  3. Quoc V. Le
  4. Jianfeng Gao
  5. Percy Liang
  6. Yejin Choi
  7. Yoshua Bengio
  8. Caiming Xiong

In Computer Vision and Pattern Recognition

  1. Luc Van Gool
  2. Dacheng Tao
  3. Trevor Darrell
  4. Jitendra Malik
  5. Ming-Hsuan Yang
  6. Andrew Zisserman
  7. Cordelia Schmid
  8. Xiaogang Wang

In Model Architectures

  1. Mostafa Dehghani
  2. Christopher R'e
  3. Tri Dao
  4. Jitendra Malik
  5. Yi Tay
  6. Xiaohua Zhai
  7. Hugo Touvron
  8. J. Ainslie

In Efficiency & Compression

  1. Kurt Keutzer
  2. Luke S. Zettlemoyer
  3. A. Gholami
  4. Michael W. Mahoney
  5. Tri Dao
  6. Tim Dettmers
  7. Dan Alistarh
  8. Song Han

Citations in the corpus