让LoRA在平坦的参数空间优化,提升模型泛化能力
Flat-LoRA: Low-Rank Adaptation over a Flat Loss Landscape
- 用贝叶斯期望损失替代尖锐度感知,保持训练效率
- 在数学推理、代码生成等任务上显著提升域内与跨域泛化
- 适合追求高效微调且注重泛化的研究者和工程师
大规模预训练模型微调在计算和内存成本上代价高昂。低秩适配(LoRA)作为一种参数高效微调方法,通过仅优化低秩矩阵实现高效微调。尽管近年来LoRA性能不断改进,但其优化空间与完整参数空间之间的关系常被忽视。即使在LoRA空间中表现为平坦的解,在完整参数空间中仍可能具有尖锐方向,影响泛化能力。我们提出Flat-LoRA,旨在寻找位于完整参数空间平坦区域的低秩适配。不同于带来显著开销的尖锐度感知最小化方法,我们采用贝叶斯期望损失目标以保持训练效率。同时设计了优化的随机扰动生成策略,并通过随机种子管理内存开销。在数学推理、代码生成、对话生成、指令遵循及文生图等多种任务上的实验表明,Flat-LoRA在域内与域外任务上均显著提升泛化性能。代码已开源:https://github.com/nblt/Flat-LoRA。
原文摘要 · Abstract (English)
Fine-tuning large-scale pre-trained models is prohibitively expensive in terms of computation and memory costs. Low-Rank Adaptation (LoRA), a popular Parameter-Efficient Fine-Tuning (PEFT) method, offers an efficient solution by optimizing only low-rank matrices. Despite recent progress in improving LoRA's performance, the relationship between the LoRA optimization space and the full parameter space is often overlooked. A solution that appears flat in the loss landscape of the LoRA space may still exhibit sharp directions in the full parameter space, potentially compromising generalization. We introduce Flat-LoRA, which aims to identify a low-rank adaptation situated in a flat region of the full parameter space. Instead of adopting the well-established sharpness-aware minimization approach, which incurs significant computation and memory overheads, we employ a Bayesian expectation loss objective to preserve training efficiency. Further, we design a refined random perturbation generation strategy for improved performance and carefully manage memory overhead using random seeds. Experiments across diverse tasks-including mathematical reasoning, coding abilities, dialogue generation, instruction following, and text-to-image generation-demonstrate that Flat-LoRA improves both in-domain and out-of-domain generalization. Code is available at https://github.com/nblt/Flat-LoRA.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。