arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.17367cs.CLcs.AI
收藏

弹性注意力:用于高效变换器的测试时间自适应稀疏率

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

Soochow University, China(苏州大学);LCM Laboratory(LCM实验室);Baidu Inc, China(百度公司)

Zecheng Tang, Quantong Qiu, Yi Yang, Zhiyi Hong, Haiya Xiang, Kebin Liu, Qingqing Dang, Juntao Li, Min Zhang

AI总结:

弹性注意力通过动态调整稀疏率提升LLMs在长上下文任务中的效率与性能。

摘要:

标准注意力机制的二次复杂度在长上下文场景中对大型语言模型(LLMs)构成了显著的可扩展性瓶颈。虽然结合稀疏和完整注意力的混合注意力策略提供了一种可行的解决方案,但它们通常使用静态计算比例(即固定比例的稀疏与完整注意力),无法在推理过程中适应下游任务的稀疏敏感性变化。为了解决这个问题,我们提出了弹性注意力,使模型能够根据输入动态调整其整体稀疏性。这通过在现有预训练模型中集成一个轻量级的注意力路由器来实现,该路由器动态地将每个注意力头分配到不同的计算模式中。在仅用8块A800 GPU训练12小时后,我们的方法使模型能够实现强大的性能和高效的推理。在三个长上下文基准测试上广泛使用的LLMs上的实验展示了我们方法的优越性。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑