arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.01910cs.LGcs.AIcs.DC
收藏

随机稀疏注意力用于内存受限推理

Stochastic Sparse Attention for Memory-Bound Inference

University of California, Santa Barbara(加州大学圣芭芭拉分校);University of Michigan(密歇根大学);Carnegie Mellon University(卡内基梅隆大学)

Kyle Lee, Corentin Delacour, Kevin Callahan-Coray, Kyle Jiang, Can Yaras, Samet Oymak, Tathagata Srimani, Kerem Y. Camsari

AI总结:

提出SANTA方法,通过从后softmax分布中采样稀疏索引来减少值缓存访问,实现无乘法的高效解码,在Llama-3.1-8B-Instruct上获得1.5倍注意力核加速和1.25倍端到端加速。

摘要:

自回归解码在长上下文中变得带宽受限,因为生成每个token需要从KV缓存中读取所有$n_k$个键和值向量。我们提出随机加法无乘法注意力(SANTA),一种通过从后softmax分布中采样$S \ll n_k$个索引并仅聚合这些值行来稀疏化值缓存访问的方法。这产生了后softmax值聚合的无偏估计,同时将值阶段的乘加运算替换为收集和加法。我们引入分层和系统采样来设计方差减少、GPU友好的变体。在32k token上下文的Llama-3.1-8B-Instruct上评估,S$^2$ANTA匹配基线准确率,同时在NVIDIA RTX 6000 Ada上相比FlashInfer和FlashDecoding实现高达1.5倍解码步注意力核加速。在批处理长上下文生成中,这些核增益转化为高达1.25倍的端到端解码延迟加速。最后,我们提出伯努利$qK^\mathsf{T}$采样作为补充技术来稀疏化分数阶段,通过随机三元查询减少键特征访问。两种方法对上游量化、低秩投影、KV缓存压缩和KV缓存选择方法互补。它们共同指向稀疏、无乘法和节能的推理。我们在https://github.com/OPUSLab/SANTA.git开源了我们的核。

英文摘要:

Autoregressive decoding becomes bandwidth-limited at long contexts, as generating each token requires reading all $n_k$ key and value vectors from KV cache. We present Stochastic Additive No-mulT Attention (SANTA), a method that sparsifies value-cache access by sampling $S \ll n_k$ indices from the post-softmax distribution and aggregates only those value rows. This yields an unbiased estimator of the post-softmax value aggregation while replacing value-stage multiply-accumulates with gather-and-add. We introduce stratified and systematic sampling to design variance-reduced, GPU-friendly variants. Evaluated on Llama-3.1-8B-Instruct at 32k-token contexts, S$^2$ANTA matches baseline accuracy while achieving up to $1.5\times$ decode-step attention-kernel speedup over FlashInfer and FlashDecoding on an NVIDIA RTX 6000 Ada. In batched long-context generation, these kernel gains translate to up to $1.25\times$ end-to-end decode-latency speedup. Finally, we propose Bernoulli $qK^\mathsf{T}$ sampling as a complementary technique to sparsify the score stage, reducing key-feature access through stochastic ternary queries. Both methods are complementary to upstream quantization, low-rank projection, KV-cache compression, and KV-cache selection methods. Together, they point toward sparse, multiplier-free, and energy-efficient inference. We open-source our kernels at: https://github.com/OPUSLab/SANTA.git

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

↑