Skip to main content
QUICK REVIEW

[论文解读] Matrix Compression via Randomized Low Rank and Low Precision Factorization

Rajarshi Saha, Varun Srivastava|arXiv (Cornell University)|Oct 17, 2023
Sparse and Compressive Sensing Techniques被引用 5
一句话总结

本文提出 LPLR(低精度低秩)算法,一种同时利用低秩结构与低精度量化进行矩阵压缩的算法,可在极小精度损失下实现极高的压缩率。通过使用随机化映射计算低秩基,对基向量进行量化,并将矩阵列投影到此量化基上,LPLR 实现了每矩阵元素最低至 1 比特的压缩率,同时在图像压缩、嵌入分类和 LLaMA-7b 层压缩任务中表现优于或等同于传统方法。

ABSTRACT

Matrices are exceptionally useful in various fields of study as they provide a convenient framework to organize and manipulate data in a structured manner. However, modern matrices can involve billions of elements, making their storage and processing quite demanding in terms of computational resources and memory usage. Although prohibitively large, such matrices are often approximately low rank. We propose an algorithm that exploits this structure to obtain a low rank decomposition of any matrix $\mathbf{A}$ as $\mathbf{A} \approx \mathbf{L}\mathbf{R}$, where $\mathbf{L}$ and $\mathbf{R}$ are the low rank factors. The total number of elements in $\mathbf{L}$ and $\mathbf{R}$ can be significantly less than that in $\mathbf{A}$. Furthermore, the entries of $\mathbf{L}$ and $\mathbf{R}$ are quantized to low precision formats $--$ compressing $\mathbf{A}$ by giving us a low rank and low precision factorization. Our algorithm first computes an approximate basis of the range space of $\mathbf{A}$ by randomly sketching its columns, followed by a quantization of the vectors constituting this basis. It then computes approximate projections of the columns of $\mathbf{A}$ onto this quantized basis. We derive upper bounds on the approximation error of our algorithm, and analyze the impact of target rank and quantization bit-budget. The tradeoff between compression ratio and approximation accuracy allows for flexibility in choosing these parameters based on specific application requirements. We empirically demonstrate the efficacy of our algorithm in image compression, nearest neighbor classification of image and text embeddings, and compressing the layers of LlaMa-$7$b. Our results illustrate that we can achieve compression ratios as aggressive as one bit per matrix coordinate, all while surpassing or maintaining the performance of traditional compression techniques.

研究动机与目标

  • 为解决大规模矩阵带来的高存储与计算成本,利用其固有的低秩结构。
  • 开发一种联合优化低秩逼近与因子矩阵低精度量化的矩阵压缩方法。
  • 在内存受限或实时场景中实现实用化压缩,此时完整 SVD 不可行。
  • 在比特预算约束下,压缩效率与精度方面优于朴素量化与现有低秩方法。
  • 提供理论误差界,并在图像、自然语言处理与模型压缩等多样化应用中进行实证验证。

提出的方法

  • 使用高斯随机映射计算矩阵 A 的近似范围基,将计算成本从 O(nd²) 降低至 O(ndm)。
  • 将左因子 L 中的基向量量化为低精度格式(如 1–8 比特),在减少存储的同时保留结构信息。
  • 使用最小二乘解计算 A 的列在量化基上的近似投影,形成右因子 R。
  • 构建低秩近似 A ≈ LR,其中 L 与 R 均以低精度格式存储,从而最小化总存储量。
  • 利用随机化算法避免完整 SVD,实现对无法装入 GPU 内存的大规模矩阵的可扩展性。
  • 利用 Woodbury 矩阵恒等式支持流式设置中的增量更新,实现对新数据点的在线压缩。

实验结果

研究问题

  • RQ1将随机化映射与低秩因子的低精度量化结合,是否能在压缩效率上优于朴素量化?
  • RQ2在低精度低秩分解中,目标秩、量化比特预算与近似误差之间的权衡关系如何?
  • RQ3LPLR 在图像压缩、嵌入的最近邻搜索与 LLM 层压缩等实际应用中的表现如何?
  • RQ4在完整 SVD 计算不可行时,LPLR 何时优于直接基于 SVD 的量化方法?
  • RQ5量化后的低秩结构是否具有正则化效应,从而提升下游任务的泛化能力?

主要发现

  • LPLR 实现了每矩阵元素最低至 1 比特的压缩率,显著优于朴素量化在存储效率上的表现,同时保持或提升精度。
  • 在图像压缩中,LPLR 即使在 2 比特精度下,也能比直接 SVD 量化(DSVD)和朴素量化更好地保留语义特征。
  • 在图像与文本嵌入数据集上,LPLR 在最近邻分类任务中保持或超过基线方法的性能。
  • 对于 LLaMA-7b 模型层,LPLR 实现了高效率压缩且性能损失极小,证明其在大语言模型压缩中的可行性。
  • 理论误差界表明,近似误差与尾部奇异值之和及量化误差成正比,验证了该方法的鲁棒性。
  • 在内存受限场景中,当完整 SVD 因 GPU 内存限制而不可行时,LPLR 是唯一可行方案,优于基于 SVD 的替代方法。

更好的研究,从现在开始

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

无需绑定信用卡

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