Efficient Attention: Attention with Linear Complexities
Authors:
- Zhuoran ShenZSZhuoran Shen
- Mingyuan ZhangMZMingyuan Zhang
- Haiyu ZhaoHZHaiyu Zhao
- Shuai YiSYShuai Yi
- Hongsheng LiHLHongsheng Li
Preprint
Abstract
Dot-product attention has wide applications in computer vision and natural language processing. However, its memory and computational costs grow quadratically with the input size. Such growth prohibits its application on high-resolution inputs. To remedy this drawback, this paper proposes a novel efficient attention mechanism equivalent to dot-product attention but with substantially less memory and computational costs. Its resource efficiency allows more widespread and flexible integration of attention modules into a network, which leads to better accuracies. Empirical evaluations demonstrated the effectiveness of its advantages. Efficient attention modules brought significant performance boosts to object detectors and instance segmenters on MS-COCO 2017. Further, the resource efficiency democratizes attention to complex models, where high costs prohibit the use of dot-product attention. As an exemplar, a model with efficient attention achieved state-of-the-art accuracies for stereo depth estimation on the Scene Flow dataset. Code is available at https://github.com/cmsflash/efficient-attention.Keywords
All Related Versions
This publication has 11 references indexed in Scilit:
- Learning Depth with Convolutional Spatial Propagation NetworkIEEE Transactions on Pattern Analysis and Machine Intelligence, 2019
- GCNet: Non-Local Networks Meet Squeeze-Excitation Networks and Beyond2019
- SILCO: Show a Few Images, Localize the Common Object2019
- Video-Based Person Re-identification via 3D Convolutional Networks and Non-local Attention2019
- EdgeStereo: A Context Integrated Residual Pyramid Network for Stereo Matching2019
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2019
- Non-locally Enhanced Encoder-Decoder Network for Single Image De-raining2018
- Pyramid Stereo Matching Network2018
- Speech-Transformer: A No-Recurrence Sequence-to-Sequence Model for Speech Recognition2018
- R-C3D: Region Convolutional 3D Network for Temporal Activity Detection2017