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

FORGE: 融合寄存器梯度消除以实现内存高效的大语言模型训练

FORGE: Fused On-Register Gradient Elimination for Memory-Efficient LLM Training

Puch AI;Singapore Institute of Technology(新加坡理工大学);Nanyang Technological University(南洋理工大学);NVIDIA(英伟达);IIIT-Delhi(德里印度理工学院)

Dikshant Kukreja, Kritarth Prasad, Avinash Anand, Zhengkui Wang, Erik Cambria, Timothy Liu, Aik Beng Ng, Simon See, Bapi Chatterjee

AI总结:

提出FORGE方法,将优化器步骤融合到反向传播中,逐块在寄存器中应用,消除梯度张量,减少内存占用并加速训练,在微调和持续预训练中速度提升约1.5倍。

摘要:

反向模式微分计算每个权重的梯度,将其写入内存,然后才让优化器读取。这种两阶段调度设定了现代训练的内存上限:在两个阶段的接缝处,每一层的梯度同时存在。我们认为这种物化的梯度是微分分阶段的产物,而不是学习所需的量——我们消除了它。FORGE将优化器步骤折叠到反向传播中,并一次一个块地应用,完全在寄存器中,因此每个梯度块在产生的瞬间就被消耗,永远不会成为张量。这种融合只改变更新的时机,而不改变其计算内容:在全精度下,融合步骤是可证明精确的——对于每个逐元素规则,优化器更新相同——并且这种精确性在张量并行和序列并行分片下得以保持;在实践中使用的bf16和8位模式下,它是忠实的而非比特相同的,其偏差有界,并且对于权重存储,通过随机舍入使其无偏。由于每个梯度块在相同的寄存器中产生和消耗,它永远不会被降级为bf16存储和读回;因此FORGE保留了全精度保真度,而bf16和8位优化器都会因这种转换而损失保真度。该方法也不依赖于特定架构或优化器:线性层无处不在,FORGE可以回收任何线性层在任意逐元素规则下的梯度内存。实验表明,FORGE将优化器步骤的内存减少一半以上,在微调和持续预训练典型的小批量大小下,运行速度约快1.5倍;集成到张量并行的Megatron-LM中,它可以在相同GPU上以标准优化器允许的四倍微批量大小进行8B训练。

英文摘要:

Reverse-mode differentiation computes every weight gradient, writes it to memory, and only then lets the optimizer read it back. This two-phase schedule sets the memory ceiling of modern training: at the seam between the phases, every layer's gradient is live at once. We argue that this materialized gradient is an artifact of how differentiation is staged, not a quantity that learning requires -- and we eliminate it. FORGE folds the optimizer step into the backward pass and applies it one tile at a time, entirely in registers, so each gradient tile is consumed the instant it is produced and never becomes a tensor. The fusion changes only when the update happens, not what it computes: in full precision the fused step is provably exact -- the identical optimizer update, for every element-wise rule -- and that exactness survives tensor- and sequence-parallel sharding; in the bf16 and 8-bit regimes used in practice it is faithful rather than bit-identical, its deviation bounded and, for the weight store, rendered unbiased by stochastic rounding. Because each gradient tile is born and consumed in the same registers, it is never converted down to bf16 to be stored and read back; FORGE thus preserves the full-precision fidelity that both bf16 and 8-bit optimizers lose to that conversion. Nor is the method tied to one architecture or one optimizer: linear layers are ubiquitous, and FORGE reclaims the gradient memory of any of them under any element-wise rule. Empirically FORGE more than halves the memory of an optimizer step and, at the small batch sizes typical of fine-tuning and continued pretraining, runs about 1.5x faster; integrated into tensor-parallel Megatron-LM it fits 8B training at four times the micro-batch a standard optimizer allows on the same GPUs.

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

↑