SMYRF: Efficient Attention using Asymmetric Clustering

By Giannis Daras, Nikita Kitaev, Augustus Odena, A. Dimakis. 2020

52 citations recorded by the source corpus.

We propose a novel type of balanced clustering algorithm to approximate attention. Attention complexity is reduced from $O(N^2)$ to $O(N \log N)$, where $N$ is the sequence length. Our algorithm, SMYRF, uses Locality Sensitive Hashing (LSH) in a novel way by defining new Asymmetric transformations and an adaptive scheme that produces balanced clusters. The biggest advantage of SMYRF is that it can be used as a drop-in replacement for dense attention layers without any retraining. On the contrary, prior fast attention methods impose constraints (e.g. queries and keys share the same vector representations) and require re-training from scratch. We apply our method to pre-trained state-of-the-art Natural Language Processing and Computer Vision models and we report significant memory and speed benefits. Notably, SMYRF-BERT outperforms (slightly) BERT on GLUE, while using $50\%$ less memory. We also show that SMYRF can be used interchangeably with dense attention before and after training. Finally, we use SMYRF to train GANs with attention in high resolutions. Using a single TPU, we were able to scale attention to 128x128=16k and 256x256=65k tokens on BigGAN on CelebA-HQ.

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

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. Christopher R'e
  2. Tri Dao
  3. Atri Rudra
  4. Stefano Ermon
  5. Daniel Y. Fu
  6. Beidi Chen
  7. Fahad Shahbaz Khan
  8. Ajmal Saeed Mian

In Computer Vision and Pattern Recognition

  1. Fahad Shahbaz Khan
  2. Christopher R'e
  3. Ming-Hsuan Yang
  4. Luc Van Gool
  5. Tri Dao
  6. Ajmal Saeed Mian
  7. Stefano Ermon
  8. Saeed Anwar

In Model Architectures

  1. Tri Dao
  2. Christopher R'e
  3. Daniel Y. Fu
  4. Stefano Ermon
  5. Atri Rudra
  6. Beidi Chen
  7. Khaled Kamal Saab
  8. Armin W. Thomas

Citations in the corpus