Learned Queries for Efficient Local Attention
Moab Arar, Ariel Shamir, Amit H. Bermano
Abstract
Vision Transformers (ViT) serve as powerful vision models. Unlike convolutional neural networks, which dominated vision research in previous years, vision transformers enjoy the ability to capture long-range dependencies in the data. Nonetheless, an integral part of any transformer architecture, the self-attention mechanism, suffers from high latency and inefficient memory utilization, making it less suitable for high-resolution input images. To alleviate these shortcomings, hierarchical vision models locally employ self-attention on non-interleaving windows. This relaxation reduces the complexity to be linear in the input size; however, it limits the cross-window interaction, hurting the model performance. In this paper, we propose a new shift-invariant local attention layer, called query and attend (QnA), that aggregates the input locally in an overlapping manner, much like convolutions. The key idea behind QnA is to introduce learned queries, which allow fast and efficient implementation. We verify the effectiveness of our layer by incorporating it into a hierarchical vision transformer model. We show improvements in speed and memory complexity while achieving comparable accuracy with state-of-the-art models. Finally, our layer scales especially well with window size, requiring up to x10 less memory while being up to x5 faster than existing methods. The code is publicly available at https://github.com/ moabarar/qna.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
18 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- TransNeXt: Robust Foveal Visual Perception for Vision Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- TransNeXt: Robust Foveal Visual Perception for Vision Transformers cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- TransNeXt: Robust Foveal Visual Perception for Vision Transformers cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
- TransNeXt: Robust Foveal Visual Perception for Vision Transformers cites Training data-efficient image transformers & distillation through attention
- Lightweight Vision Transformer with Bidirectional Interaction cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Lightweight Vision Transformer with Bidirectional Interaction cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Lightweight Vision Transformer with Bidirectional Interaction cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
- Lightweight Vision Transformer with Bidirectional Interaction cites Training data-efficient image transformers & distillation through attention
- Unleashing the Power of Generic Segmentation Model: A Simple Baseline for Infrared Small Target Detection cites TransNeXt: Robust Foveal Visual Perception for Vision Transformers
- Unleashing the Power of Generic Segmentation Model: A Simple Baseline for Infrared Small Target Detection cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Unleashing the Power of Generic Segmentation Model: A Simple Baseline for Infrared Small Target Detection cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites CCNet: Criss-Cross Attention for Semantic Segmentation
- InterDiff: Generating 3D Human-Object Interactions with Physics-Informed Diffusion cites Single Motion Diffusion
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Training data-efficient image transformers & distillation through attention
- Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions cites CCNet: Criss-Cross Attention for Semantic Segmentation
- Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions cites Training data-efficient image transformers & distillation through attention
- Training data-efficient image transformers & distillation through attention cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Cited by top-tier papers18
- TransNeXt: Robust Foveal Visual Perception for Vision TransformersDai ShiCVPR 2024 · 313 citations
- InterDiff: Generating 3D Human-Object Interactions with Physics-Informed DiffusionSirui Xu, Zhengyuan Li, Yu-Xiong Wang, Liang-Yan GuiICCV 2023 · 201 citations
- Single Motion DiffusionSigal Raab, Inbal Leibovitch, Guy Tevet, Moab Arar et al.ICLR 2024 · 81 citations
- Lightweight Vision Transformer with Bidirectional InteractionQihang Fan, Huaibo Huang, Xiaoqiang Zhou, Ran HeNeurIPS 2023 · 59 citations
- Unleashing the Power of Generic Segmentation Model: A Simple Baseline for Infrared Small Target DetectionMingjin Zhang, Chi Zhang, Qiming Zhang, Yunsong Li et al.ACM MM 2024 · 33 citations
Builds on34
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- Training data-efficient image transformers & distillation through attentionHugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa et al.ICML 2021 · 8,974 citations
- Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without ConvolutionsWenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan et al.ICCV 2021 · 4,909 citations
- CCNet: Criss-Cross Attention for Semantic SegmentationZilong Huang, Xinggang Wang, Lichao Huang, Chang Huang et al.ICCV 2019 · 2,972 citations
Related papers
- QT-ViT: Improving Linear Attention in ViT with Quadratic Taylor ExpansionYixing Xu, Chao Li, Dong Li, Xiao Sheng et al.NeurIPS 2024 · 7 citations
- Slide-Transformer: Hierarchical Vision Transformer with Local Self-AttentionXuran Pan, Tianzhu Ye, Zhuofan Xia, Shiji Song et al.CVPR 2023
- Scalable Vision Transformers with Hierarchical PoolingZizheng Pan, Bohan Zhuang, Jing Liu, Haoyu He et al.ICCV 2021 · 154 citations
- You Only Need Less Attention at Each Stage in Vision TransformersShuoxi Zhang, Hanpeng Liu, Stephen Lin, Kun HeCVPR 2024 · 19 citations
- ViTAE: Vision Transformer Advanced by Exploring Intrinsic Inductive BiasYufei Xu, Qiming Zhang, Jing Zhang, Dacheng TaoNeurIPS 2021 · 429 citations
