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

Natural GaLore:加速 GaLore 以实现内存高效的 LLM 训练与微调

Natural GaLore: Accelerating GaLore for memory-efficient LLM Training and Fine-tuning

ERGO Group AG(ERGO集团股份公司)

Arijit Das

AI总结:

本文提出 Natural GaLore,利用逆经验 Fisher 信息矩阵和 Woodbury 恒等式加速低秩梯度优化,在预训练和微调任务中以更少内存超越 GaLore、LoRA 甚至 GPT4-Turbo。

摘要:

由于数据、权重和优化器状态的规模不断增长,训练大语言模型(LLM)面临显著的内存挑战。数据并行、模型并行、梯度检查点和卸载策略等技术可以解决这一问题,但由于硬件限制往往不可行。为了减少内存使用,参数高效微调(PEFT)和 GaLore 等替代方法会对权重或优化器状态进行近似。LoRA 等 PEFT 方法在微调 LLM 方面已广受欢迎,尽管它们需要全秩热启动。相比之下,GaLore 允许全参数学习,同时具有更高的内存效率。本文提出 Natural GaLore,一种可直接替代 AdamW 的简单方法,它利用 Woodbury 恒等式将逆经验 Fisher 信息矩阵高效地应用于低秩梯度。我们证明,引入二阶信息能显著加速优化,尤其是在迭代预算有限的情况下。在 C4 数据上对 60M、130M、350M 和 1.1B 参数的 Llama 模型进行经验预训练表明,与 GaLore 相比,困惑度显著降低,且没有额外的内存开销。通过在 GLUE 基准上使用 Natural GaLore 微调 RoBERTa,我们证明与全量微调的差距显著缩小,为 86.05% 对比 86.28%。此外,使用 TinyAgent 框架对 TinyLlama 1.1B 模型进行函数调用微调表明,Natural GaLore 在 TinyAgent 数据集上达到 83.09% 的准确率,显著优于 16 位 LoRA 的 80.06%,甚至比 GPT4-Turbo 高出 4%,同时内存使用减少 30%。复现所有结果的代码可在以下地址获取:https://github.com/selfsupervised-ai/Natural-GaLore.git

英文摘要:

Training LLMs presents significant memory challenges due to growing size of data, weights, and optimizer states. Techniques such as data and model parallelism, gradient checkpointing, and offloading strategies address this issue but are often infeasible due to hardware constraints. To mitigate memory usage, alternative methods like Parameter-Efficient-Fine-Tuning (PEFT) and GaLore approximate weights or optimizer states. PEFT methods, such as LoRA, have gained popularity for fine-tuning LLMs, though they require a full-rank warm start. In contrast, GaLore allows full-parameter learning while being more memory-efficient. This work introduces Natural GaLore, a simple drop in replacement for AdamW, which efficiently applies the inverse Empirical Fisher Information Matrix to low-rank gradients using Woodbury's Identity. We demonstrate that incorporating second-order information speeds up optimization significantly, especially when the iteration budget is limited. Empirical pretraining on 60M, 130M, 350M, and 1.1B parameter Llama models on C4 data demonstrate significantly lower perplexity over GaLore without additional memory overhead. By fine-tuning RoBERTa on the GLUE benchmark using Natural GaLore, we demonstrate significant reduction in gap 86.05% vs 86.28% for full-finetuning. Furthermore, fine-tuning the TinyLlama 1.1B model for function calling using the TinyAgent framework shows that Natural GaLore achieving 83.09% accuracy on the TinyAgent dataset, significantly outperforms 16-bit LoRA at 80.06% and even surpasses GPT4-Turbo by 4%, all while using 30% less memory. All code to reproduce the results are available at: https://github.com/selfsupervised-ai/Natural-GaLore.git

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

↑