Skip to main content
QUICK REVIEW

[论文解读] LoRA-GA: Low-Rank Adaptation with Gradient Approximation

Shaowen Wang, Linxi Yu|arXiv (Cornell University)|Jul 6, 2024
Image and Signal Denoising Methods被引用 4
一句话总结

LoRA-GA 提出了一种新颖的基于梯度的低秩微调(LoRA)初始化方法,通过使低秩适配器矩阵的初始梯度与全量微调的梯度对齐,从而加速收敛。通过使用全模型梯度矩阵的前r个奇异向量来初始化适配器矩阵,LoRA-GA 实现了与全量微调相当的收敛速度,在 GSM8K 上相比基线 LoRA 提升高达 11.52%,并将训练 FLOPs 减少 2–4 倍。

ABSTRACT

Fine-tuning large-scale pretrained models is prohibitively expensive in terms of computational and memory costs. LoRA, as one of the most popular Parameter-Efficient Fine-Tuning (PEFT) methods, offers a cost-effective alternative by fine-tuning an auxiliary low-rank model that has significantly fewer parameters. Although LoRA reduces the computational and memory requirements significantly at each iteration, extensive empirical evidence indicates that it converges at a considerably slower rate compared to full fine-tuning, ultimately leading to increased overall compute and often worse test performance. In our paper, we perform an in-depth investigation of the initialization method of LoRA and show that careful initialization (without any change of the architecture and the training algorithm) can significantly enhance both efficiency and performance. In particular, we introduce a novel initialization method, LoRA-GA (Low Rank Adaptation with Gradient Approximation), which aligns the gradients of low-rank matrix product with those of full fine-tuning at the first step. Our extensive experiments demonstrate that LoRA-GA achieves a convergence rate comparable to that of full fine-tuning (hence being significantly faster than vanilla LoRA as well as various recent improvements) while simultaneously attaining comparable or even better performance. For example, on the subset of the GLUE dataset with T5-Base, LoRA-GA outperforms LoRA by 5.69% on average. On larger models such as Llama 2-7B, LoRA-GA shows performance improvements of 0.34, 11.52%, and 5.05% on MT-bench, GSM8K, and Human-eval, respectively. Additionally, we observe up to 2-4 times convergence speed improvement compared to vanilla LoRA, validating its effectiveness in accelerating convergence and enhancing model performance. Code is available at https://github.com/Outsider565/LoRA-GA.

研究动机与目标

  • 为解决基线 LoRA 收敛缓慢的问题,该问题导致总 FLOPs 增加,且尽管单步成本较低,但常导致测试性能下降。
  • 探究 LoRA 适配器权重的次优初始化是否为导致其收敛缓慢的根本原因。
  • 开发一种新初始化方法,使低秩适配器的梯度更新方向从第一步起即与全模型保持一致。
  • 在保持 LoRA 参数效率和内存占用的前提下,实现与全量微调相当的收敛速度和性能。

提出的方法

  • LoRA-GA 使用全模型梯度矩阵 $\nabla_W \mathcal{L}$ 的前 $r$ 个左奇异向量和右奇异向量来初始化适配器矩阵 $A$ 和 $B$,确保初始 $\Delta(BA)$ 与 $\Delta W$ 对齐。
  • 该方法通过梯度矩阵的奇异值分解(SVD)提取 $U_{[1:r]}$ 和 $V_{[1:r]}$,并将其按 $\sqrt[4]{d_{\text{out}}}/\sqrt{\gamma}$ 缩放,以稳定输出方差。
  • 引入新的缩放因子 $\alpha / \sqrt{r}$,以在不同秩和输入维度下保持输出方差不变。
  • 初始化仅在训练前执行一次,无需对 LoRA 的架构或训练算法进行任何修改。
  • 该方法结合了梯度近似与输出稳定性(SO),并兼容现有 LoRA 变体(如 ReLoRA)。

实验结果

研究问题

  • RQ1LoRA 适配器权重的默认随机初始化是否显著延缓收敛速度,相比全量微调?
  • RQ2若使低秩适配器的初始梯度方向与全模型一致,能否加速收敛?
  • RQ3何种初始化方案可同时实现梯度对齐与输出方差稳定性?
  • RQ4所提出的初始化方法与现有初始化策略相比,在收敛速度和最终性能方面表现如何?

主要发现

  • 在 T5-Base 的 GLUE 基准上,LoRA-GA 平均比基线 LoRA 提升 5.69%,性能接近全量微调。
  • 在 Llama 2-7B 上,LoRA-GA 在 MT-bench、GSM8K 和 HumanEval 上分别提升 0.34、11.52% 和 5.05%。
  • LoRA-GA 的收敛速度相比基线 LoRA 最快可达 4 倍,显著减少了达到目标性能所需的训练步数和 FLOPs。
  • 初始化步骤仅在 7B 模型上增加约 1 分钟(例如 Llama 2-7B 上为 74.7 秒),且无额外内存开销,仅需标准 LoRA 的内存成本。
  • 消融实验表明,梯度近似(+GA)与输出稳定性(+SO)均对收敛性提升有贡献,二者结合在 LoRA-GA 中效果最佳。
  • LoRA-GA 保持与标准 LoRA 相同的内存成本,并可无缝兼容其他 LoRA 变体(如 ReLoRA),无需架构修改。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。