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

OmniQuant:面向大语言模型的全方向校准量化

OmniQuant: Omnidirectionally Calibrated Quantization for Large Language Models

The Chinese University of Hong Kong(香港中文大学);OpenGVLab(开放视觉实验室);Shanghai AI Laboratory(上海人工智能实验室);The University of Hong Kong(香港大学)

Wenqi Shao, Mengzhao Chen, Zhaoyang Zhang, Peng Xu, Lirui Zhao, Zhiqian Li, Kaipeng Zhang, Peng Gao, Yu Qiao, Ping Luo

AI总结:

OmniQuant通过可学习权重裁剪和可学习等价变换,高效优化量化参数,在极低比特量化下保持性能,适用于多种量化配置,并在指令调优模型中有效。

摘要:

大型语言模型(LLMs)已经彻底改变了自然语言处理任务。然而,它们的实际部署受到其巨大的内存和计算需求的阻碍。尽管最近的后训练量化(PTQ)方法在减少内存占用和提高LLM的计算效率方面是有效的,但它们手工设计量化参数,导致性能低下,尤其是在极低比特量化中。为了解决这个问题,我们引入了一种面向LLM的全方向校准量化(\textbf{OmniQuant})技术,该技术在多样化的量化设置中实现了良好的性能,同时通过高效优化各种量化参数保持了PTQ的计算效率。OmniQuant包含两个创新组件:可学习权重裁剪(LWC)和可学习等价变换(LET)。LWC通过优化裁剪阈值来调节权重的极值。同时,LET通过将量化的挑战从激活转移到权重来解决激活异常值。在可微框架内使用块级误差最小化进行操作,OmniQuant可以高效地优化仅权重和权重-激活量化过程。例如,LLaMA-2模型系列大小7-70B可以在单个A100-40G GPU上使用128个样本在1-16小时内通过OmniQuant处理。大量实验验证了OmniQuant在多种量化配置(如W4A4(4位权重,4位激活)、W6A6、W4A16、W3A16和W2A16)中的优越性能。此外,OmniQuant在指令调优模型中表现出有效性,并在真实设备上提供了推理速度和内存减少的显著改进。代码可在\footnote{https://github.com/OpenGVLab/OmniQuant}获取。

英文摘要:

Large language models (LLMs) have revolutionized natural language processing tasks. However, their practical deployment is hindered by their immense memory and computation requirements. Although recent post-training quantization (PTQ) methods are effective in reducing memory footprint and improving the computational efficiency of LLM, they hand-craft quantization parameters, leading to low performance, especially in extremely low-bit quantization. To tackle this issue, we introduce an Omnidirectionally calibrated Quantization (\textbf{OmniQuant}) technique for LLMs, which achieves good performance in diverse quantization settings while maintaining the computational efficiency of PTQ by efficiently optimizing various quantization parameters. OmniQuant comprises two innovative components including Learnable Weight Clipping (LWC) and Learnable Equivalent Transformation (LET). LWC modulates the extreme values of weights by optimizing the clipping threshold. Meanwhile, LET tackles activation outliers by shifting the challenge of quantization from activations to weights. Operating within a differentiable framework using block-wise error minimization, OmniQuant can optimize the quantization process efficiently for both weight-only and weight-activation quantization. For instance, the LLaMA-2 model family size 7-70B can be processed with OmniQuant on a single A100-40G GPU within 1-16 hours using 128 samples. Extensive experiments validate OmniQuant's superior performance across diverse quantization configurations such as W4A4 (4-bit weight, 4-bit activation), W6A6, W4A16, W3A16, and W2A16. Additionally, OmniQuant demonstrates effectiveness in instruction-tuned models and delivers notable improvements in inference speed and memory reduction on real devices. Codes are available at \url{https://github.com/OpenGVLab/OmniQuant}.

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

↑