Transformer Quality in Linear Time

Abstract

We revisit the design choices in Transformers, and propose methods to address their weaknesses in handling long sequences. First, we propose a simple layer named gated attention unit, which allows the use of a weaker single-head attention with minimal quality loss. We then propose a linear approximation method complementary to this new layer, which is accelerator-friendly and highly competitive in quality. The resulting model, named FLASH, matches the perplexity of improved Transformers over both short (512) and long (8K) context lengths, achieving training speedups of up to 4.9x on Wiki-40B and 12.1x on PG-19 for auto-regressive language modeling, and 4.8x on C4 for masked language modeling.

Cite

Text

Hua et al. "Transformer Quality in Linear Time." International Conference on Machine Learning, 2022.

Markdown

[Hua et al. "Transformer Quality in Linear Time." International Conference on Machine Learning, 2022.](https://mlanthology.org/icml/2022/hua2022icml-transformer/)

BibTeX

@inproceedings{hua2022icml-transformer,
  title     = {{Transformer Quality in Linear Time}},
  author    = {Hua, Weizhe and Dai, Zihang and Liu, Hanxiao and Le, Quoc},
  booktitle = {International Conference on Machine Learning},
  year      = {2022},
  pages     = {9099-9117},
  volume    = {162},
  url       = {https://mlanthology.org/icml/2022/hua2022icml-transformer/}
}