arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.08041cs.CLcs.AIcs.LG
收藏

QLLM:面向大型语言模型的准确且高效的低比特宽度量化

QLLM: Accurate and Efficient Low-Bitwidth Quantization for Large Language Models

ZIP Lab, Monash University(莫纳什大学ZIP实验室);SenseTime Research(商汤科技研究院);Beihang University(北京航空航天大学);School of Computer and Communication Sciences, EPFL(洛桑联邦理工学院计算机与通信科学学院);University of Science and Technology Beijing(北京科技大学)

Jing Liu, Ruihao Gong, Xiuying Wei, Zhiwei Dong, Jianfei Cai, Bohan Zhuang

AI总结:

本文提出低比特宽度 PTQ 方法 QLLM,通过自适应通道拆分与合并处理激活异常值,并以可融合的低秩参数补偿量化损失,在 LLaMA 上实现高效高精度量化。

摘要:

大型语言模型(LLM)在 NLP 中表现出色,但其资源需求阻碍了广泛部署。尽管量化感知训练(QAT)提供了一种解决方案,但其高昂的训练成本使训练后量化(PTQ)成为 LLM 更实用的方法。现有研究发现,特定通道中的激活异常值是 PTQ 精度的瓶颈。已有方法提出将幅值从激活转移到权重,但这种方式只能有限缓解问题,或会遭遇梯度不稳定,从而在低比特宽度下导致严重性能下降。本文提出 QLLM,这是一种为 LLM 设计的准确且高效的低比特宽度 PTQ 方法。QLLM 引入自适应通道重组技术,将异常值的幅值重新分配到其他通道,从而减轻其对量化范围的影响。该技术通过通道拆分和通道合并实现:首先将异常通道分解为若干子通道,以确保激活幅值分布更加均衡;随后合并相似通道,以保持原始通道数量并保证效率。此外,本文还设计了一种自适应策略,用于自主确定通道拆分的最佳子通道数量。为进一步补偿量化造成的性能损失,作者提出一种高效调优方法,在冻结预训练量化模型的同时,仅学习少量低秩权重。训练结束后,这些低秩参数可融合进冻结权重,而不会影响推理。在 LLaMA-1 和 LLaMA-2 上的大量实验表明,QLLM 能够高效获得准确的量化模型。例如,QLLM 可在单张 A100-80G GPU 上于 10 小时内完成 4-bit LLaMA-2-70B 的量化,并在五个零样本任务的平均准确率上较此前最先进方法高出 7.89%。

英文摘要:

Large Language Models (LLMs) excel in NLP, but their demands hinder their widespread deployment. While Quantization-Aware Training (QAT) offers a solution, its extensive training costs make Post-Training Quantization (PTQ) a more practical approach for LLMs. In existing studies, activation outliers in particular channels are identified as the bottleneck to PTQ accuracy. They propose to transform the magnitudes from activations to weights, which however offers limited alleviation or suffers from unstable gradients, resulting in a severe performance drop at low-bitwidth. In this paper, we propose QLLM, an accurate and efficient low-bitwidth PTQ method designed for LLMs. QLLM introduces an adaptive channel reassembly technique that reallocates the magnitude of outliers to other channels, thereby mitigating their impact on the quantization range. This is achieved by channel disassembly and channel assembly, which first breaks down the outlier channels into several sub-channels to ensure a more balanced distribution of activation magnitudes. Then similar channels are merged to maintain the original channel number for efficiency. Additionally, an adaptive strategy is designed to autonomously determine the optimal number of sub-channels for channel disassembly. To further compensate for the performance loss caused by quantization, we propose an efficient tuning method that only learns a small number of low-rank weights while freezing the pre-trained quantized model. After training, these low-rank parameters can be fused into the frozen weights without affecting inference. Extensive experiments on LLaMA-1 and LLaMA-2 show that QLLM can obtain accurate quantized models efficiently. For example, QLLM quantizes the 4-bit LLaMA-2-70B within 10 hours on a single A100-80G GPU, outperforming the previous state-of-the-art method by 7.89% on the average accuracy across five zero-shot tasks.

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

↑