Efficient AI

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

ZZecheng TangQQuantong QiuYYi YangZZhiyi HongHHaiya XiangKKebin LiuQQingqing DangJJuntao LiMMin Zhang
Published
January 24, 2026
Authors
9
Word Count
15,654
Code
Includes code

Dynamic sparsity for efficient transformer models.

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.

Key Takeaways

  • 1

    Dynamic sparsity levels improve efficiency and performance.

  • 2

    Attention Router module adds minimal computational cost.

  • 3

    Elastic Attention outperforms baselines on long-context tasks.

Limitations

  • Requires pretrained models for integration.

  • Dependent on task-specific characteristics for routing decisions.

Keywords

standard attention mechanismssparse attentionfull attentionhybrid attention strategiesattention routerattention headslong-context scenariospretrained modelscomputational efficiency

More in Efficient AI

View all
Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient Transformers | Paperchime