LISA: Layerwise Importance Sampling for Memory-Efficient Large Language Model Fine-Tuning

📄 arXiv: 2403.17919v4 📥 PDF

作者: Rui Pan, Xiang Liu, Shizhe Diao, Renjie Pi, Jipeng Zhang, Chi Han, Tong Zhang

分类: cs.LG, cs.AI, cs.CL, math.OC

发布日期: 2024-03-26 (更新: 2024-12-25)

备注: NeurIPS 2024


💡 一句话要点

提出LISA以解决大语言模型微调中的内存效率问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 微调 内存效率 重要性采样 参数高效 深度学习 LoRA 优化策略

📋 核心要点

  1. 现有的参数高效微调方法如LoRA在大规模微调中性能不足,无法达到全参数训练的效果。
  2. 本文提出了一种新的训练策略LISA,通过重要性采样的思想对不同层进行优化,并随机冻结大部分中间层。
  3. 实验结果表明,LISA在下游微调任务中超越LoRA,MT-Bench得分提升10%-35%,在多个基准上表现优异。

📝 摘要(中文)

机器学习领域自大语言模型(LLMs)出现以来取得了显著进展。然而,其巨大的内存消耗成为大规模训练的主要障碍。例如,一个7B模型通常需要至少60GB的GPU内存进行全参数训练,这对缺乏高资源环境的研究者来说构成挑战。为缓解这一问题,提出了低秩适应(LoRA)等参数高效微调技术。然而,在大多数大规模微调设置中,其性能未能达到全参数训练的水平。为此,本文研究了LoRA在微调任务中的层级特性,并发现不同层之间权重范数存在意外且一致的偏斜。基于这一观察,提出了一种简单的训练策略LISA,能够在内存成本与LoRA相当的情况下,在多种设置中超越LoRA和全参数训练。

🔬 方法详解

问题定义:本文旨在解决大语言模型微调中的内存效率问题,现有的LoRA方法在性能上受到限制,无法充分利用全参数训练的潜力。

核心思路:LISA通过分析LoRA的层级特性,发现不同层之间权重范数的偏斜,进而提出了一种重要性采样的优化策略,随机冻结中间层以减少内存消耗。

技术框架:LISA的整体架构包括对不同层的权重进行重要性采样,优化过程中随机冻结大部分中间层,确保在低内存消耗下实现高效训练。

关键创新:LISA的核心创新在于将重要性采样应用于大语言模型的层级优化,显著提高了微调性能,与传统的LoRA方法相比,能够在相似的内存条件下实现更好的效果。

关键设计:在LISA中,重要性采样的具体实现涉及对每一层的权重范数进行分析,并根据其重要性进行动态调整,确保优化过程的高效性和有效性。具体的参数设置和损失函数设计也经过精心调整,以适应不同的微调任务。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,LISA在MT-Bench得分上超越LoRA超过10%-35%,在MMLU、AGIEval和WinoGrande等基准上表现持平或更优。在大模型LLaMA-2-70B上,LISA在MT-Bench、GSM8K和PubMedQA任务中均优于LoRA,展现了其在不同领域的有效性。

🎯 应用场景

LISA的研究成果具有广泛的应用潜力,尤其在需要大规模训练的自然语言处理任务中,能够有效降低内存消耗,提高训练效率。未来,LISA可能在更多的深度学习领域中得到应用,推动大语言模型的普及和发展。

📄 摘要(原文)

The machine learning community has witnessed impressive advancements since large language models (LLMs) first appeared. Yet, their massive memory consumption has become a significant roadblock to large-scale training. For instance, a 7B model typically requires at least 60 GB of GPU memory with full parameter training, which presents challenges for researchers without access to high-resource environments. Parameter Efficient Fine-Tuning techniques such as Low-Rank Adaptation (LoRA) have been proposed to alleviate this problem. However, in most large-scale fine-tuning settings, their performance does not reach the level of full parameter training because they confine the parameter search to a low-rank subspace. Attempting to complement this deficiency, we investigate the layerwise properties of LoRA on fine-tuning tasks and observe an unexpected but consistent skewness of weight norms across different layers. Utilizing this key observation, a surprisingly simple training strategy is discovered, which outperforms both LoRA and full parameter training in a wide range of settings with memory costs as low as LoRA. We name it Layerwise Importance Sampled AdamW (LISA), a promising alternative for LoRA, which applies the idea of importance sampling to different layers in LLMs and randomly freezes most middle layers during optimization. Experimental results show that with similar or less GPU memory consumption, LISA surpasses LoRA or even full parameter tuning in downstream fine-tuning tasks, where LISA consistently outperforms LoRA by over 10%-35% in terms of MT-Bench score while achieving on-par or better performance in MMLU, AGIEval and WinoGrande. On large models, specifically LLaMA-2-70B, LISA surpasses LoRA on MT-Bench, GSM8K, and PubMedQA, demonstrating its effectiveness across different domains.