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.


翻译:随着大语言模型处理更长上下文的能力提升,注意力计算过程中加载不断增长的键值缓存已成为关键性能瓶颈。已有研究表明,注意力计算主要集中在一小部分令牌子集上。这催生了块稀疏注意力方法——将键值缓存划分为固定大小的块,并选择性计算那些具有高重要性的块。然而,这些方法为所有注意力头分配统一块大小,隐含假设模型内部具有同质性。我们的分析揭示这一假设存在缺陷:不同注意力头对块粒度的敏感性差异显著,统一设置会导致次优的准确率。本文提出AB-Sparse——一种无需训练的算法-系统协同设计框架,在保持吞吐量的同时提升准确率。AB-Sparse通过跨注意力头的轻量级自适应块大小分配机制提高准确率,并采用无损块质心量化补偿额外内存开销。此外,我们开发了定制化GPU内核以支持可变块大小的高效执行。评估结果表明,相比现有块稀疏注意力基线方法,AB-Sparse在无吞吐量损失的情况下实现了高达5.43%的准确率提升。

0
下载
关闭预览

相关内容

TransMLA:多头潜在注意力(MLA)即为所需
专知会员服务
23+阅读 · 2025年2月13日
【ACL2024】通过直接偏好优化的自训练提升链式思维推理
【CVPR2023】BiFormer:基于双层路由注意力的视觉Transformer
专知会员服务
36+阅读 · 2023年3月20日
注意力机制可解释吗?这篇ACL 2019论文说……
机器之心
11+阅读 · 2019年6月16日
干货!自然语言处理中的自注意力机制!
全球人工智能
11+阅读 · 2018年3月27日
深度学习中的注意力机制
人工智能头条
16+阅读 · 2017年11月2日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
0+阅读 · 6月12日
VIP会员
最新内容
《异构无人水面艇集群作战自主制导算法》130页
《人工智能能通过美国陆军战争学院吗?》报告
军事域人工智能驱动系统的治理
专知会员服务
4+阅读 · 9月14日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员