Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient Transformers
Abstract
Elastic Attention enables dynamic adjustment of attention sparsity during inference by integrating a lightweight Attention Router into pretrained models, achieving efficient long-context processing.
The quadratic complexity of standard attention mechanisms poses a significant scalability bottleneck for large language models (LLMs) in long-context scenarios. While hybrid attention strategies that combine sparse and full attention within a single model offer a viable solution, they typically employ static computation ratios (i.e., fixed proportions of sparse versus full attention) and fail to adapt to the varying sparsity sensitivities of downstream tasks during inference. To address this issue, we propose Elastic Attention, which allows the model to dynamically adjust its overall sparsity based on the input. This is achieved by integrating a lightweight Attention Router into the existing pretrained model, which dynamically assigns each attention head to different computation modes. Within only 12 hours of training on 8xA800 GPUs, our method enables models to achieve both strong performance and efficient inference. Experiments across three long-context benchmarks on widely-used LLMs demonstrate the superiority of our method.
Community
Elastic Attention enables models to achieve both strong performance and efficient inference by dynamically allocating computation modes (Full Attention or Sparse Attention) to each attention head through our designed Attention Router, adapting sparsity ratios based on input characteristics.
Code & Training data: https://github.com/LCM-Lab/Elastic-Attention
Model Collection: https://modelscope.cn/collections/LCM_group/Elastic-Attention
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- A Unified Sparse Attention via Multi-Granularity Compression (2025)
- BLASST: Dynamic BLocked Attention Sparsity via Softmax Thresholding (2025)
- Accelerate Speculative Decoding with Sparse Computation in Verification (2025)
- Training-free Context-adaptive Attention for Efficient Long Context Modeling (2025)
- Block Sparse Flash Attention (2025)
- VersatileFFN: Achieving Parameter Efficiency in LLMs via Adaptive Wide-and-Deep Reuse (2025)
- PSA: Pyramid Sparse Attention for Efficient Video Understanding and Generation (2025)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
arXivlens breakdown of this paper ๐ https://arxivlens.com/PaperView/Details/elastic-attention-test-time-adaptive-sparsity-ratios-for-efficient-transformers-8412-02d813dc
- Executive Summary
- Detailed Breakdown
- Practical Applications
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper