提出动态序列并行方法,提升大模型长文本训练效率。
FlexSP: Accelerating Large Language Model Training via Flexible Sequence Parallelism
- 根据序列长度差异动态分配并行策略,避免资源浪费。
- 实测训练速度比现有框架快1.98倍。
- 适合处理长文本、序列长度不一的大模型训练场景。
扩展大语言模型(LLM)的上下文长度至关重要。为支持长上下文训练,序列并行已成为关键技术,将每个输入序列分摊到多个设备上处理,需依赖通信完成计算。现有方法假设所有输入序列长度相同,采用统一的静态分摊策略。然而,实际训练数据中序列长度分布呈长尾特征,导致工作负载不均。本文表明,单一静态策略会引发效率低下与资源闲置,亟需适应异构负载的动态方案。为此,我们提出一种异构自适应序列并行方法:每轮训练中,根据序列长度变化,结合工作负载特征,自动选择最优分摊策略组合。将该问题建模为线性规划优化,并设计高效求解器以获得最优解。进一步,我们在高性能系统中实现了支持动态并行化的分布式LLM训练。实验结果表明,本系统相较当前最佳训练框架,性能提升最高达1.98倍。
原文摘要 · Abstract (English)
Extending the context length (i.e., the maximum supported sequence length) of LLMs is of paramount significance. To facilitate long context training of LLMs, sequence parallelism has emerged as an essential technique, which scatters each input sequence across multiple devices and necessitates communication to process the sequence. In essence, existing sequence parallelism methods assume homogeneous sequence lengths (i.e., all input sequences are equal in length) and therefore leverages a single, static scattering strategy for all input sequences. However, in reality, the sequence lengths in LLM training corpora exhibit substantial variability, often following a long-tail distribution, which leads to workload heterogeneity. In this paper, we show that employing a single, static strategy results in inefficiency and resource under-utilization, highlighting the need for adaptive approaches to handle the heterogeneous workloads across sequences. To address this, we propose a heterogeneity-adaptive sequence parallelism method. For each training step, our approach captures the variability in sequence lengths and assigns the optimal combination of scattering strategies based on workload characteristics. We model this problem as a linear programming optimization and design an efficient and effective solver to find the optimal solution. Furthermore, we implement our method in a high-performance system that supports adaptive parallelization in distributed LLM training. Experimental results demonstrate that our system outperforms state-of-the-art training frameworks by up to 1.98x.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。