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

Q-GaLore: 结合INT4投影与层自适应低秩梯度的量化GaLore

Q-GaLore: Quantized GaLore with INT4 Projection and Layer-Adaptive Low-Rank Gradients

University of Texas at Austin(德克萨斯大学奥斯汀分校);University of Surrey(萨里大学);University of Oxford(牛津大学);California Institute of Technology(加州理工学院);Meta AI

Zhenyu Zhang, Ajay Jaiswal, Lu Yin, Shiwei Liu, Jiawei Zhao, Yuandong Tian, Zhangyang Wang

AI总结:

针对大语言模型训练内存开销高、GaLore方法SVD运算耗时及微调场景提升有限的问题,提出结合INT4量化投影与层自适应低秩梯度的Q-GaLore,大幅降低内存占用且性能优异。

摘要:

训练大语言模型(LLM)因参数数量庞大及配套优化状态众多,内存开销极高。近期提出的GaLore方法通过将权重梯度投影到低秩子空间来降低内存占用,且不损失性能。但GaLore依赖耗时的奇异值分解(SVD)运算来确定子空间,频繁的子空间更新会带来显著的训练时间开销。此外,在更易实现的微调场景中,GaLore相比LoRA在精度和效率上的提升十分有限。\n为解决这些局限,我们提出Q-GaLore这一全新方法,它结合量化与低秩投影技术大幅降低内存占用,效果优于GaLore。该方法基于两项关键观察:(i)梯度子空间特性各异,部分层在训练早期就已收敛,而其他层则会频繁变化;(ii)投影矩阵对低位量化具有极强的鲁棒性。\n基于这些发现,Q-GaLore根据梯度子空间的收敛统计量自适应更新子空间,在大幅减少SVD运算次数的同时实现了相当的性能。我们将投影矩阵保持为INT4格式,权重保持为INT8格式,并引入随机舍入来捕获累积的梯度信息。该方法仅使用低精度权重就能实现高精度的训练轨迹。\n实验证明,Q-GaLore在具备极高内存效率的同时,性能极具竞争力。在预训练阶段,Q-GaLore可在仅16GB内存的单张NVIDIA RTX 4060 Ti上从头训练LLaMA-7B模型。在微调阶段,相比LoRA和GaLore,它最多可降低50%的内存消耗,且在相同内存成本下性能始终优于QLoRA。

英文摘要:

Training Large Language Models (LLMs) is memory-intensive due to the large number of parameters and associated optimization states. GaLore, a recent method, reduces memory usage by projecting weight gradients into a low-rank subspace without compromising performance. However, GaLore relies on time-consuming Singular Value Decomposition (SVD) operations to identify the subspace, and the frequent subspace updates lead to significant training time overhead. Moreover, GaLore offers minimal improvements in accuracy and efficiency compared to LoRA in more accessible fine-tuning scenarios. To address these limitations, we introduce Q-Galore, a novel approach that substantially reduces memory usage by combining quantization and low-rank projection, surpassing the benefits of GaLore. Our method is based on two key observations: (i) the gradient subspace exhibits diverse properties, with some layers converging early in training while others are subject to frequent changes; (ii) the projection matrices are highly resilient to low-bit quantization. Leveraging these insights, Q-GaLore adaptively updates the gradient subspace based on its convergence statistics, achieving comparable performance while significantly reducing the number of SVD operations. We maintain the projection matrices in INT4 format and weights in INT8 format, incorporating stochastic rounding to capture accumulated gradient information. This approach enables a high-precision training trajectory using only low-precision weights. We demonstrate that Q-GaLore achieves highly competitive performance with exceptional memory efficiency. At pre-training, Q-GaLore facilitates training a LLaMA-7B model from scratch on a single NVIDIA RTX 4060 Ti with only 16 GB memory. At fine-tuning, it reduces memory consumption by up to 50% compared to LoRA and GaLore, while consistently outperforming QLoRA at the same memory cost.

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

↑