arXiv:2502.13533cs.LGcs.AI2025-02ICLR被引 10

用剪枝小模型训练低秩适配器,推理时复用大模型,大幅降低显存占用。

Train Small, Infer Large: Memory-Efficient LoRA Training for Large Language Models

  • 剪掉大模型冗余部分,用小模型训练低秩矩阵
  • 700亿参数模型可在20G显存的GPU上训练,比全参微调节省15倍计算资源
  • 适合资源有限但需高效微调大模型的研究者和开发者

大语言模型(LLMs)在自然语言处理中表现出强大的任务泛化能力。低秩适配(LoRA)通过冻结原始模型参数,仅训练轻量级低秩适配矩阵,实现低成本微调。然而,其内存开销主要来自原始模型参数。为此,我们提出LoRAM:基于过参数化模型中许多神经元训练价值低但对推理必要这一观察,先在剪枝后的(小)模型上训练低秩矩阵,再将其恢复并用于原(大)模型推理。此外,由模型发布方提前进行低成本持续预训练,缓解剪枝与原模型间的知识差异。大量实验表明,该方法在多种剪枝策略和下游任务中均有效。对于700亿参数模型,LoRAM使训练可在仅含20G HBM的GPU上完成,替代了原需80G A100 GPU的LoRA训练,以及全参微调所需的15张GPU。特别是,结合结构化剪枝与4比特量化实现的QLoRAM,在LLaMA-3.1-70B(LLaMA-2-70B)上将低秩矩阵训练主导的参数存储成本降低15.81倍(16.95倍),性能显著优于原始模型及LoRA训练的较小版本。代码已开源:https://github.com/junzhang-zj/LoRAM。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have significantly advanced natural language processing with exceptional task generalization capabilities. Low-Rank Adaption (LoRA) offers a cost-effective fine-tuning solution, freezing the original model parameters and training only lightweight, low-rank adapter matrices. However, the memory footprint of LoRA is largely dominated by the original model parameters. To mitigate this, we propose LoRAM, a memory-efficient LoRA training scheme founded on the intuition that many neurons in over-parameterized LLMs have low training utility but are essential for inference. LoRAM presents a unique twist: it trains on a pruned (small) model to obtain pruned low-rank matrices, which are then recovered and utilized with the original (large) model for inference. Additionally, minimal-cost continual pre-training, performed by the model publishers in advance, aligns the knowledge discrepancy between pruned and original models. Our extensive experiments demonstrate the efficacy of LoRAM across various pruning strategies and downstream tasks. For a model with 70 billion parameters, LoRAM enables training on a GPU with only 20G HBM, replacing an A100-80G GPU for LoRA training and 15 GPUs for full fine-tuning. Specifically, QLoRAM implemented by structured pruning combined with 4-bit quantization, for LLaMA-3.1-70B (LLaMA-2-70B), reduces the parameter storage cost that dominates the memory usage in low-rank matrix training by 15.81$\times$ (16.95$\times$), while achieving dominant performance gains over both the original LLaMA-3.1-70B (LLaMA-2-70B) and LoRA-trained LLaMA-3.1-8B (LLaMA-2-13B). Code is available at https://github.com/junzhang-zj/LoRAM.

LoRA模型压缩显存优化微调

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。