Skip to main content
QUICK REVIEW

[论文解读] LoRAPrune: Structured Pruning Meets Low-Rank Parameter-Efficient Fine-Tuning

Mingyang Zhang, Hao-Zhen|arXiv (Cornell University)|May 28, 2023
Sparse and Compressive Sensing Techniques被引用 4
一句话总结

LoRAPrune 提出了一种统一框架,可在大规模预训练模型上联合执行结构化剪枝与基于 LoRA 的参数高效微调,利用 LoRA 梯度进行重要性估计,从而避免计算内存密集型的预训练权重梯度。该方法在实现 50% 模型尺寸压缩的同时,将 WikiText2 上的困惑度降低 8.0,PTB 上降低 16.05,且相比先前方法将内存使用量减少了 52.6%。

ABSTRACT

Large Language Models (LLMs), such as LLaMA and T5, have shown exceptional performance across various tasks through fine-tuning. Although low-rank adaption (LoRA) has emerged to cheaply fine-tune these LLMs on downstream tasks, their deployment is still hindered by the vast model scale and computational costs. Post-training model pruning offers a way to compress LLMs. However, the current pruning methods designed for LLMs are not compatible with LoRA. This is due to their utilization of unstructured pruning on LLMs, impeding the merging of LoRA weights, or their dependence on the gradients of pre-trained weights to guide pruning, which can impose significant memory overhead. To this end, we propose LoRAPrune, a new framework that delivers an accurate structured pruned model in a highly memory-efficient manner. Specifically, we first design a LoRA-guided pruning criterion, which uses the weights and gradients of LoRA, rather than the gradients of pre-trained weights for importance estimation. We subsequently integrate this criterion into an iterative pruning process, effectively removing redundant channels and heads. Extensive experimental results demonstrate the superior performance of our LoRAPrune over existing approaches on the LLaMA series models. At a 50\% compression rate, LoRAPrune demonstrates superior performance over LLM-Pruner, achieving a reduction in perplexity by 4.81 on WikiText2 and 3.46 on PTB, while also decreasing memory usage by 52.6%. Besides, LoRAPrune also matches semi-structural pruning across multiple LLMs, proving its wide applicability. The code is available at https://github.com/aim-uofa/LoRAPrune.

研究动机与目标

  • 解决非结构化剪枝与 LoRA 之间的不兼容性,后者会阻碍 LoRA 权重的高效合并并增加推理延迟。
  • 克服现有剪枝方法中因在剪枝过程中需要预训练权重梯度而导致的高内存开销问题。
  • 开发一种与 LoRA 兼容的、内存高效的结构化剪枝方法,实现在剪枝后 LoRA 权重的无缝合并。
  • 实现剪枝与微调的联合执行,以在高剪枝率下保持模型性能,而无需在剪枝后单独进行微调。
  • 提出一种新颖的 LoRA 引导的剪枝准则,仅利用 LoRA 梯度估计参数重要性,避免计算预训练权重梯度。

提出的方法

  • 提出一种 LoRA 引导的剪枝准则,仅基于 LoRA 权重(A)的梯度计算参数重要性,从而无需依赖预训练权重(W₀)的梯度。
  • 设计一种结构化的迭代剪枝流程,以联合方式从预训练模型和 LoRA 适配器中移除冗余通道与注意力头。
  • 使用 LoRA 梯度的 Frobenius 范数作为参数重要性的代理指标,实现在不存储大型中间张量的前提下高效且准确的剪枝。
  • 实现一种剪枝与微调的联合管道,将剪枝与 LoRA 微调在单一训练循环中交替进行,以维持模型性能。
  • 确保剪枝后,LoRA 权重(BA)可无缝合并到剪枝后的预训练权重中,从而实现无额外计算成本的推理。
  • 优化剪枝频率以在模型恢复与过拟合之间取得平衡,最优频率为每轮剪枝迭代进行 10 次微调步骤。

实验结果

研究问题

  • RQ1是否仅基于 LoRA 梯度的剪枝准则能在显著降低内存使用的同时,实现与依赖预训练权重梯度的准则相当或更优的性能?
  • RQ2在大规模预训练模型上,联合剪枝与微调与分离剪枝与微调相比,在模型性能与效率方面有何差异?
  • RQ3在使用 LoRA 微调进行迭代剪枝时,能够平衡模型恢复与过拟合的最优剪枝频率是多少?
  • RQ4通过 LoRA 引导的重要性估计,结构化剪枝在多大程度上能减少内存开销,同时保持下游任务上的模型准确性?
  • RQ5所提出的方法是否能通过允许将 LoRA 权重直接合并到剪枝模型中,实现高效、内存友好且硬件兼容的推理?

主要发现

  • 在 50% 压缩率下,与 LLM-Pruner 相比,LoRAPrune 在 WikiText2 上将困惑度降低 8.0,在 PTB 上降低 16.05,表现出更优的准确性。
  • 在剪枝 LLaMA-65b 时,与 LLM-Pruner 相比,LoRAPrune 将内存使用量减少了 52.6%,仅需一台 A100(80GB)GPU 而非三台。
  • 与原始基于梯度的准则相比,LoRA 引导的准则将 GPU 内存使用量减少 52.6%,并将吞吐量提高 64.6%。
  • 联合剪枝与微调优于分离剪枝与微调,尤其在高剪枝率下表现更优,在 50% 压缩率下,分类任务的平均准确率提升 2.87 个百分点。
  • 最优剪枝频率为每轮剪枝迭代进行 10 次微调步骤,频率过低(如 1)会限制模型恢复,频率过高(如 20)则导致过拟合。
  • LoRA 引导准则与原始准则之间的掩码相似性较高(尤其在低压缩率下),证实 LoRA 引导准则是一种强有效的近似方法,可实现准确且低成本的剪枝。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

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