arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2605.27740cs.CL
收藏

UNIQUE: 通用Top-k稀疏注意力,用于免训练推理和稀疏感知训练

UNIQUE: Universal Top-k Sparse Attention for Training-free Inference and Sparsity-aware Training

Microsoft(微软)

Keqi Deng, Shaoshi Ling, Ruchao Fan, Jinyu Li

AI总结:

提出UNIQUE框架,通过基于键均值和标准差的页面重要性评分和软掩码稀疏感知训练,实现LLM长上下文推理中KV缓存的高效稀疏注意力,在保持任务性能的同时显著加速。

摘要:

大型语言模型(LLM)中的长上下文推理受到自注意力键值(KV)缓存线性增长的瓶颈限制。Top-k稀疏注意力通过仅加载一小部分KV缓存来缓解这一问题,但准确且廉价地估计缓存重要性(既用于免训练使用,也用于稀疏感知训练)仍然具有挑战性。本文提出UNIQUE,一个通用的top-k稀疏注意力框架,同时满足这两个需求,并在LLM模态中保持一致的有效性。UNIQUE以KV页面为粒度,通过一个简单而准确的评分来估计每页的重要性,该评分结合了页面键的均值作为代表性向量及其标准差作为偏移项。为了进一步缩小训练-推理差距,本文引入了一种软掩码稀疏感知训练方案,该方案使用top-k分数边界作为每个查询的阈值,并在其周围使用sigmoid软掩码,既不需要辅助损失,也不需要架构更改。在文本和语音LLM上的实验表明,UNIQUE在LongBench Pro等长上下文基准测试和长形式语音识别上保持了任务性能,同时与FlashInfer密集注意力相比,实现了高达11.4倍的注意力内核加速,并且与基于vLLM的密集模型相比,实现了至少5.3倍的端到端解码加速。

英文摘要:

Long-context inference in large language models (LLMs) is bottlenecked by the linear growth of the self-attention key-value (KV) cache. Top-k sparse attention alleviates this by loading only a small fraction of the KV cache, but accurately and cheaply estimating cache importance, for both training-free use and sparsity-aware training, remains challenging. This paper proposes UNIQUE, a universal top-k sparse attention framework that addresses both requirements and stays consistently effective across LLM modalities. UNIQUE operates at the granularity of KV pages and estimates per-page importance with a simple yet accurate score combining the mean of the page's keys as a representative vector with their standard deviation as an offset term. To further close the train-inference gap, this paper introduces a soft-mask sparsity-aware training scheme that uses the top-k score boundary as a per-query threshold and a sigmoid soft mask around it, requiring neither auxiliary losses nor architectural changes. Experiments on text and speech LLMs show that UNIQUE preserves task performance on long-context benchmarks such as LongBench Pro and on long-form speech recognition, while delivering up to 11.4x attention-kernel speedup over FlashInfer dense attention and at least 5.3x end-to-end decoding speedup over a vLLM-based dense model.

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

↑