###
计算机系统应用英文版:2026,35(7):111-119
本文二维码信息
码上扫一扫!
长上下文场景下块稀疏注意力的分布式计算方案
(1.中国科学技术大学 计算机科学与技术学院, 合肥 230027;2.中国科学技术大学 软件学院, 合肥 230051;3.合肥综合性国家科学中心 人工智能研究院, 合肥 230026)
Distributed Computing Scheme with Block Sparse Attention in Long-context Scenarios
(1.School of Computer Science and Technology, University of Science and Technology of China, Hefei 230027, China;2.School of Software Engineering, University of Science and Technology of China, Hefei 230051, China;3.Institute of Artificial Intelligence, Hefei Comprehensive National Science Center, Hefei 230026, China)
摘要
图/表
参考文献
相似文献
本文已被:浏览 57次   下载 58
Received:November 20, 2025    Revised:December 12, 2025
中文摘要: 大语言模型的注意力机制在处理长序列时面临严峻的计算与显存挑战, 现有解决方案主要从算法优化和序列并行两个维度展开. 在算法层面, 块稀疏注意力机制通过在掩码矩阵中引入块稀疏性质降低计算复杂度, 其中Atrous稀疏和垂直-斜线稀疏是两种经典的稀疏模式; 在序列并行层面, 环形注意力通过高效扩展设备数量支持处理任意长度的序列. 然而, 当二者结合时, 环形注意力仍然采用密集注意力的序列切分方式, 导致大量无效的通信开销与计算开销, 难以实现预期加速效果. 本文针对Atrous和垂直-斜线两种经典的稀疏模式, 提出了定制化的序列切分方案以及高效简明的分布式计算方案: 对于Atrous稀疏模式, 采用分组计算策略, 将数据与设备均匀划分为相同数量的组, 在不同组内执行独立的环形注意力大幅提升计算效率; 对于垂直-斜线稀疏模式, 采用分解计算方案, 将其拆分为斜线稀疏和垂直稀疏两个子任务, 其中斜线稀疏部分实现无通信开销的本地计算, 垂直稀疏部分通过去除无关键值块的计算通信开销实现性能加速. 实验结果表明, 新的分布式优化方案在Atrous稀疏设置下实现了3–10.9倍的性能提升, 在垂直-斜线稀疏设置下实现了3–10.5倍的性能提升.
Abstract:The attention mechanism in large language models faces severe computational and memory challenges when processing long sequences. Existing solutions are mainly developed from two perspectives: algorithmic optimization and sequence parallelism. At the algorithmic level, block sparse attention reduces computational complexity by introducing block sparsity into the mask matrix, among which Atrous sparsity and vertical-slash sparsity are two classical sparsity patterns. At the sequence-parallel level, ring attention enables efficient scaling across devices to support arbitrary long-context processing. However, when these two approaches are combined, ring attention still adopts a dense sequence partitioning strategy, which introduces substantial redundant communication and computation overhead and prevents the expected acceleration. To address this issue, customized sequence partitioning schemes and efficient distributed computing solutions are proposed for Atrous sparsity and vertical-slash sparsity. For Atrous sparsity, a grouped computing strategy is adopted, where data and devices are evenly divided into the same number of groups, and independent ring attention is executed within each group to significantly improve computational efficiency. For vertical-slash sparsity, a decomposition-based computing strategy is employed, in which the sparsity pattern is decomposed into slash sparsity and vertical sparsity subtasks. The slash sparsity subtask is processed through communication-free local computation, while the vertical sparsity subtask achieves performance acceleration by eliminating the computation and communication overhead of non-critical key-value blocks. Experimental results demonstrate that the proposed distributed optimization achieves 3–9 times performance improvement under Atrous sparsity and 3–10.9 times improvement under vertical-slash sparsity.
文章编号:     中图分类号:    文献标志码:
基金项目:国家重点研发计划 (2024YFB4505701)
引用文本:
詹红瑞,戴子健,白有辉,许胤龙,李诚.长上下文场景下块稀疏注意力的分布式计算方案.计算机系统应用,2026,35(7):111-119
ZHAN Hong-Rui,DAI Zi-Jian,BAI You-Hui,XU Yin-Long,LI Cheng.Distributed Computing Scheme with Block Sparse Attention in Long-context Scenarios.COMPUTER SYSTEMS APPLICATIONS,2026,35(7):111-119