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

PackMamba:Mamba训练中变长序列的高效处理

PackMamba: Efficient Processing of Variable-Length Sequences in Mamba training

Shanghai Artificial Intelligence Laboratory(上海人工智能实验室);Renmin University of China(中国人民大学)

Haoran Xu, Ziqian Liu, Rong Fu, Zhongling Su, Zerui Wang, Zheng Cai, Zhilin Pei, Xingcheng Zhang

AI总结:

PackMamba通过修改Mamba的并行算子,高效处理变长序列,在A100上实现1.4B模型3.06倍、2.8B模型2.62倍的吞吐量提升。

摘要:

随着大型语言模型的发展,传统的Transformer模型在处理长序列时,由于计算量随序列长度呈二次方增长,计算需求变得非常高。Mamba作为生成式人工智能领域的一项开创性架构,在减少计算和内存复杂度的同时,展现出处理长序列的卓越能力。然而,现有的Mamba训练框架在处理变长序列输入时存在效率低下的问题。要么采用单序列训练导致GPU利用率低,要么将变长序列批处理到最大长度,这会带来可观的内存和计算开销。为解决此问题,我们分析了Mamba中瓶颈算子在各种张量形状下的性能,并提出了PackMamba,一种高吞吐量的Mamba,能够高效处理变长序列。深入状态空间模型(SSMs),我们修改了并行算子,以避免在单个序列之间传递信息,同时保持高性能。在NVIDIA A100 GPU上的实验结果表明,吞吐量超过了基线单序列处理方案:在1.4B模型上实现了3.06倍加速,在2.8B模型上实现了2.62倍加速。

英文摘要:

With the evolution of large language models, traditional Transformer models become computationally demanding for lengthy sequences due to the quadratic growth in computation with respect to the sequence length. Mamba, emerging as a groundbreaking architecture in the field of generative AI, demonstrates remarkable proficiency in handling elongated sequences with reduced computational and memory complexity. Nevertheless, the existing training framework of Mamba presents inefficiency with variable-length sequence inputs. Either single-sequence training results in low GPU utilization, or batched processing of variable-length sequences to a maximum length incurs considerable memory and computational overhead. To address this problem, we analyze the performance of bottleneck operators in Mamba under diverse tensor shapes and proposed PackMamba, a high-throughput Mamba that efficiently handles variable-length sequences. Diving deep into state-space models (SSMs), we modify the parallel operators to avoid passing information between individual sequences while maintaining high performance. Experimental results on an NVIDIA A100 GPU demonstrate throughput exceeding the baseline single-sequence processing scheme: 3.06x speedup on the 1.4B model and 2.62x on the 2.8B model.

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

↑