Skip to main content
QUICK REVIEW

[论文解读] LORD: Low Rank Decomposition Of Monolingual Code LLMs For One-Shot Compression

Ayush Kaushal, Tejas Vaidhya|arXiv (Cornell University)|Sep 25, 2023
Computational Physics and Python Applications被引用 4
一句话总结

该论文提出LoRD,一种无需微调即可压缩单语代码大语言模型的一次性低秩分解方法。通过将密集线性层分解为低秩矩阵,LoRD在仅增加不到1%困惑度的情况下,实现了最高达39.58%的秩降低,使推理速度提升22.35%,并将StarCoder 16B压缩至13.2B参数,且性能无下降。

ABSTRACT

Low Rank Decomposition of matrix - splitting a large matrix into a product of two smaller matrix offers a means for compression that reduces the parameters of a model without sparsification, and hence delivering more speedup on modern hardware. Moreover, unlike quantization, the compressed linear layers remain fully differentiable and all the parameters trainable, while being able to leverage the existing highly efficient kernels over floating point matrices. We study the potential to compress Large Language Models (LLMs) for monolingual Code generation via Low Rank Decomposition (LoRD) and observe that ranks for the linear layers in these models can be reduced by upto 39.58% with less than 1% increase in perplexity. We then use Low Rank Decomposition (LoRD) to compress StarCoder 16B to 13.2B parameter with no drop and to 12.3B with minimal drop in HumanEval Pass@1 score, in less than 10 minutes on a single A100. The compressed models speeds up inference by up to 22.35% with just a single line of change in code over huggingface's implementation with pytorch backend. Low Rank Decomposition (LoRD) models remain compatible with state of the art near-lossless quantization method such as SpQR, which allows leveraging further compression gains of quantization. Lastly, QLoRA over Low Rank Decomposition (LoRD) model further reduces memory requirements by as much as 21.2% over vanilla QLoRA while offering similar gains from parameter efficient fine tuning. Our work shows Low Rank Decomposition (LoRD) as a promising new paradigm for LLM compression.

研究动机与目标

  • 探索低秩分解作为无需微调的大规模单语代码大语言模型压缩方法的可行性。
  • 通过利用密集矩阵乘法,解决量化和剪枝方法的局限性(如硬件特定内核和不可微性)。
  • 通过高效、完全可微且可训练的压缩模型,实现快速、硬件优化的推理。
  • 展示与最先进的量化方法和参数高效微调技术(如QLoRA)的兼容性。
  • 通过降低内存和计算需求,使大规模代码大语言模型能够在消费级硬件上部署。

提出的方法

  • LoRD将Transformer块中的每个密集线性层分解为两个更小的低秩矩阵,通过矩阵分解减少参数量。
  • 该方法使用奇异值分解(SVD)或数据感知分解,无需微调即可识别权重矩阵的低秩近似。
  • 压缩通过单次操作完成,使用完整模型权重,避免迭代微调或蒸馏。
  • 所得分解层完全可微,且与现有浮点GEMM内核(如cuBLAS)兼容,支持高速推理。
  • 该方法可无缝集成到Hugging Face的PyTorch后端,仅需修改一行代码即可部署。
  • LoRD模型进一步通过近无损量化(SpQR)和QLoRA微调进行压缩,实现模型大小和内存效率的进一步提升。
(a) Perplexity vs % Rank Reduction for CodeGen Models.
(a) Perplexity vs % Rank Reduction for CodeGen Models.

实验结果

研究问题

  • RQ1低秩分解能否在不微调的情况下有效应用于大规模单语代码大语言模型(如StarCoder、CodeGen)?
  • RQ2在保持模型性能的前提下,代码大语言模型中线性层的秩可被降低到何种程度?
  • RQ3与量化和剪枝相比,LoRD在推理速度、硬件兼容性和模型可微性方面表现如何?
  • RQ4LoRD能否与现有量化和参数高效微调方法结合,实现进一步的压缩和效率提升?
  • RQ5在内存受限的消费级GPU上部署时,分解后的模型是否能保持性能?

主要发现

  • LoRD在代码大语言模型中线性层的秩降低最高达39.58%,且困惑度增加不足1%。
  • StarCoder 16B被压缩至13.2B参数,HumanEval Pass@1得分无下降(31.67 vs. 31.57),压缩至12.3B时仅出现轻微下降(29.22)。
  • 仅通过一行代码更改,即可在单张A100上实现最高达22.35%的推理加速,优于Hugging Face默认实现。
  • LoRD模型保持完全可微性,并与最先进的量化技术(SpQR)兼容,可实现进一步压缩。
  • 在LoRD模型上进行QLoRA微调,相比原始QLoRA,内存使用量最多减少21.2%,同时保持相似的微调性能。
  • 该方法硬件优化良好,利用现有cuBLAS内核,避免稀疏矩阵开销,因此在大多数GPU上比稀疏或量化推理更快。
(b) Perplexity vs % Rank Reduction for StarCoder Models.
(b) Perplexity vs % Rank Reduction for StarCoder Models.

更好的研究,从现在开始

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

无需绑定信用卡

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