Skip to main content
QUICK REVIEW

[论文解读] LoRA vs Full Fine-tuning: An Illusion of Equivalence

Reece Shuttleworth, Jacob Andreas|arXiv (Cornell University)|Oct 28, 2024
Embedded Systems Design TechniquesComputer Science被引用 3
一句话总结

该论文表明,尽管LoRA和全参数微调在下游任务上表现相当,但它们因‘入侵维度’(intruder dimensions)的出现而学习到根本不同的模型表征——即在LoRA微调模型中,存在与预训练权重矩阵正交的高排名奇异向量。这些结构差异导致泛化能力更差,并加剧了对预训练数据和先前任务的遗忘,即使在目标任务性能相当的情况下亦如此。

ABSTRACT

Fine-tuning is a crucial paradigm for adapting pre-trained large language models to downstream tasks. Recently, methods like Low-Rank Adaptation (LoRA) have been shown to effectively fine-tune LLMs with an extreme reduction in trainable parameters. But, \emph{are their learned solutions really equivalent?} We study how LoRA and full-finetuning change pre-trained models by analyzing the model's weight matrices through the lens of their spectral properties. We find that LoRA and full fine-tuning yield weight matrices whose singular value decompositions exhibit very different structure: weight matrices trained with LoRA have new, high-ranking singular vectors, which we call \emph{intruder dimensions}, while those trained with full fine-tuning do not. Further, we extend the finding that LoRA forgets less than full fine-tuning and find its forgetting is vastly localized to the intruder dimension -- by causally intervening on the intruder dimensions by changing their associated singular values post-fine-tuning, we show that they cause forgetting. Moreover, scaling them down significantly improves modeling of the pre-training distribution with a minimal drop in downstream task performance. Given this, we should expect accumulating intruder dimensions to be harmful and lead to more forgetting. This will be amplified during continual learning because of sequentially fine-tuning, and we show that LoRA models do accumulate intruder dimensions here tend to perform worse in this setting, emphasizing the practicality of our findings.

研究动机与目标

  • 探究尽管下游性能相似,LoRA与全参数微调是否产生等效的模型表征。
  • 分析微调方法如何改变预训练模型权重矩阵的谱特性。
  • 理解谱特性差异的行为后果,特别是对泛化能力和持续学习的影响。
  • 识别LoRA中入侵维度的根源,并评估缓解其负面影响的策略。

提出的方法

  • 通过奇异值分解(SVD)分析微调前后权重矩阵的谱特性,以检测结构变化。
  • 通过计算预训练与微调后奇异向量之间的余弦相似度,识别由LoRA引入的新高排名奇异向量(即入侵维度)。
  • 通过预训练数据分布遗忘度和持续学习基准,比较LoRA与全参数微调的泛化行为。
  • 评估LoRA秩和缩放因子α对入侵维度形成及模型行为的影响。
  • 通过冻结一个LoRA矩阵(A或B)进行消融实验,以隔离矩阵乘积在入侵维度形成中的作用。
  • 采用秩稳定LoRA,评估更高秩参数化是否能更好地模拟全参数微调的行为。
Figure 1: Spectral dissimilarities between full fine-tuning and LoRA. Similarity matrix of pre- and post-fine-tuning singular vectors of the weight matrices to characterize spectral differences introduced upon fine-tuning, in a representative example for LLaMA-2 fine-tuned on Magicoder. Full fine-tu
Figure 1: Spectral dissimilarities between full fine-tuning and LoRA. Similarity matrix of pre- and post-fine-tuning singular vectors of the weight matrices to characterize spectral differences introduced upon fine-tuning, in a representative example for LLaMA-2 fine-tuned on Magicoder. Full fine-tu

实验结果

研究问题

  • RQ1LoRA与全参数微调在权重矩阵的谱结构上是否产生等效解?
  • RQ2入侵维度对模型泛化能力和持续学习的行为影响是什么?
  • RQ3为何入侵维度在LoRA中出现,而在全参数微调中不出现?
  • RQ4更高秩或秩稳定LoRA能否缓解入侵维度的负面影响?
  • RQ5超参数如秩和缩放因子α如何影响入侵维度的形成?

主要发现

  • LoRA微调引入了‘入侵维度’——即与预训练权重矩阵近似正交的高排名奇异向量——这些在全参数微调中不会出现。
  • 尽管下游任务准确率相当,但含有入侵维度的LoRA模型比全参数微调模型遗忘了更多预训练数据分布(例如在MNLI、QQP、FEVER上)。
  • 在持续学习中,含有入侵维度的LoRA模型在先前学习任务上的性能下降更快,所有评估数据集的性能均低于基线。
  • 高秩LoRA模型(如r=64)在采用秩稳定机制时,其泛化和持续学习行为与全参数微调非常接近,即使低秩LoRA(r≤8)在目标任务上表现相当。
  • 当α固定为8(而非α=2r)时,LoRA模型表现出更多入侵维度和更差的泛化能力,表明不恰当的缩放会加剧结构差异。
  • LoRA中的矩阵乘积BA放大了A与B之间的谱差异,这是入侵维度形成的关键机制,消融实验(冻结A仅训练B)已证实这一点。
Figure 2: Characterizing structural differences between solutions learnt by LoRA Vs full Fine-tuning. a) We measure the changes to the SVD of the pre-trained weights made during fine-tuning. We observe intruder dimensions introduced by LoRA in top ranking singular vectors but by full fine-tuning. b)
Figure 2: Characterizing structural differences between solutions learnt by LoRA Vs full Fine-tuning. a) We measure the changes to the SVD of the pre-trained weights made during fine-tuning. We observe intruder dimensions introduced by LoRA in top ranking singular vectors but by full fine-tuning. b)

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。