arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.06465cs.LGcs.DC
收藏

加速大型语言模型训练:4D并行与内存消耗估计器

Accelerating Large Language Model Training with 4D Parallelism and Memory Consumption Estimator

School of Computing, Institute of Science Tokyo(科学技术学院计算机学院);Turing. inc(图灵公司);Super Computing Research Center, Institute of Science Tokyo(科学技术学院超级计算研究中心)

Kazuki Fujii, Kohei Watanabe, Rio Yokota

AI总结:

本研究提出精确内存估计公式,用于Llama架构的4D并行训练,通过454次实验验证,当估计内存低于GPU内存80%时无内存溢出,可提前识别风险配置并缩小搜索空间,提供最优配置经验。

摘要:

在大型语言模型(LLM)训练中,采用多种并行化策略,包括张量并行(TP)、流水线并行(PP)、数据并行(DP),以及序列并行(SP)和上下文并行(CP),以在设备间分布模型参数、激活值和优化器状态。为每个环境确定最优并行化配置同时避免GPU内存溢出仍是一项具有挑战性的任务。在本研究中,我们提供了精确的公式来估计Llama架构中4D并行训练(DP、TP、PP、CP)所消耗的参数、梯度、优化器状态和激活值的内存。我们在A100和H100 GPU上进行了454次实验,将临时缓冲区和内存碎片化等常被忽视的因素纳入分析。结果表明,当估计内存使用量低于可用GPU内存的80%时,训练从未遇到内存不足错误。这一简单而有效的公式使我们能够提前识别可能导致内存溢出的并行化配置,显著减少配置搜索空间。此外,通过对4D并行中最优配置的全面探索,我们对454次实验结果的分析为最优4D并行配置提供了经验性见解。

英文摘要:

In large language model (LLM) training, several parallelization strategies, including Tensor Parallelism (TP), Pipeline Parallelism (PP), Data Parallelism (DP), as well as Sequence Parallelism (SP) and Context Parallelism (CP), are employed to distribute model parameters, activations, and optimizer states across devices. Identifying the optimal parallelization configuration for each environment while avoiding GPU memory overflow remains a challenging task. In this study, we provide precise formulas to estimate the memory consumed by parameters, gradients, optimizer states, and activations for 4D parallel training (DP, TP, PP, CP) in the Llama architecture. We conducted 454 experiments on A100 and H100 GPUs, incorporating often neglected factors such as temporary buffers and memory fragmentation into our analysis. Results indicate that when the estimated memory usage is below 80\% of the available GPU memory, the training never encounters out-of-memory errors. This simple yet effective formula allows us to identify parallelization configurations that could lead to memory overflow in advance, significantly reducing the configuration search space. Additionally, through a comprehensive exploration of optimal configurations in 4D parallelism, our analysis of the 454 experimental results provides empirical insights into optimal 4D parallelism configurations.

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

↑