Skip to main content
QUICK REVIEW

[论文解读] AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration

Ji Lin, Jiaming Tang|arXiv (Cornell University)|Jun 1, 2023
Topic ModelingComputer Science被引用 74
一句话总结

AWQ 提出了一种仅权重的、低比特量化方法,利用基于激活的每通道缩放来保护极小部分显著权重,实现强泛化,并在 FP16 基线上获得 3.2–3.3x 加速,且支持边缘部署。

ABSTRACT

Large language models (LLMs) have transformed numerous AI applications. On-device LLM is becoming increasingly important: running LLMs locally on edge devices can reduce the cloud computing cost and protect users' privacy. However, the astronomical model size and the limited hardware resource pose significant deployment challenges. We propose Activation-aware Weight Quantization (AWQ), a hardware-friendly approach for LLM low-bit weight-only quantization. AWQ finds that not all weights in an LLM are equally important. Protecting only 1% salient weights can greatly reduce quantization error. To identify salient weight channels, we should refer to the activation distribution, not weights. To avoid the hardware-inefficient mix-precision quantization, we mathematically derive that scaling up the salient channels can reduce the quantization error. AWQ employs an equivalent transformation to scale the salient weight channels to protect them. The scale is determined by collecting the activation statistics offline. AWQ does not rely on any backpropagation or reconstruction, so it generalizes to different domains and modalities without overfitting the calibration set. AWQ outperforms existing work on various language modeling and domain-specific benchmarks (coding and math). Thanks to better generalization, it achieves excellent quantization performance for instruction-tuned LMs and, for the first time, multi-modal LMs. Alongside AWQ, we implement TinyChat, an efficient and flexible inference framework tailored for 4-bit on-device LLM/VLMs. With kernel fusion and platform-aware weight packing, TinyChat offers more than 3x speedup over the Huggingface FP16 implementation on both desktop and mobile GPUs. It also democratizes the deployment of the 70B Llama-2 model on mobile GPUs.

研究动机与目标

  • 在不重新训练的情况下,推动缓解大型语言模型(LLMs)中的内存和带宽瓶颈。
  • 研究是否存在一小部分权重对 LLM 性能具有不成比例的重要性。
  • 提出一种数据驱动、对校准集鲁棒的低比特权重量化方法,以保持泛化性。
  • 展示对大型模型的实际加速和边缘部署的可行性。

提出的方法

  • 通过激活幅度而非权重幅度来识别显著的权重通道。
  • 开发逐通道缩放以降低显著通道的量化误差(AWQ 缩放)。
  • 通过对 [0,1] 进行网格搜索来优化单一超参数 alpha 用以控制缩放。
  • 使用分组量化的 INT3/INT4,分组大小为 128,且采用小的校准集以避免过拟合。
  • 可选地应用权重裁剪以进一步降低量化误差(Delta 变化)。
  • 提供一个边缘优化的推理框架,并进行内核融合以实现实际加速。

实验结果

研究问题

  • RQ1在不进行反向传播或基于重建训练的情况下,低比特权重单独量化是否能保持 LLM 的性能?
  • RQ2基于激活的显著权重通道识别是否优于权重幅度的启发式在量化质量上?
  • RQ3在跨体系结构和模态下,保持可接受的困惑度和性能的前提下,我们能把量化位数推进到多远(INT3/INT4,甚至使用 GPTQ 的 INT2)?
  • RQ4AWQ 是否能使大型模型(如 70B)在内存有限的设备上实现实际的边缘部署?

主要发现

  • AWQ 在 LLaMA 与 OPT 系列的 7B–70B 规模下,在困惑度方面持续优于四舍五入到最近值(RTN)和 GPTQ。
  • AWQ 在混合精度(1% FP16)下实现具有竞争力的性能,同时保持对硬件友好。
  • 基于激活的显著性(0.1–1% 的通道)相较于权重范数启发式在困惑度方面带来显著提升。
  • AWQ 可推广到指令微调的语言模型(Vicuna)和多模态语言模型(OpenFlamingo-9B),无需特定任务的校准。
  • 系统实现相对于 FP16,在桌面/移动 GPU 上实现 2.7–3.9x 的加速,并使 Jetson Orin 上的 70B Llama-2 与 4070 笔记本上的 13B 成为可能。
  • AWQ 与 GPTQ 正交,当与 GPTQ 结合时可进一步改善 INT2 量化。
  • 基于显著性的缩放将困惑度从 RTN 基线提升(例如,OPT-6.7B Wiki PPL 23.54 提升到 11.92,s=2)。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。