Simultaneously Boosting Efficiency and Capability for Linear Attention via Adaptive Channel Compression and Activation Purification
Organizations: Dalian University of Technology, Liaoning, China
Abstract
Self-attention's quadratic complexity constitutes a core bottleneck for Vision Transformers (ViTs). Existing efficiency-oriented optimizations, including softmax-based and linear attention (LA) variants, generally compromise model representational capacity, leading to inevitable performance degradation. We propose a novel linear attention which alleviates this efficiency-capability dilemma. For the first time, we embed an Adaptive Channel Compression and Activation Purification (ACCAP) mechanism into the QKV projection of linear attention, which enables the model to retain high-dimensional feature information while performing computations with reduced channels. We further fuse a focused kernel function and a self-gating module into ACCAP to construct a lightweight linear attention module (ACCAP-LA). Our theoretical analysis shows that, compared to standard linear attention, ACCAP-LA reduces the attention module's parameter count by 79.17% and FLOPs by 77.5%. Extensive experiments demonstrate ACCAP-LA's effectiveness: when applied to ViT, it achieves 79.4% Top-1 accuracy on ImageNet-1K with only 5.8M parameters, and more notably, it boasts strong cross-architecture compatibility, boosting EfficientViT-b1 and PVT-T by 3.3% and 3.4% respectively.
Figures & tables
| Model | |||
|---|---|---|---|
| M0 | |||
| M1 | |||
| M2 | |||
| M3 |
| Category | Item | Setting |
| Computing Env. | Software | PyTorch 2.0.1, CUDA 12.2 |
| CPU | Intel Xeon Platinum 8280 | |
| GPU | 8 RTX 3090 | |
| Eval. Protocol | Resolution | 224 224 |
| ImageNet-1K | Optimizer | AdamW |
| Epochs | 300 |
| Models | Top-1 (%) | Top-5 (%) | FLOPs (M) | Params (M) |
| EfficientViT-M0 [ 20 ] | 63.2 | 85.4 | 79 | 2.3 |
| S3ML-ViT-M0 [ 9 ] | 67.1 | 87.4 | 110 | 2.5 |
| Mobile-Former-52M [ 21 ] | 68.7 | - | 52 | 3.5 |
| ShuffleNetV2 1.0x [ 22 ] | 69.4 | 88.9 | 146 | 2.3 |
| MobileViTV2-0.5 [ 23 ] | 70.2 | - | 466 | 1.4 |
| ACCAP-ViT-M0 (ours) | 72.3 | 90.7 | 191 | 2.4 |
| Models | RetinaNet 1× | FLOPs | Params | |||||
|---|---|---|---|---|---|---|---|---|
| AP | AP 50 | AP 75 | AP s | AP m | AP l | (M) | (M) | |
| MobileNetV3 [ 35 ] | 29.9 | 49.3 | 30.8 | 14.9 | 33.3 | 41.1 | 217 | 5.4 |
| MNASNet-A2 [ 36 ] | 30.5 | 50.2 | 32.0 | 15.6 | 34.1 | 41.0 | 340 | 4.8 |
| SPOS [ 37 ] | 30.7 | 49.8 | 32.2 | 15.4 | 33.9 | 41.6 | 365 | 4.3 |
| FairNAS-C [ 38 ] | 31.2 | 50.8 | 32.7 | 16.3 | 34.4 | 42.3 | 325 | 5.6 |
| S3ML-ViT-M1 [ 9 ] | 31.5 | 49.6 | 33.2 | 17.2 | 33.9 | 42.2 | 190 | 4.4 |
| Module Removed | Top-1 (%) |
|---|---|
| ACCAP-ViT-M1 | 77.488 |
| w/o ACCAP | -3.838 |
| w/o Focused Kernel Function | -0.258 |
| w/o Multi-Scale Feature | -0.692 |
| w/o Self-Gating | -0.562 |
| w/o Self-Gating’s activation function | -0.284 |
| Models | Top-1 Accuracy (%) | Params (M) |
|---|---|---|
| EfficientViT-b1 | 78.1 | 9.1 |
| EfficientViT-b1* | 81.4(+3.3) | 9.0 |
| PVT-T | 75.1 | 13.2 |
| PVT-T* | 78.5(+3.4) | 13.2 |
| Swin-T | 80.8 | 28.3 |
| Swin-T* | 81.6(+0.8) | 29.1 |
| Method | Latency↓ (ms) | Throughput↑ (samples/s) |
|---|---|---|
| EfficientViT | 0.8222 | 1216.23 |
| HLSM-ViT | 0.4067 | 2458.70 |
| S3ML-ViT | 0.3780 | 2645.40 |
| PVT | 0.1637 | 6107.67 |
| Agent-PVT | 0.1244 | 8038.12 |
| Swin | 0.0991 | 10092.15 |
| Compression Ratio\Expansion Ratio | 1/2 | 1/4 | 1/8 |
|---|---|---|---|
| 1/2 | -1.664 | -0.170 | -0.500 |
| 1/4 | 77.488 | -0.476 | -0.594 |
| 1/8 | -0.198 | -0.804 | -0.936 |
| 1/16 | -0.630 | -0.868 | -0.910 |
Efficient ViTs
Efficient Vision Transformers reduce the compute, memory, energy, or latency needed to process images and video while retaining useful accuracy.
See all 264 papers