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

GaLore:通过梯度低秩投影实现内存高效的LLM训练

GaLore: Memory-Efficient LLM Training by Gradient Low-Rank Projection

California Institute of Technology(加州理工学院);University of Texas at Austin(德克萨斯大学奥斯汀分校);Meta AI;Carnegie Mellon University(卡内基梅隆大学)

Jiawei Zhao, Zhenyu Zhang, Beidi Chen, Zhangyang Wang, Anima Anandkumar, Yuandong Tian

AI总结:

本研究提出GaLore训练策略,通过梯度低秩投影实现全参数学习,在保持性能的同时显著减少内存使用,首次证明在24GB消费级GPU上预训练7B模型的可行性。

摘要:

训练大型语言模型(LLMs)面临显著的内存挑战,主要由于权重和优化器状态的规模不断增长。常见的内存减少方法,如低秩适应(LoRA),在每层向冻结的预训练权重添加可训练的低秩矩阵,从而减少可训练参数和优化器状态。然而,这类方法在预训练和微调阶段通常不如全秩权重训练表现好,因为它们将参数搜索限制在低秩子空间内并改变了训练动态,且可能需要全秩预热。在本研究中,我们提出梯度低秩投影(GaLore),这是一种允许全参数学习但比LoRA等常见低秩适应方法更节省内存的训练策略。我们的方法在优化器状态中减少高达65.5%的内存使用,同时在C4数据集上使用高达19.7B token对LLaMA 1B和7B架构进行预训练,以及在GLUE任务上微调RoBERTa时,保持效率和性能。与BF16基线相比,我们的8位GaLore进一步将优化器内存减少高达82.5%,总训练内存减少63.3%。值得注意的是,我们首次证明了在24GB内存的消费级GPU(如NVIDIA RTX 4090)上预训练7B模型的可行性,无需模型并行、检查点或卸载策略。

英文摘要:

Training Large Language Models (LLMs) presents significant memory challenges, predominantly due to the growing size of weights and optimizer states. Common memory-reduction approaches, such as low-rank adaptation (LoRA), add a trainable low-rank matrix to the frozen pre-trained weight in each layer, reducing trainable parameters and optimizer states. However, such approaches typically underperform training with full-rank weights in both pre-training and fine-tuning stages since they limit the parameter search to a low-rank subspace and alter the training dynamics, and further, may require full-rank warm start. In this work, we propose Gradient Low-Rank Projection (GaLore), a training strategy that allows full-parameter learning but is more memory-efficient than common low-rank adaptation methods such as LoRA. Our approach reduces memory usage by up to 65.5% in optimizer states while maintaining both efficiency and performance for pre-training on LLaMA 1B and 7B architectures with C4 dataset with up to 19.7B tokens, and on fine-tuning RoBERTa on GLUE tasks. Our 8-bit GaLore further reduces optimizer memory by up to 82.5% and total training memory by 63.3%, compared to a BF16 baseline. Notably, we demonstrate, for the first time, the feasibility of pre-training a 7B model on consumer GPUs with 24GB memory (e.g., NVIDIA RTX 4090) without model parallel, checkpointing, or offloading strategies.

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

↑