arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.03788cs.LGcs.CL
收藏

SmoothQuant+:面向 LLM 的准确且高效的 4 比特训练后权重量化

SmoothQuant+: Accurate and Efficient 4-bit Post-Training WeightQuantization for LLM

ZTE Corporation(中兴通讯股份有限公司)

Jiayi Pan, Chengcan Wang, Kaifu Zheng, Yangguang Li, Zhenyu Wang, Bin Feng

AI总结:

本文提出 SmoothQuant+,通过按通道平滑激活异常值并等价调整权重,实现无需训练的 LLM 4 比特仅权重 PTQ;集成 vLLM 后,Code Llama-34B 在单张 A100 上精度无损且吞吐提升 1.9–4.0 倍。

摘要:

大语言模型(LLM)已在各类任务中展现出卓越能力。然而,其庞大的模型规模以及随之而来的计算和内存资源需求,也给模型部署带来了挑战。目前,4 比特训练后量化(PTQ)已在 LLM 中取得一定成功;与 FP16 模型相比,它将内存占用减少约 75%,但会带来一定的精度损失。本文提出 SmoothQuant+,这是一种准确、高效且无需额外训练的 4 比特仅权重 PTQ 方法,首次使 LLM 实现精度无损。基于权重量化损失会被激活异常值放大这一事实,SmoothQuant+ 在量化前按通道平滑激活异常值,同时调整相应权重以保持数学等价性,随后对线性层执行分组 4 比特权重量化。我们已将 SmoothQuant+ 集成到 vLLM 框架中;vLLM 是专为 LLM 开发的先进高吞吐量推理引擎,并为其配备高效的 W4A16 CUDA 内核,使 vLLM 能够无缝支持 SmoothQuant+ 4 比特权重量化。结果表明,借助 SmoothQuant+,Code Llama-34B 模型可在单张 A100 40GB GPU 上完成量化和部署,实现精度无损,并且与部署在两张 A100 40GB GPU 上的 FP16 模型相比,吞吐量提升 1.9 至 4.0 倍。此外,每 token 延迟仅为部署在两张 A100 40GB GPU 上的 FP16 模型的 68%。据我们所知,这是面向 LLM 的最先进 4 比特权重量化方法。

英文摘要:

Large language models (LLMs) have shown remarkable capabilities in various tasks. However their huge model size and the consequent demand for computational and memory resources also pose challenges to model deployment. Currently, 4-bit post-training quantization (PTQ) has achieved some success in LLMs, reducing the memory footprint by approximately 75% compared to FP16 models, albeit with some accuracy loss. In this paper, we propose SmoothQuant+, an accurate and efficient 4-bit weight-only PTQ that requires no additional training, which enables lossless in accuracy for LLMs for the first time. Based on the fact that the loss of weight quantization is amplified by the activation outliers, SmoothQuant+ smoothes the activation outliers by channel before quantization, while adjusting the corresponding weights for mathematical equivalence, and then performs group-wise 4-bit weight quantization for linear layers. We have integrated SmoothQuant+ into the vLLM framework, an advanced high-throughput inference engine specially developed for LLMs, and equipped it with an efficient W4A16 CUDA kernels, so that vLLM can seamlessly support SmoothQuant+ 4-bit weight quantization. Our results show that, with SmoothQuant+, the Code Llama-34B model can be quantized and deployed on a A100 40GB GPU, achieving lossless accuracy and a throughput increase of 1.9 to 4.0 times compared to the FP16 model deployed on two A100 40GB GPUs. Moreover, the latency per token is only 68% of the FP16 model deployed on two A100 40GB GPUs. This is the state-of-the-art 4-bit weight quantization for LLMs as we know.

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

↑