arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2412.01523cs.DCcs.LG
收藏

FlexSP:通过灵活序列并行加速大语言模型训练

FlexSP: Accelerating Large Language Model Training via Flexible Sequence Parallelism

Peking University(北京大学);Beihang University(北京航空航天大学);ByteDance Inc.(字节跳动公司)

Yujie Wang, Shiju Wang, Shenhan Zhu, Fangcheng Fu, Xinyi Liu, Xuefeng Xiao, Huixia Li, Jiashi Li, Faming Wu, Bin Cui

AI总结:

针对LLM训练中序列长度异质性导致的工作负载不均衡问题,提出FlexSP灵活序列并行方法,通过动态调整分散策略适应不同长度序列,在保持精度的同时将长上下文训练吞吐量提升1.2-1.98倍。

摘要:

扩展大语言模型(LLMs)的上下文长度(即最大支持序列长度)至关重要。为促进LLMs的长上下文训练,序列并行已成为关键技术,它将每个输入序列分散到多个设备上,并需要通信来处理序列。本质上,现有序列并行方法假设序列长度同质(即所有输入序列长度相等),因此对所有输入序列采用单一、静态的分散策略。然而,实际中LLM训练语料的序列长度存在显著差异,常遵循长尾分布,导致工作负载异质性。本文提出FlexSP,一种灵活的序列并行方法,通过动态调整分散策略以适应序列长度的异质性。具体而言,FlexSP首先分析每个训练批次中序列长度的分布,然后为不同长度的序列分配最优的分散策略,以最小化通信开销和负载不平衡。我们在多个LLM模型(包括GPT-2和OPT)上进行实验,结果表明,与现有静态序列并行方法相比,FlexSP在长上下文训练中可将吞吐量提高1.2-1.98倍,同时保持模型精度不变。此外,FlexSP可无缝集成到现有训练框架中,无需修改模型架构或训练流程。

英文摘要:

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.

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

↑