Skip to main content
QUICK REVIEW

[论文解读] LoRA Learns Less and Forgets Less

Dan Biderman, Jacob Portes|arXiv (Cornell University)|May 15, 2024
Robotics and Automated Systems被引用 16
一句话总结

LoRA 在代码和数学任务上无法达到完整微调的效果,但提供更强的正则化,减少遗忘并在生成中保持多样性。

ABSTRACT

Low-Rank Adaptation (LoRA) is a widely-used parameter-efficient finetuning method for large language models. LoRA saves memory by training only low rank perturbations to selected weight matrices. In this work, we compare the performance of LoRA and full finetuning on two target domains, programming and mathematics. We consider both the instruction finetuning (approximately 100K prompt-response pairs) and continued pretraining (20B unstructured tokens) data regimes. Our results show that, in the standard low-rank settings, LoRA substantially underperforms full finetuning. Nevertheless, LoRA better maintains the base model's performance on tasks outside the target domain. We show that LoRA mitigates forgetting more than common regularization techniques such as weight decay and dropout; it also helps maintain more diverse generations. Finally, we show that full finetuning learns perturbations with a rank that is 10-100X greater than typical LoRA configurations, possibly explaining some of the reported gaps. We conclude by proposing best practices for finetuning with LoRA.

研究动机与目标

  • 评估 LoRA 是否能够在具有挑战性的代码与数学领域达到与完整微调相媲美的性能。
  • 在两种训练方案下评估 LoRA:指令微调(IFT)和继续预训练(CPT)。
  • 在对目标领域进行微调时,分析源领域能力的遗忘。
  • 表征相对于完整微调,LoRA 扰动的秩与模块敏感性。
  • 为实际配置 LoRA 提供最佳实践建议。

提出的方法

  • 在代码和数学领域,对 Llama-2 7B(以及在某些场景中的 13B)比较 LoRA 与完整微调。
  • 使用两种数据方案:指令微调(约 100K 提示-应答对)和继续预训练(约 10B tokens)。
  • 用 HumanEval(代码)和 GSM8K(数学)评估目标领域性能。
  • 用 HellaSwag、ARC-Challenge 和 Winograd 问题评估源领域的遗忘。
  • 进行奇异值分解以分析微调扰动的秩。
  • 进行学习率、目标模块和 LoRA 秩的超参数搜索。

实验结果

研究问题

  • RQ1在何种条件下 LoRA 能在代码和数学任务上逼近完整微调的准确性?
  • RQ2LoRA 是否在与完整微调相比时缓解源域的遗忘?
  • RQ3LoRA 的扰动秩和目标模块如何影响性能与正则化?
  • RQ4哪些超参数最强烈影响 LoRA 的性能与稳定性?
  • RQ5哪些实际指南能够最大化 LoRA 在指令微调和继续预训练中的有效性?

主要发现

  • LoRA 在 CPT 和 IFT 下在代码和数学任务上均落后于完整微调,代码领域的差距比数学领域大。
  • LoRA 比完整微调遗忘的源领域更少,表明存在正则化效应。
  • LoRA 提供的正则化强于权重衰减或注意力丢弃,且维持更具多样性的输出生成。
  • 完整微调往往产生高秩的扰动,扰动秩比典型的 LoRA 配置高出 10–100 倍。
  • LoRA 对学习率和目标模块的选择极为敏感,模块选择的重要性高于秩对性能的影响。
  • 最佳实践建议偏向在指令微调中使用 LoRA,目标模块覆盖所有模块,秩取一个适度值,并进行多轮训练。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

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