Castling-ViT: Compressing Self-Attention via Switching Towards Linear-Angular Attention at Vision Transformer Inference
Not on the map. Why?
Abstract (arXiv)
Vision Transformers (ViTs) have shown impressive performance but still require a high computation cost as compared to convolutional neural networks (CNNs), one reason is that ViTs' attention measures global similarities and thus has a quadratic complexity with the number of input tokens. Existing efficient ViTs adopt local attention (e.g., Swin) or linear attention (e.g., Performer), which sacrifice ViTs' capabilities of capturing either global or local context. In this work, we ask an important research question: Can ViTs learn both global and local context while being more efficient during inference? To this end, we propose a framework called Castling-ViT, which trains ViTs using both linear-angular attention and masked softmax-based quadratic attention, but then switches to having only linear angular attention during ViT inference. Our Castling-ViT leverages angular kernels to measure the similarities between queries and keys via spectral angles. And we further simplify it with two techniques: (1) a novel linear-angular attention mechanism: we decompose the angular kernels into linear terms and high-order residuals, and only keep the linear terms; and (2) we adopt two parameterized modules to approximate high-order residuals: a depthwise convolution and an auxiliary masked softmax attention to help learn both global and local information, where the masks for softmax attention are regularized to gradually become zeros and thus incur no overhead during ViT inference. Extensive experiments and ablation studies on three tasks consistently validate the effectiveness of the proposed Castling-ViT, e.g., achieving up to a 1.8% higher accuracy or 40% MACs reduction on ImageNet classification and 1.2 higher mAP on COCO detection under comparable FLOPs, as compared to ViTs with vanilla softmax-based attentions.
Key facts. Cited by 28 papers in the map (data through 14 Oct 2026). Builds on 64 of its 79 references that are in the map. First posted on arXiv 18 Nov 2022.
Builds on
64 of 79 references.
References · 64
- 2017Attention Is All You Needcited by 60,361
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2014Microsoft COCO: Common Objects in Contextcited by 17,608
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
- 2020End-to-End Object Detection with Transformerscited by 7,414
- 2021Masked Autoencoders Are Scalable Vision Learnerscited by 7,403
- 2019EfficientNet: Rethinking Model Scaling for Convolutional Neural Networkscited by 6,442
- 2018MobileNetV2: Inverted Residuals and Linear Bottleneckscited by 4,795
- 2020Training data-efficient image transformers & distillation through attentioncited by 4,586
- 2020Deformable DETR: Deformable Transformers for End-to-End Object Detectioncited by 3,422
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2021Masked-attention Mask Transformer for Universal Image Segmentationcited by 2,351
38 more
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
- 2019Searching for MobileNetV3cited by 1,994
- 2021Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutionscited by 1,962
- 2020Reformer: The Efficient Transformercited by 1,668
- 2020Rethinking Attention with Performerscited by 1,601
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
- 2021Per-Pixel Classification is Not All You Need for Semantic Segmentationcited by 1,152
- 2021Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNetcited by 1,101
- 2021YOLOX: Exceeding YOLO Series in 2021cited by 1,071
- 2022Token Merging: Your ViT But Fastercited by 1,021
- 2019EfficientDet: Scalable and Efficient Object Detectioncited by 1,020
- 2020Designing Network Design Spacescited by 960
- 2021CvT: Introducing Convolutions to Vision Transformerscited by 947
- 2017Revisiting Unreasonable Effectiveness of Data in Deep Learning Eracited by 919
- 2021Multiscale Vision Transformerscited by 897
- 2021DynamicViT: Efficient Vision Transformers with Dynamic Token Sparsificationcited by 864
- 2021CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classificationcited by 806
- 2021Going deeper with Image Transformerscited by 764
- 2021PVT v2: Improved Baselines with Pyramid Vision Transformercited by 751
- 2022Exploring Plain Vision Transformer Backbones for Object Detectioncited by 724
- 2021MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformercited by 642
- 2021CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windowscited by 527
- 2021MViTv2: Improved Multiscale Vision Transformers for Classification and Detectioncited by 519
- 2022MaxViT: Multi-Axis Vision Transformercited by 476
- 2021LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inferencecited by 475
- 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 471
- 2018Efficient Attention: Attention with Linear Complexitiescited by 368
- 2019Frequency Principle: Fourier Analysis Sheds Light on Deep Neural Networkscited by 368
- 2021AdaViT: Adaptive Tokens for Efficient Vision Transformercited by 362
- 2021Rethinking Spatial Dimensions of Vision Transformerscited by 361
- 2021XCiT: Cross-Covariance Image Transformerscited by 338
- 2022EfficientFormer: Vision Transformers at MobileNet Speedcited by 241
- 2022cosFormer: Rethinking Softmax in Attentioncited by 213
- 2021AutoFormer: Searching Transformers for Visual Recognitioncited by 188
- 2021Scatterbrain: Unifying Sparse and Low-rank Attention Approximationcited by 130
- 2022QuadTree Attention for Vision Transformerscited by 129
- 2021SOFT: Softmax-free Transformer with Linear Complexitycited by 128
- 2020Lite Transformer with Long-Short Range Attentioncited by 127
50 most cited of 64 All 64 (JSON)
Built on by
Citing papers per year: 2023: 6; 2024: 11; 2025: 6; 2026: 5.
28 papers.
Sort:
By area:
- 2023EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anythingcited by 188
- 2023FLatten Transformer: Vision Transformer using Focused Linear Attentioncited by 171
- 2023Agent Attention: On the Integration of Softmax and Linear Attentioncited by 90
- 2024Bridging the Divide: Reconsidering Softmax and Linear Attentioncited by 48
- 2024A Survey on Transformer Compressioncited by 46
- 2023A survey on efficient vision transformers: algorithms, techniques, and performance benchmarkingcited by 41
- 2025PolaFormer: Polarity-aware Linear Attention for Vision Transformerscited by 32
- 2024Breaking the Low-Rank Dilemma of Linear Attentioncited by 31
- 2024Efficient Diffusion Transformer with Step-wise Dynamic Attention Mediatorscited by 24
- 2024Efficient Track Anythingcited by 21
- 2025Rectifying Magnitude Neglect in Linear Attentioncited by 16
- 2023ShiftAddViT: Mixture of Multiplication Primitives Towards Efficient Vision Transformercited by 15
16 more
- 2023Computation-efficient Deep Learning for Computer Vision: A Surveycited by 14
- 2024PaPr: Training-Free One-Step Patch Pruning with Lightweight ConvNets for Faster Inferencecited by 9
- 2024When Linear Attention Meets Autoregressive Decoding: Towards More Effective and Efficient Linearized Large Language Modelscited by 9
- 2025Not Every Patch is Needed: Towards a More Efficient and Effective Backbone for Video-based Person Re-identificationcited by 7
- 2024PADRe: A Unifying Polynomial Attention Drop-in Replacement for Efficient Vision Transformercited by 5
- 2025Linear Differential Vision Transformer: Learning Visual Contrasts via Pairwise Differentialscited by 4
- 2024Trio-ViT: Post-Training Quantization and Acceleration for Softmax-Free Efficient Vision Transformercited by 3
- 2024Automatic Channel Pruning for Multi-Head Attentioncited by 3
- 2025AnchorFormer: Differentiable Anchor Attention for Efficient Vision Transformercited by 3
- 2025Norm×Direction: Restoring the Missing Query Norm in Vision Linear Attentioncited by 2
- 2026BinaryAttention: One-Bit QK-Attention for Vision and Diffusion Transformerscited by 1
- 2024Long-Term Prediction Accuracy Improvement of Data-Driven Medium-Range Global Weather Forecastcited by 0
- 2026MirrorLA: Reflecting Feature Map for Vision Linear Attentioncited by 0
- 2026Attention to details, logits to truth: visual-aware attention and logits enhancement to mitigate hallucinations in LVLMscited by 0
- 2026RAViT: Resolution-Adaptive Vision Transformercited by 0
- 2026Do Vision Transformers Need All-to-All Attention? Global Communication Through Elastic Learned Corescited by 0
- 2026Do Vision Transformers Need All-to-All Attention? Global Communication Through Elastic Learned Cores12 May 2026
- 2026BinaryAttention: One-Bit QK-Attention for Vision and Diffusion Transformers10 Mar 2026
- 2026RAViT: Resolution-Adaptive Vision Transformer27 Feb 2026
- 2026Attention to details, logits to truth: visual-aware attention and logits enhancement to mitigate hallucinations in LVLMs10 Feb 2026
- 2026MirrorLA: Reflecting Feature Map for Vision Linear Attention4 Feb 2026
- 2025Linear Differential Vision Transformer: Learning Visual Contrasts via Pairwise Differentials2 Nov 2025
- 2025Rectifying Magnitude Neglect in Linear Attention1 Jul 2025
- 2025Norm×Direction: Restoring the Missing Query Norm in Vision Linear Attention26 Jun 2025
- 2025AnchorFormer: Differentiable Anchor Attention for Efficient Vision Transformer22 May 2025
- 2025Not Every Patch is Needed: Towards a More Efficient and Effective Backbone for Video-based Person Re-identification28 Jan 2025
- 2025PolaFormer: Polarity-aware Linear Attention for Vision Transformers25 Jan 2025
- 2024Bridging the Divide: Reconsidering Softmax and Linear Attention9 Dec 2024
16 more
- 2024Efficient Track Anything28 Nov 2024
- 2024Breaking the Low-Rank Dilemma of Linear Attention12 Nov 2024
- 2024Efficient Diffusion Transformer with Step-wise Dynamic Attention Mediators11 Aug 2024
- 2024PADRe: A Unifying Polynomial Attention Drop-in Replacement for Efficient Vision Transformer16 Jul 2024
- 2024Long-Term Prediction Accuracy Improvement of Data-Driven Medium-Range Global Weather Forecast26 Jun 2024
- 2024When Linear Attention Meets Autoregressive Decoding: Towards More Effective and Efficient Linearized Large Language Models11 Jun 2024
- 2024Automatic Channel Pruning for Multi-Head Attention31 May 2024
- 2024Trio-ViT: Post-Training Quantization and Acceleration for Softmax-Free Efficient Vision Transformer6 May 2024
- 2024PaPr: Training-Free One-Step Patch Pruning with Lightweight ConvNets for Faster Inference24 Mar 2024
- 2024A Survey on Transformer Compression5 Feb 2024
- 2023Agent Attention: On the Integration of Softmax and Linear Attention14 Dec 2023
- 2023EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anything1 Dec 2023
- 2023A survey on efficient vision transformers: algorithms, techniques, and performance benchmarking5 Sep 2023
- 2023Computation-efficient Deep Learning for Computer Vision: A Survey27 Aug 2023
- 2023FLatten Transformer: Vision Transformer using Focused Linear Attention1 Aug 2023
- 2023ShiftAddViT: Mixture of Multiplication Primitives Towards Efficient Vision Transformer10 Jun 2023
- 2023EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anythingcited by 188
- 2023FLatten Transformer: Vision Transformer using Focused Linear Attentioncited by 171
- 2023Agent Attention: On the Integration of Softmax and Linear Attentioncited by 90
- 2024Bridging the Divide: Reconsidering Softmax and Linear Attentioncited by 48
- 2024A Survey on Transformer Compressioncited by 46
- 2023A survey on efficient vision transformers: algorithms, techniques, and performance benchmarkingcited by 41
- 2025PolaFormer: Polarity-aware Linear Attention for Vision Transformerscited by 32
- 2024Breaking the Low-Rank Dilemma of Linear Attentioncited by 31
- 2024Efficient Track Anythingcited by 21
- 2025Rectifying Magnitude Neglect in Linear Attentioncited by 16
- 2023Computation-efficient Deep Learning for Computer Vision: A Surveycited by 14
- 2024PaPr: Training-Free One-Step Patch Pruning with Lightweight ConvNets for Faster Inferencecited by 9
12 most cited of 23 All 23 (JSON)
- 2026Do Vision Transformers Need All-to-All Attention? Global Communication Through Elastic Learned Cores12 May 2026
- 2026RAViT: Resolution-Adaptive Vision Transformer27 Feb 2026
- 2026MirrorLA: Reflecting Feature Map for Vision Linear Attention4 Feb 2026
- 2025Linear Differential Vision Transformer: Learning Visual Contrasts via Pairwise Differentials2 Nov 2025
- 2025Rectifying Magnitude Neglect in Linear Attention1 Jul 2025
- 2025Norm×Direction: Restoring the Missing Query Norm in Vision Linear Attention26 Jun 2025
- 2025AnchorFormer: Differentiable Anchor Attention for Efficient Vision Transformer22 May 2025
- 2025Not Every Patch is Needed: Towards a More Efficient and Effective Backbone for Video-based Person Re-identification28 Jan 2025
- 2025PolaFormer: Polarity-aware Linear Attention for Vision Transformers25 Jan 2025
- 2024Bridging the Divide: Reconsidering Softmax and Linear Attention9 Dec 2024
- 2024Efficient Track Anything28 Nov 2024
- 2024Breaking the Low-Rank Dilemma of Linear Attention12 Nov 2024
12 newest of 23 All 23 (JSON)