HISA: Efficient Hierarchical Indexing for Fine-Grained Sparse Attention
该论文提出了一种名为HISA的分层索引稀疏注意力机制,通过两阶段的索引策略显著提升了长上下文处理中的稀疏注意力机制的效率。
更新于 2026-08-06。作者:Yufei Xu、Fanxu Meng、Fan Jiang、Yuxuan Wang、Ruijie Zhou、Jiexi Wu、Zhixin Pan、Zhaohui Wang、Xiaojuan Tang、Wenjie Pei、Tongxuan Liu、Di yin、Xing Sun、Muhan Zhang。
中文摘要
基于深度搜索稀疏注意力(DeepSeek Sparse Attention,简称DSA)的Token级稀疏注意力机制通过使用轻量级索引器为每个查询对历史中的每个标记进行评分,实现了细粒度的键选择,并且只在所选子集上计算注意力。虽然下游的稀疏注意力扩展效率很高,但索引器仍然需要为每个查询扫描整个前缀,引入了O(L^2)的每层瓶颈,随着上下文长度的增加,这变得难以承受。我们提出了HISA(分层索引稀疏注意力),它是索引器的直接替代品,将搜索过程从平面标记扫描转变为两阶段分层过程。首先,块级粗过滤器对池化块代表进行评分,以剪枝无关区域。然后,在剩余的候选块内应用原始索引器进行标记级细化。HISA保留了下游稀疏MLA操作所需的精确的token级top-k稀疏模式,且无需额外训练。在内核级基准测试中,HISA在32K上下文长度时实现了2倍的速度提升,在128K时实现了4倍的速度提升。在Needle-in-a-Haystack和LongBench上,我们直接将DeepSeek-V3.2中的索引器替换为HISA,无需任何微调。HISA在质量上与原始DSA非常接近,同时显著优于块稀疏基线。此外,由HISA和原始DSA产生的标记选择集的平均IoU大于99%,表明效率的提升几乎不会影响选择精度。
英文摘要
Token-level sparse attention mechanisms, exemplified by DeepSeek Sparse Attention (DSA), achieve fine-grained key selection by scoring every historical token for each query using a lightweight indexer, and then computing attention only over the selected subset. While the downstream sparse attention scales efficiently, the indexer still scans the entire prefix for every query, introducing an O(L^2) per-layer bottleneck that becomes prohibitive as context length grows. We propose HISA (Hierarchical Indexed Sparse Attention), a drop-in replacement for the indexer that transforms the search process from a flat token scan into a two-stage hierarchical procedure. First, a block-level coarse filter scores pooled block representatives to prune irrelevant regions. Then, a token-level refinement applies the original indexer only within the remaining candidate blocks. HISA preserves the exact token-level top-k sparsity pattern required by the downstream Sparse MLA operator and requires no additional training. On kernel-level benchmarks, HISA achieves a 2times speedup at 32K context length and 4times at 128K. On Needle-in-a-Haystack and LongBench, we directly replace the indexer in DeepSeek-V3.2 with HISA, without any fine-tuning. HISA closely matches the original DSA in quality while significantly outperforming block-sparse baselines. Moreover, the token selection sets produced by HISA and the original DSA exhibit a mean IoU greater than 99%, indicating that the efficiency gains come with virtually no impact on selection fidelity.
解读
一句话总结
该论文提出了一种名为HISA的分层索引稀疏注意力机制,通过两阶段的索引策略显著提升了长上下文处理中的稀疏注意力机制的效率。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:在长上下文中,稀疏注意力机制虽然提高了效率,但索引器扫描整个前缀的O(L^2)时间复杂度限制了整体性能。
- 现有方案不足:现有方法虽然使用了稀疏注意力,但索引器仍然需要扫描整个前缀,导致性能瓶颈。
- 研究目标:提出一种新的索引策略,减少索引器的搜索成本,同时保持稀疏注意力的质量。
问题2:论文的核心创新点是什么?
- 技术创新:提出了HISA,一个分层索引策略,通过块级粗略过滤和标记级细化两个阶段来减少搜索成本。
- 方法改进:HISA通过限制搜索范围来降低索引成本,同时保持了与原DSA相同的标记级top-k稀疏模式。
- 优势:HISA在保持与原DSA相同质量的同时,实现了2-4倍的内核级加速。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在32K和128K上下文中进行的内核级性能测试。
- 性能提升:HISA在32K上下文中实现了2倍的加速,在128K上下文中实现了4倍的加速。
- 对比结果:HISA在质量上与原DSA非常接近,而显著优于块级稀疏基线。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要处理长上下文的自然语言处理任务,如大型语言模型。
- 实施建议:可以直接替换现有索引器模块,无需额外的训练或架构修改。
- 局限与展望:HISA可能在高相关块跨语义边界的情况下导致信息损失,未来可以探索更精确的块级近似方法。
来源
机器可读索引:llms.txt