Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient Transformers
Abstract
Lay Summary
This paper introduces a new way to make large language models handle very long texts more efficiently. Current AI models often become slow and expensive when processing long documents because they try to pay attention to every word equally. Existing solutions reduce this cost by forcing the model to ignore some information, but they usually use a fixed strategy that cannot adapt to different tasks. We propose Elastic Attention, a method that allows the model to automatically decide how much information it needs for each input during inference. For simpler tasks like summarization, the model can safely ignore more details and run faster. For more demanding tasks like question answering or reasoning, it can preserve more detailed attention to maintain accuracy. To achieve this, we add a lightweight routing component that dynamically assigns different attention behaviors to different parts of the model without changing the original pretrained model. Our method improves the balance between efficiency and performance while adding very little extra computation. Experiments on multiple long-context benchmarks and several widely used language models show that Elastic Attention consistently achieves stronger results than existing efficient attention methods, especially on long-document reasoning and retrieval tasks. The method can also be trained quickly and deployed efficiently on practical hardware, making long-context AI systems more accessible and cost-effective.