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

AWQ:基于激活的权重量化用于LLM压缩与加速

AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration

MIT(麻省理工学院);Shanghai Jiao Tong University(上海交通大学);NVIDIA(英伟达);Tsinghua University(清华大学);UMass Amherst(马萨诸塞大学阿姆赫斯特分校)

Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Wei-Ming Chen, Wei-Chen Wang, Guangxuan Xiao, Xingyu Dang, Chuang Gan, Song Han

AI总结:

本文提出AWQ方法,通过识别重要权重通道减少量化误差,实现低比特权重量化,提升LLM的压缩与加速性能,并在多个基准测试中表现优异。

摘要:

大型语言模型(LLMs)已转变了众多AI应用。在设备上运行LLMs越来越重要:在边缘设备上本地运行LLMs可以减少云计算成本并保护用户隐私。然而,天文数字的模型大小和有限的硬件资源带来了重大部署挑战。我们提出激活感知权重量化(AWQ),一种适用于LLM低比特权重仅量化的方法。AWQ发现并非所有LLM中的权重都同等重要。保护仅1%的显著权重可大幅减少量化误差。为了识别显著权重通道,应参考激活分布,而非权重。为了避免硬件效率低的混合精度量化,我们数学推导出扩大显著通道可减少量化误差。AWQ采用等效变换来扩展显著权重通道以保护它们。该缩放由离线收集的激活统计确定。AWQ不依赖任何反向传播或重建,因此能够泛化到不同领域和模态,而不会过拟合校准集。AWQ在各种语言建模和领域特定基准(编码和数学)上优于现有工作。得益于更好的泛化,它在指令调优的LLMs中实现了出色的量化性能,并首次实现了多模态LLMs。除了AWQ,我们还实现了TinyChat,一个高效的、灵活的推断框架,专为4比特在设备上的LLM/VLMs设计。通过内核融合和平台感知的权重打包,TinyChat在桌面和移动GPU上均比Huggingface FP16实现快了超过3倍。它还使70B Llama-2模型在移动GPU上的部署变得更加普及。

英文摘要:

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.

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

↑