NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ELFATT: Efficient Linear Fast Attention for Vision Transformers

Chong Wu, Maolin Che, Renjie Xu, Zhuoheng Ran, Hong Yan

Abstract

The attention mechanism is the key to the success of transformers in different machine learning tasks. However, the quadratic complexity with respect to the sequence length of the vanilla softmax-based attention mechanism becomes the major bottleneck for the application of long sequence tasks, such as vision tasks. Although various efficient linear attention mechanisms have been proposed, they need to sacrifice performance to achieve high efficiency. In this paper, we propose a novel efficient linear fast attention (ELFATT) mechanism to achieve low memory input/output operations, linear computational complexity, and high performance at the same time. ELFATT offers 4-7x speedups over the vanilla softmax-based attention mechanism in high-resolution vision tasks without losing performance. ELFATT is FlashAttention friendly, offering 2-3x speedups even with FlashAttention-2 acceleration.

Introduction: The Quadratic Bottleneck

At the heart of modern AI models, including Vision Transformers (ViTs) and Large Language Models (LLMs), lies the vanilla softmax attention mechanism. While powerful, its primary limitation is its quadratic scaling—$O(N^2)$—relative to the sequence length $N$. In the context of computer vision, this means that doubling the resolution of an input image results in a fourfold increase in computational cost, creating a significant bottleneck for high-resolution tasks.

Previous attempts to mitigate this have generally fallen into two categories:

  1. Memory-efficient methods (e.g., FlashAttention): These optimize hardware-level memory I/O to speed up runtimes but retain the underlying $O(N^2)$ mathematical complexity.
  2. Computation-efficient methods (Linear/Sparse Attention): These reduce complexity to $O(N)$ through mathematical approximations, but often at the cost of model accuracy. Furthermore, many lack optimization for GPU memory I/O, sometimes resulting in slower real-world performance than optimized $O(N^2)$ methods.

ELFATT bridges this gap by providing a mathematically linear $O(N)$ mechanism that is both highly accurate and optimized for modern GPU architectures.

Methodology: The Hybrid Parallel Head Architecture

ELFATT achieves its balance of speed and accuracy through a hybrid parallel head architecture. Rather than relying on a single approximation, each ELFATT block decomposes the attention operation into two specialized parallel heads.

Architecture of the ELFATT mechanism showing the parallel Global Linear and Sparse Blockify heads.

1. Global Linear Attention Head

This head utilizes a kernelized linear approximation to capture long-range, global dependencies across the entire sequence. By approximating the softmax kernel, it maintains linear computational complexity while ensuring the model retains a global field of view.

2. Sparse Blockify Attention Head

This head partitions the input sequence into smaller, localized blocks and computes attention exclusively within these boundaries. This introduces essential spatial inductive biases, helping the model understand local relationships within an image. Crucially, this component is designed to be FlashAttention-friendly, allowing it to leverage hardware-level optimizations for maximum inference speed.

The outputs of these heads are concatenated. The authors demonstrate theoretically that this combination results in a tighter approximation error bound to vanilla softmax attention than either method could achieve in isolation.

Experimental Results

The efficacy of ELFATT was evaluated across multiple benchmarks, including ImageNet-1K for classification, ADE20K for semantic segmentation, and MS COCO for object detection.

Image Classification and Efficiency

On ImageNet-1K, ELFATT consistently matched or exceeded the accuracy of baseline models while providing significant throughput improvements. As shown in the table below, ELFATT achieves higher FPS (frames per second) across various CSWin and Swin transformer backbones.

Performance comparison of ELFATT against other attention mechanisms on ImageNet-1K using CSWin and Swin backbones.

Key findings include:

  • High-Resolution Speedups: In high-resolution vision tasks, ELFATT offers 4-7x speedups over vanilla attention. When utilizing FlashAttention-2, it still provides a 2-3x speedup.
  • Long-Range Arena (LRA): On non-vision long-sequence tasks, ELFATT outperformed FlashAttention-2 in both accuracy and speed (1.2x to 2.3x faster).
  • Edge Performance: On NVIDIA Jetson devices, ELFATT delivered 1.6x to 2.0x speedups across various power modes (5W to 60W), demonstrating its suitability for resource-constrained environments.

Generative AI Integration

A notable feature of ELFATT is its "plug-and-play" capability. It can be integrated into existing diffusion models, such as Stable Diffusion v1.5, to accelerate inference without requiring retraining. In these tests, ELFATT generated images faster and with lower memory overhead than competing methods like Token Merging (ToMe), while simultaneously improving the FID score.

Conclusion

ELFATT represents a significant step forward in efficient attention mechanisms. By combining global linear attention with hardware-optimized sparse block attention, it overcomes the traditional trade-off between theoretical complexity and practical performance. Its compatibility with FlashAttention and its ability to enhance existing generative models make it a versatile tool for the next generation of high-resolution vision and long-sequence transformers.

Summary updated

BibTeX
@inproceedings{wu2025elfatt,
  author = {Chong Wu and Maolin Che and Renjie Xu and Zhuoheng Ran and Hong Yan},
  title = {{ELFATT: Efficient Linear Fast Attention for Vision Transformers}},
  booktitle = {ACM Multimedia},
  year = {2025},
  doi = {10.1145/3746027.3754825},
}
Figure