2025-02-13 · 进阶 · 计算机视觉 · 自然语言处理 · 机器学习

LASP-2: Rethinking Sequence Parallelism for Linear Attention and Its Hybrid

该论文提出了一种新的序列并行化方法LASP-2,旨在提高线性注意力模型的训练效率,特别是针对长序列输入。

更新于 2025-02-13。作者:Weigao Sun、Disen Lan、Yiran Zhong、Xiaoye Qu、Yu Cheng。

中文摘要

线性序列建模方法,如线性注意力,提供了线性时间训练和恒定内存推理的优点,这些优点适用于序列长度。然而,现有的序列并行(SP)方法要么没有针对线性注意力中的右乘先行的特性进行优化,要么使用环形通信策略,这导致计算并行性降低,限制了它们在分布式系统中处理长序列的可扩展性。在本文中,我们介绍了LASP-2,这是一种新的SP方法,旨在提高使用非常长输入序列训练线性注意力变换器模型时的通信和计算并行性。与之前的LASP工作相比,LASP-2重新思考了线性注意力层上SP的最小通信需求,重新组织了LASP的整个通信-计算工作流程。通过这种方式,只需要在中间内存状态上进行一次单一的AllGather集体通信,其大小与序列长度无关,从而显著提高了通信和计算并行性,以及它们的重叠。此外,我们将LASP-2扩展为LASP-2H,通过将类似的通信重新设计应用于标准注意力模块,为混合模型提供了一种高效的SP解决方案,这些混合模型结合了线性注意力层和标准注意力层。我们在Linear-Llama3模型上的评估,这是用线性注意力替换标准注意力的Llama3变体,证明了LASP-2和LASP-2H的有效性。具体来说,LASP-2在64个GPU上,序列长度为2048K的情况下,相对于LASP实现了15.2%的训练速度提升,相对于环形注意力实现了36.6%的提升。代码作为以下部分的一部分发布:https://github.com/OpenSparseLLMs/Linear-MoE。

英文摘要

Linear sequence modeling approaches, such as linear attention, provide advantages like linear-time training and constant-memory inference over sequence lengths. However, existing sequence parallelism (SP) methods are either not optimized for the right-product-first feature of linear attention or use a ring-style communication strategy, which results in lower computation parallelism, limits their scalability for longer sequences in distributed systems. In this paper, we introduce LASP-2, a new SP method to enhance both communication and computation parallelism when training linear attention transformer models with very-long input sequences. Compared to previous work LASP, LASP-2 rethinks the minimal communication requirement for SP on linear attention layers, reorganizes the whole communication-computation workflow of LASP. In this way, only one single AllGather collective communication is needed on intermediate memory states, whose sizes are independent of the sequence length, leading to significant improvements of both communication and computation parallelism, as well as their overlap. Additionally, we extend LASP-2 to LASP-2H by applying similar communication redesign to standard attention modules, offering an efficient SP solution for hybrid models that blend linear and standard attention layers. Our evaluation on a Linear-Llama3 model, a variant of Llama3 with linear attention replacing standard attention, demonstrates the effectiveness of LASP-2 and LASP-2H. Specifically, LASP-2 achieves training speed improvements of 15.2% over LASP and 36.6% over Ring Attention, with a sequence length of 2048K across 64 GPUs. The Code is released as a part of: https://github.com/OpenSparseLLMs/Linear-MoE.

解读

一句话总结

该论文提出了一种新的序列并行化方法LASP-2,旨在提高线性注意力模型的训练效率,特别是针对长序列输入。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源