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

Agile-Quant:面向边缘设备上LLM更快推理的激活引导量化

Agile-Quant: Activation-Guided Quantization for Faster Inference of LLMs on the Edge

Oracle

Xuan Shen, Peiyan Dong, Lei Lu, Zhenglun Kong, Zhengang Li, Ming Lin, Chao Wu, Yanzhi Wang

AI总结:

本文提出Agile-Quant,一种激活引导的量化框架,实现对LLM权重和激活的同步量化,在边缘设备上实现高达2.55倍推理加速,同时保持任务性能。

摘要:

大型语言模型(LLMs)因其在复杂语言建模任务中的出色表现而脱颖而出。然而,它们对计算和内存的高需求对在边缘设备上的广泛应用构成了障碍。为此,引入量化技术以提升LLMs在设备上的效率。近期研究表明,8位或更低位的权重量化是可行的,且对端到端任务性能影响极小,但激活值仍未量化。另一方面,主流商用边缘设备仍难以有效执行这些低于8位的量化网络。在本文中,我们提出Agile-Quant,一种面向流行大型语言模型(LLMs)的激活引导量化框架,并在多个边缘设备上实现端到端加速器以实现更快的推理。考虑到硬件性能分析和激活分析,我们首先引入一种基本的激活量化策略,以平衡任务性能与实际推理速度之间的权衡。然后,我们利用激活感知的令牌剪枝技术来减少异常值及其对注意力机制的不利影响。最终,我们利用基于SIMD的4位乘法器和我们高效的TRIP矩阵乘法在边缘设备上实现LLMs的加速器。我们将该框架应用于不同规模的LLMs,包括LLaMA、OPT和BLOOM,采用4位或8位激活量化以及4位权重量化。实验表明,Agile-Quant实现了模型权重和激活的同步量化,同时保持与仅权重量化方法相当的任务性能。此外,在8位和4位场景下,与FP16对应版本相比,Agile-Quant在多个边缘设备上实现了高达2.55倍的设备端加速,标志着该领域的开创性进展。代码:https://github.com/shawnricecake/agile-quant

英文摘要:

Large Language Models (LLMs) stand out for their impressive performance in intricate language modeling tasks. However, their demanding computational and memory needs pose obstacles for broad use on edge devices. Quantization is then introduced to boost LLMs' on-device efficiency. Recent works show that 8-bit or lower weight quantization is feasible with minimal impact on end-to-end task performance, while the activation is still not quantized. On the other hand, mainstream commodity edge devices still struggle to execute these sub-8-bit quantized networks effectively. In this paper, we propose Agile-Quant, an activation-guided quantization framework for popular Large Language Models (LLMs), and implement an end-to-end accelerator on multiple edge devices for faster inference. Considering the hardware profiling and activation analysis, we first introduce a basic activation quantization strategy to balance the trade-off of task performance and real inference speed. Then we leverage the activation-aware token pruning technique to reduce the outliers and the adverse impact on attentivity. Ultimately, we utilize the SIMD-based 4-bit multiplier and our efficient TRIP matrix multiplication to implement the accelerator for LLMs on the edge. We apply our framework on different scales of LLMs including LLaMA, OPT, and BLOOM with 4-bit or 8-bit for the activation and 4-bit for the weight quantization. Experiments show that Agile-Quant achieves simultaneous quantization of model weights and activations while maintaining task performance comparable to existing weight-only quantization methods. Moreover, in the 8- and 4-bit scenario, Agile-Quant achieves an on-device speedup of up to 2.55x compared to its FP16 counterparts across multiple edge devices, marking a pioneering advancement in this domain. Code: https://github.com/shawnricecake/agile-quant

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

↑