arXiv:2504.14519cs.LGcs.AI2025-04被引 11

SlimPipe让长文本大模型训练更省内存、更高效。

SlimPipe: Memory-Thrifty and Efficient Pipeline Parallelism for Long-Context LLM Training

  • 用细粒度分片+1F1B调度,把激活内存压到只剩一份
  • 512K上下文时,计算效率比现有方法高1.57倍
  • 适合超长文本训练,尤其在80GB显存的Hopper GPU上表现优异

流水线并行(PP)是训练大语言模型的关键技术,能缓解模型状态带来的内存压力,且通信开销较低。但在长上下文场景下,现有方法难以应对显著的激活内存压力,主要源于多个微批次激活累积导致的峰值内存占用。同时,这些方法不可避免引入大量流水线空洞,进一步降低效率。为此,我们提出SlimPipe,一种细粒度流水线并行新方法,结合均匀序列切分与一前一后(1F1B)调度策略,将多个微批次的累积激活压缩为仅一份,并分割为多个切片。尽管切片均等划分,但由于因果注意力机制,各切片计算量不均衡。为此,我们设计了精细化的工作负载重分配机制以解决负载不平衡问题。SlimPipe实现近零内存开销与最小流水线空洞。通过多种模型架构、上下文窗口大小及特定配置的充分验证,证明其有效性。例如,在Llama 70B模型上,相比现有最优方法,当上下文长度为512K时,模型浮点运算利用率(MFU)最高提升至1.57倍;更关键的是,在2048K上下文长度下,仍能在256块NVIDIA Hopper 80GB GPU上保持超过45%的利用率,而其他方法或性能严重下降,或因内存不足完全失败。

原文摘要 · Abstract (English)

Pipeline Parallelism (PP) serves as a crucial technique for training Large Language Models (LLMs), owing to its capability to alleviate memory pressure from model states with relatively low communication overhead. However, in long-context scenarios, existing pipeline parallelism methods fail to address the substantial activation memory pressure, primarily due to the peak memory consumption resulting from the accumulation of activations across multiple microbatches. Moreover, these approaches inevitably introduce considerable pipeline bubbles, further hindering efficiency. To tackle these challenges, we propose SlimPipe, a novel approach to fine-grained pipeline parallelism that employs uniform sequence slicing coupled with one-forward-one-backward (1F1B) schedule. It reduces the accumulated activations from several microbatches to just one, which is split into several slices. Although the slices are evenly partitioned, the computation cost is not equal across slices due to causal attention. We develop a sophisticated workload redistribution technique to address this load imbalance. SlimPipe achieves (1) near-zero memory overhead and (2) minimal pipeline bubbles simultaneously. The effectiveness of SlimPipe has been proven by thorough testing with diverse model architectures, context window sizes, and SlimPipe-specific configurations. For example, on the Llama 70B model, compared to state-of-the-art methods, SlimPipe significantly boosts the Model FLOPs Utilization (MFU) to up to $1.57\times$ for a context length of 512K. More notably, for a context length of 2048K, it maintains over 45% utilization on 256 NVIDIA Hopper 80GB GPUs, while other approaches either suffer significant performance drops or fail entirely due to memory constraints.

长文本生成流水线并行内存优化大模型训练

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。