arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2405.18886cs.LGcs.AImath.OCstat.ML
收藏

基于低秩低精度分解的大语言模型压缩

Compressing Large Language Models using Low Rank and Low Precision Decomposition

Stanford University(斯坦福大学);Princeton University(普林斯顿大学)

Rajarshi Saha, Naomi Sagan, Varun Srivastava, Andrea J. Goldsmith, Mert Pilanci

AI总结:

针对大语言模型内存占用高难以部署在边缘设备的问题,本文提出训练后压缩算法CALDERA,通过低秩低精度分解压缩模型,在2.5比特/参数以下场景性能优于现有方法。

摘要:

当前大语言模型(LLM)的体积过于庞大,难以在内存受限的边缘设备上部署。本文提出了$\rm CALDERA$——一种全新的训练后LLM压缩算法,该算法利用权重矩阵$\bf W$的固有低秩结构,通过低秩低精度分解将其近似为$\bf W \bf \boldsymbol{\ne} \bf Q + \bf L\bf R$,其中$\bf L$和$\bf R$为低秩因子,且$\bf Q$、$\bf L$、$\bf R$的元素均经过量化。该方法通过将每一层替换为其$\bf Q + \bf L\bf R$分解形式实现模型压缩,并评估了压缩后模型的零样本性能。此外,$\bf L$和$\bf R$可直接适配低秩微调,从而进一步提升零样本性能。$\rm CALDERA$通过将分解建模为优化问题$\bf \boldsymbol{\text{min}}_{\bf Q,\bf L,\bf R} \bf \boldsymbol{\text{norm}}((\bf Q + \bf L\bf R - \bf W)\bf X^\top)_{\rm F}^2$来求解,其中$\bf X$为校准数据,且$\bf Q$、$\bf L$、$\bf R$被约束为可采用低精度格式表示。本文基于秩约束回归框架建立了$\rm CALDERA$近似误差的理论上界,并通过分析目标秩和量化比特预算的影响,研究了压缩率与模型性能之间的权衡关系。实验结果表明,在每参数比特数低于2.5比特的场景下,使用$\rm CALDERA$压缩LlaMa-$2$ 7B/13B/70B以及LlaMa-$3$ 8B模型的效果优于现有训练后LLM压缩技术。代码实现可在以下链接获取:https://github.com/pilancilab/caldera。

英文摘要:

The prohibitive sizes of Large Language Models (LLMs) today make it difficult to deploy them on memory-constrained edge devices. This work introduces $\rm CALDERA$ -- a new post-training LLM compression algorithm that harnesses the inherent low-rank structure of a weight matrix $\mathbf{W}$ by approximating it via a low-rank, low-precision decomposition as $\mathbf{W} \approx \mathbf{Q} + \mathbf{L}\mathbf{R}$. Here, $\mathbf{L}$ and $\mathbf{R}$ are low rank factors, and the entries of $\mathbf{Q}$, $\mathbf{L}$ and $\mathbf{R}$ are quantized. The model is compressed by substituting each layer with its $\mathbf{Q} + \mathbf{L}\mathbf{R}$ decomposition, and the zero-shot performance of the compressed model is evaluated. Additionally, $\mathbf{L}$ and $\mathbf{R}$ are readily amenable to low-rank adaptation, consequently enhancing the zero-shot performance. $\rm CALDERA$ obtains this decomposition by formulating it as an optimization problem $\min_{\mathbf{Q},\mathbf{L},\mathbf{R}}\lVert(\mathbf{Q} + \mathbf{L}\mathbf{R} - \mathbf{W})\mathbf{X}^\top\rVert_{\rm F}^2$, where $\mathbf{X}$ is the calibration data, and $\mathbf{Q}, \mathbf{L}, \mathbf{R}$ are constrained to be representable using low-precision formats. Theoretical upper bounds on the approximation error of $\rm CALDERA$ are established using a rank-constrained regression framework, and the tradeoff between compression ratio and model performance is studied by analyzing the impact of target rank and quantization bit budget. Results illustrate that compressing LlaMa-$2$ $7$B/$13B$/$70$B and LlaMa-$3$ $8$B models using $\rm CALDERA$ outperforms existing post-training LLM compression techniques in the regime of less than $2.5$ bits per parameter. The implementation is available at: https://github.com/pilancilab/caldera.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑