NeurIPS 2020poster54 citations

SMYRF - Efficient Attention using Asymmetric Clustering

Giannis Daras, Nikita Kitaev, Augustus Odena, Alexandros G Dimakis

Abstract

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. tight queries and keys) 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 train BigGAN on Celeba-HQ, with attention at resolution 128x128 and 256x256, capable of generating realistic human faces.

BibTeX
@inproceedings{NEURIPS2020_47d40767,
 author = {Daras, Giannis and Kitaev, Nikita and Odena, Augustus and Dimakis, Alexandros G},
 booktitle = {Advances in Neural Information Processing Systems},
 editor = {H. Larochelle and M. Ranzato and R. Hadsell and M.F. Balcan and H. Lin},
 pages = {6476--6489},
 publisher = {Curran Associates, Inc.},
 title = {SMYRF - Efficient Attention using Asymmetric Clustering},
 url = {https://proceedings.neurips.cc/paper_files/paper/2020/file/47d40767c7e9df50249ebfd9c7cfff77-Paper.pdf},
 volume = {33},
 year = {2020}
}
SMYRF - Efficient Attention using Asymmetric Clustering · NeurIPS 2020