AttentionIndex:基于因果倒排索引加速学习型稀疏注意力机制
AttentionIndex: Accelerating Learned Sparse Attention with a Causal Inverted-File Index
AI总结:
提出AttentionIndex,通过倒排索引优化学习型稀疏注意力的预填充效率,在100万token规模下提升吞吐量与准确率,优于穷尽选择和HiSA方法。
摘要:
学习型稀疏注意力机制被用于DeepSeek-V4、GLM-5等生产模型中,它让每个查询仅关注轻量索引器选出的k个键,但索引器仍会对前缀中的所有键打分。在100万token规模下,这种选择过程占用了超过一半的预填充时间。像HiSA那样对连续块进行两阶段选择可降低该成本,但在固定候选预算下,其召回率会随上下文增长而下降。本文提出AttentionIndex,它通过倒排索引为每个查询路由,该索引按相似度对索引器键分组,并利用原生索引器分数细化候选。AttentionIndex在预填充期间构建索引,使新键可立即被搜索,复用先前的聚类以降低维护成本,且仅让每个查询接触基于其自身前缀构建的聚类。在100万token规模的GLM-5.3和DeepSeek-V4-Flash上,AttentionIndex的预填充吞吐量是穷尽选择的1.3-1.8倍;在吞吐量与HiSA相差不超过5%时,它分别多恢复了穷尽top-k的17.0和10.0个百分点。在相同候选预算下,AttentionIndex在长上下文基准上的准确率比HiSA最高提升18.4个百分点。
英文摘要:
Learned sparse attention, used in production models such as DeepSeek-V4 and GLM-5, lets each query attend to only k keys chosen by a lightweight indexer, but the indexer still scores every key in the prefix. At one million tokens, this selection takes more than half of prefill time. Two-stage selection over contiguous blocks, as in HiSA, reduces this cost, but its recall declines as context grows at a fixed candidate budget. We present AttentionIndex, which routes each query over an inverted-file index that groups indexer keys by similarity and refines the candidates with the native indexer score. AttentionIndex builds the index during prefill, making new keys searchable immediately, reusing previous clustering to keep maintenance cheap, and exposing each query only to clusters built from its own prefix. On GLM-5.3 and DeepSeek-V4-Flash at one million tokens, AttentionIndex delivers 1.3-1.8 times the prefill throughput of exhaustive selection, and at throughput within 5% of HiSA, it recovers 17.0 and 10.0 percentage points more of the exhaustive top-k, respectively. AttentionIndex also improves accuracy on long-context benchmarks by up to 18.4 percentage points over HiSA at the same candidate budget.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。