Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient Transformers

Zecheng Tang, Quantong Qiu, Yi Yang, Zhiyi Hong, Haiya Xiang +4 more
1/24/2026
cs.CLcs.AI

No official code found. Best implementation: LCM-Lab/Elastic-Attention (23 stars, Apache-2.0, last commit 2026-01-28).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient Transformers

232Shell, PythonJan 22, 20268 months agoApache-2.0
long-context-attentionlong-context-modeling

Similar Papers

Cite this paper

@article{tang2026elastic,
  title  = {Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient Transformers},
  author = {Zecheng Tang and Quantong Qiu and Yi Yang and Zhiyi Hong and Haiya Xiang and Kebin Liu and Qingqing Dang and Juntao Li and Min Zhang},
  year   = {2026},
  eprint = {2601.17367},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.17367v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2601.17367.svg)](https://codeofpaper.com/paper/2601.17367)

Discussion