arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.17896cs.LGcs.AI
收藏

长上下文注意力基准:从内核效率到分布式上下文并行

Long-Context Attention Benchmark: From Kernel Efficiency to Distributed Context Parallelism

State Key Laboratory for Novel Software Technology, Nanjing University, China(南京大学新型软件技术国家重点实验室);Zhejiang University, China(浙江大学);Peking University, China(北京大学)

Tao Bu, Qiangang Wang, Bowen Zeng, Hanwen Sun, Yunpeng Huang, Chun Cao, Jingwei Xu

AI总结:

本文提出统一长上下文注意力基准,整合代表性注意力内核与上下文并行机制,在最多96个GPU上按掩码模式、序列长度和分布式规模评估,揭示权衡并指导部署。

摘要:

基于 Transformer 的大型语言模型(LLM)取得了显著成功,但其标准注意力机制会随序列长度产生二次方的计算和内存开销,成为长上下文训练的主要瓶颈。以往工作沿两个方向应对该挑战:(1)内核级优化,用于加速稠密和稀疏注意力算子;(2)模块级策略,通常称为分布式注意力或上下文并行训练,用于在多个设备上扩展注意力。然而,系统性评估仍然有限:算子级比较往往不完整,而上下文并行策略通常绑定特定框架,跨上下文场景的性能分析也不清晰。为弥补这些空白,我们提出一个统一基准,通过模块化、可扩展的评估接口整合具有代表性的注意力内核和上下文并行机制。该基准沿两个关键维度评估方法:(1)注意力掩码模式,其强烈影响效率、可扩展性和可用性;(2)序列长度与分布式规模,其决定极端长上下文训练下的性能。通过在最多 96 个 GPU 的集群上进行综合实验,我们的基准支持可复现比较,揭示不同方法特有的权衡,并为长上下文 LLM 训练中注意力机制的设计和部署提供实用指导。

英文摘要:

Transformer-based large language models (LLMs) have achieved remarkable success, yet their standard attention mechanism incurs quadratic computation and memory costs with respect to sequence length, posing a major bottleneck for long-context training. Prior work tackles this challenge along two directions: (1) kernel-level optimizations, which accelerate dense and sparse attention operators; and (2) module-level strategies, often referred to as distributed attention or context parallel training, which scale attention across multiple devices. However, systematic evaluation still remains limited: operator-level comparisons are often incomplete, while context parallel strategies are typically framework-specific, with unclear performance analysis across contexts. To address these gaps, we propose a unified benchmark that integrates representative attention kernels and context parallel mechanisms with a modular and extensible interface for evaluation. The benchmark evaluates methods along two critical dimensions: (1) attention mask patterns, which strongly affect efficiency, scalability, and usability, and (2) sequence length and distributed scale, which determine performance under extreme long-context training. Through comprehensive experiments on the cluster of up to 96 GPUs, our benchmark enables reproducible comparisons, highlights method-specific trade-offs, and provides practical guidance for designing and deploying attention mechanisms in long-context LLM training.

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

↑