HISA:面向细粒度稀疏注意力的高效分层索引
HISA: Efficient Hierarchical Indexing for Fine-Grained Sparse Attention
AI总结:
HISA通过分层索引机制优化稀疏注意力,减少每个查询扫描完整前缀的开销,提升64K上下文长度下的效率,同时保持与原始DSA相似的质量。
摘要:
Token级稀疏注意力机制,如DeepSeek Sparse Attention (DSA),通过轻量级索引器对每个查询的每个历史键进行评分,然后仅在选定子集上计算注意力。尽管下游稀疏注意力本身具有良好的扩展性,但索引器仍需为每个查询扫描整个前缀,导致随着上下文长度增加而变得不可接受。我们提出HISA(分层索引稀疏注意力),这是一种可直接替换索引器的解决方案,将搜索路径从平面token扫描转换为两阶段分层过程:(1)块级粗过滤阶段,通过池化块表示评分以丢弃无关区域,随后是(2)token级精炼阶段,仅在保留的候选块内应用原始索引器。HISA保持与下游Sparse MLA操作符相同的token级top-sparse模式,且无需额外训练。在内核级基准测试中,HISA在64K上下文长度上实现了高达的速度提升。在Needle-in-a-Haystack和LongBench上,我们直接将DeepSeek-V3.2和GLM-5的索引器替换为我们的HISA索引器,无需微调。HISA在质量上与原始DSA接近,同时显著优于块稀疏基线。
英文摘要:
Token-level sparse attention mechanisms, exemplified by DeepSeek Sparse Attention (DSA), achieve fine-grained key selection by scoring every historical key for each query through a lightweight indexer, then computing attention only on the selected subset. While the downstream sparse attention itself scales favorably, the indexer must still scan the entire prefix for every query, introducing an per-layer bottleneck that grows prohibitively with context length. We propose HISA (Hierarchical Indexed Sparse Attention), a plug-and-play replacement for the indexer that rewrites the search path from a flat token scan into a two-stage hierarchical procedure: (1) a block-level coarse filtering stage that scores pooled block representations to discard irrelevant regions, followed by (2) a token-level refinement stage that applies the original indexer exclusively within the retained candidate blocks. HISA preserves the identical token-level top-sparse pattern consumed by the downstream Sparse MLA operator and requires no additional training. On kernel-level benchmarks, HISA achieves up to speedup at 64K context. On Needle-in-a-Haystack and LongBench, we directly replace the indexer in DeepSeek-V3.2 and GLM-5 with our HISA indexer, without any finetuning. HISA closely matches the original DSA in quality, while substantially outperforming block-sparse baselines.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。