Efficient Content-Based Sparse Attention with Routing Transformers

By Aurko Roy, Mohammad Taghi Saffar, Ashish Vaswani, David Grangier. 2020

773 citations recorded by the source corpus.

Self-attention has recently been adopted for a wide range of sequence modeling problems. Despite its effectiveness, self-attention suffers from quadratic computation and memory requirements with respect to sequence length. Successful approaches to reduce this complexity focused on attending to local sliding windows or a small set of locations independent of content. Our work proposes to learn dynamic sparse attention patterns that avoid allocating computation and memory to attend to content unrelated to the query of interest. This work builds upon two lines of research: It combines the modeling flexibility of prior work on content-based sparse attention with the efficiency gains from approaches based on local, temporal sparse attention. Our model, the Routing Transformer, endows self-attention with a sparse routing module based on online k-means while reducing the overall complexity of attention to O(n1.5d) from O(n2d) for sequence length n and hidden dimension d. We show that our model outperforms comparable sparse attention models on language modeling on Wikitext-103 (15.8 vs 18.3 perplexity), as well as on image generation on ImageNet-64 (3.43 vs 3.44 bits/dim) while using fewer self-attention layers. Additionally, we set a new state-of-the-art on the newly released PG-19 data-set, obtaining a test perplexity of 33.2 with a 22 layer Routing Transformer model trained on sequences of length 8192. We open-source the code for Routing Transformer in Tensorflow.1

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. Quoc V. Le
  3. Luke S. Zettlemoyer
  4. Jianfeng Gao
  5. Percy Liang
  6. Yoshua Bengio
  7. Graham Neubig
  8. Kyunghyun Cho

In Computer Vision and Pattern Recognition

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

In Model Architectures

  1. Quoc V. Le
  2. Yoshua Bengio
  3. Ruslan Salakhutdinov
  4. Tri Dao
  5. Barret Zoph
  6. Jianfeng Gao
  7. Richard Socher
  8. Yi Tay

In Efficiency & Compression

  1. Tri Dao
  2. Luke S. Zettlemoyer
  3. Yi Tay
  4. Barret Zoph
  5. Dan Alistarh
  6. Kurt Keutzer
  7. Quoc V. Le
  8. Donald Metzler

Citations in the corpus