[论文解读] CompactifAI: Extreme Compression of Large Language Models using Quantum-Inspired Tensor Networks
CompactifAI 使用量子启发的张量网络(MPOs)对 LLM 权重进行张量化,在简短再训练后在 LlaMA-2 7B 上实现显著的压缩(大小为原来的 30%),并保持约 90% 的原始准确率。它可以与其他压缩方法互补,并加速分布式训练。
Large Language Models (LLMs) such as ChatGPT and LlaMA are advancing rapidly in generative Artificial Intelligence (AI), but their immense size poses significant challenges, such as huge training and inference costs, substantial energy demands, and limitations for on-site deployment. Traditional compression methods such as pruning, distillation, and low-rank approximation focus on reducing the effective number of neurons in the network, while quantization focuses on reducing the numerical precision of individual weights to reduce the model size while keeping the number of neurons fixed. While these compression methods have been relatively successful in practice, there is no compelling reason to believe that truncating the number of neurons is an optimal strategy. In this context, this paper introduces CompactifAI, an innovative LLM compression approach using quantum-inspired Tensor Networks that focuses on the model's correlation space instead, allowing for a more controlled, refined and interpretable model compression. Our method is versatile and can be implemented with - or on top of - other compression techniques. As a benchmark, we demonstrate that a combination of CompactifAI with quantization allows to reduce a 93% the memory size of LlaMA 7B, reducing also 70% the number of parameters, accelerating 50% the training and 25% the inference times of the model, and just with a small accuracy drop of 2% - 3%, going much beyond of what is achievable today by other compression techniques. Our methods also allow to perform a refined layer sensitivity profiling, showing that deeper layers tend to be more suitable for tensor network compression, which is compatible with recent observations on the ineffectiveness of those layers for LLM performance. Our results imply that standard LLMs are, in fact, heavily overparametrized, and do not need to be large at all.
研究动机与目标
- 通过在不进行蛮力式神经元截断的前提下减小模型大小,推动更绿色、或更高效的 LLM 部署。
- 引入基于张量网络的压缩,目标是相关性空间而非神经元数量。
- 展示与其他压缩技术的兼容性,以及在分布式训练中的有效性。
提出的方法
- 将选定的 Self-Attention 与 MLP 权重矩阵张量化为 Matrix Product Operators (MPOs),其 Bond dimension 为 chi。
- 通过顺序的 SVD 确定 MPO,保留前 chi 个奇异值以截断相关性。
- 对张量化后的模型进行简短再训练以恢复准确性,利用分布式设置中降低的 CPU-GPU 传输时间。
- 在 LlaMA-2 7B 上进行基准测试,在 SA 和 MLP 层使用 chi ≈ 100,采用 float16 以实现压缩。
- 结合温和量化(float32 到 float16)以进一步减少大小。
- 使用 Rouge 指标在 XSum 和 Gigaword 数据集上评估文本摘要性能。
实验结果
研究问题
- RQ1量子启发的张量网络是否能够通过截断相关性空间而在不大幅损害准确性的情况下高效压缩 LLM?
- RQ2基于 MPO 的压缩及随后的再训练对模型大小、训练速度和下游任务性能的影响是什么?
- RQ3CompactifAI 如何与其他压缩技术(如量化)相互作用?
- RQ4在实际环境中,该方法是否适用于分布式多 GPU 训练?
主要发现
- 将 LlaMA-2 7B 的参数量从 7B 压缩到大约 2B 参数(float16 下约 30% 的原始大小)。
- 在压缩和温和量化后,内存占用降低到 3.7 GB(float16)。
- 对压缩后的模型再训练后,在 XSum 和 Gigaword 上实现约原始 Rouge 基准的 90% 摘要准确度。
- 在分布式多-GPU 设置下,压缩模型的训练/再训练时间大约为未压缩模型的一半。
- 温和量化(float32 到 float16)再提供约 2x 的压缩,使最终大小在 float32 原始模型的基础上约为 15%。
- 该方法与 GPU 兼容,并在单台 AWS 机器上演示,配备 8 NVIDIA A100 GPUs。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。