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

AB-Sparse:基于自适应块大小的稀疏注意力用于准确且高效的长上下文推理

AB-Sparse: Sparse Attention with Adaptive Block Size for Accurate and Efficient Long-Context Inference

Shanghai Jiao Tong University(上海交通大学);Ant Group(蚂蚁集团)

Di Liu, Ruitian Wang, Chen Chen, Mingliang Gong, Yongjie Yuan, Han Zhao, Yu Feng, Quan Chen, Minyi Guo

AI总结:

AB-Sparse通过自适应块大小分配提升长上下文推理的准确性,同时保持吞吐量,采用无损块中心量化和定制GPU内核实现高效执行。

摘要:

随着大语言模型扩展到更长的上下文,注意力计算过程中KV缓存的加载成为关键瓶颈。先前研究表明注意力计算主要由少量token主导。这促使了块稀疏注意力方法,将KV缓存划分为固定大小的块,并选择性地计算重要性高的块。然而,这些方法在所有注意力头中使用统一的块大小,隐含假设模型行为均匀。我们的分析表明这一假设不成立:注意力头对块粒度的敏感性差异很大,统一性导致准确性不足。我们提出AB-Sparse,一种无需训练的算法-系统协同设计框架,提升准确性的同时保持吞吐量。AB-Sparse引入轻量级自适应块大小分配,以提高准确性。为补偿额外的内存开销,进一步采用无损块中心量化。此外,开发了定制GPU内核以支持高效执行变量块大小。评估结果表明,AB-Sparse在现有块稀疏注意力基线之上实现了高达5.43%的准确性提升,而无吞吐量开销。

英文摘要:

As large language models scale to longer contexts, loading the growing KV cache during attention computation becomes a critical bottleneck. Previous work has shown that attention computation is dominated by a small subset of tokens. This motivates block sparse attention methods that partition the KV cache into fixed-size blocks and selectively compute attention over those blocks exhibiting high importance. However, these methods assign a uniform block size across all attention heads, implicitly assuming homogeneous behavior throughout the model. Our analysis reveals that this assumption is flawed: attention heads exhibit widely varying sensitivity to block granularity, and uniformity leads to suboptimal accuracy. We present AB-Sparse, a training-free algorithm-system co-designed framework that improves accuracy while preserving throughput. AB-Sparse introduces lightweight adaptive block size allocation across attention heads to improve accuracy. To compensate for the additional memory overhead, it further employs lossless block centroid quantization. In addition, custom GPU kernels are developed to support efficient execution with variable block sizes. Evaluation results demonstrate that AB-Sparse achieves an accuracy improvement of up to 5.43% over existing block sparse attention baselines without throughput overhead.

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

↑