改进LoRA训练缺陷,实现更高效的小样本微调
ALLoRA: Adaptive Learning Rate Mitigates LoRA Fatal Flaws
- 用自适应学习率替代丢弃和缩放,解决三类训练问题
- 在小数据场景下准确率超越传统LoRA及DoRA等变体
- 无需调节丢弃率和缩放因子,简化超参设置
低秩适配(LoRA)是大语言模型微调的主流方法,通过学习预训练矩阵参数 $W$ 的加性低秩扰动 $AB$ 来对齐新任务或数据集,即 $W+AB$。本文揭示了LoRA在数据量与训练步数有限时的三大核心缺陷:第一,使用丢弃(Dropout)防止过拟合,但证明其仅适用于长训练周期,在短周期中无法收敛为可靠正则器;第二,$B$ 初始化为0导致 $A$ 与 $B$ 间训练动态缓慢,而丢弃进一步阻碍 $B$ 脱离0值,尤其影响短周期训练;第三,每层LoRA扰动的缩放因子造成“短视”层间交互。基于上述分析,提出无丢弃、无缩放、自适应学习率的全新方法——ALLoRA。通过将每样本、每参数梯度按其 $\ ext{ℓ}_2$ 范数倒数进行缩放,有效缓解三类问题。作为副产物,移除了两个超参:缩放因子与丢弃率。实验证明,ALLoRA在多种设置下均优于原始LoRA及近期变体如DoRA。消融实验表明,该方案在多类权重依赖/输出依赖方法中表现最优,适用于包括最新Llama3在内的多种LLM。
原文摘要 · Abstract (English)
Low-Rank Adaptation (LoRA) is the bread and butter of Large Language Model (LLM) finetuning. LoRA learns an additive low-rank perturbation, $AB$, of a pretrained matrix parameter $W$ to align the model to a new task or dataset with $W+AB$. We identify three core limitations to LoRA for finetuning--a setting that employs limited amount of data and training steps. First, LoRA employs Dropout to prevent overfitting. We prove that Dropout is only suitable for long training episodes but fails to converge to a reliable regularizer for short training episodes. Second, LoRA's initialization of $B$ at $0$ creates a slow training dynamic between $A$ and $B$. That dynamic is also exacerbated by Dropout that further slows the escape from $0$ for $B$ which is particularly harmful for short training episodes. Third, the scaling factor multiplying each LoRA additive perturbation creates ``short-sighted'' interactions between the LoRA modules of different layers. Motivated by principled analysis of those limitations, we find an elegant solution: a Dropout-free, scaling-free, LoRA with Adaptive Learning rate--coined ALLoRA. By scaling the per sample and per parameter gradients with a coefficient inversely proportional to parameters' $\ell_2$ norm, ALLoRA alleviates those three limitations. As a by-product, ALLoRA removes two hyper-parameters from LoRA: the scaling factor and the dropout rate. Empirical results show that ALLoRA admits better accuracy than LoRA on various settings, including against recent LoRA variants such as Weight-Decomposed Low-Rank Adaptation (DoRA). Ablation studies show our solution is the optimal in a family of weight-dependent / output-dependent approaches on various LLMs including the latest Llama3.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。