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

双粒度量化:面向大语言模型的高效细粒度量化

Dual Grained Quantization: Efficient Fine-Grained Quantization for LLM

Zhejiang University(浙江大学);Shanghai Jiao Tong University(上海交通大学)

Luoming Zhang, Wen Fei, Weijia Wu, Yefei He, Zhenyu Lou, Hong Zhou

AI总结:

针对大语言模型细粒度量化推理效率低的问题,提出双粒度量化DGQ方法,结合两阶段网格搜索与百分位裁剪,实现A8W4量化下性能与推理速度的兼顾,优于现有方法并支持高效部署。

摘要:

大语言模型(LLM)在内存需求与计算能力方面带来了严峻的硬件挑战。当前LLM主要有两种主流量化方案:粗粒度(如逐通道)量化与细粒度(如逐分组)量化。细粒度量化的量化损失更小,因此能取得更优的性能,但将其应用于权重-激活量化时,会破坏连续的整数矩阵乘法,导致推理效率低下。本文提出双粒度量化(DGQ),这是一种面向LLM的新型A8W4量化方法,既能保持优异性能,又能确保较快的推理速度。DGQ将细粒度INT4权重量反量化为粗粒度INT8表示,并使用INT8计算核执行矩阵乘法。此外,我们开发了两阶段网格搜索算法,以简化细粒度与粗粒度量化尺度的确定过程。我们还设计了一种百分位裁剪方案,无需复杂优化技术即可平滑激活异常值。实验结果表明,在多种LLM架构与广泛任务上,DGQ的性能始终优于现有方法。值得注意的是,通过我们实现的高效CUTLASS计算核,与A16W4实现相比,我们实现了1.12倍的内存缩减与3.24倍的速度提升。这些进展为A8W4 LLM在实际应用中的高效部署提供了支撑。

英文摘要:

Large Language Models (LLMs) pose significant hardware challenges related to memory requirements and computational ability. There are two mainstream quantization schemes for LLMs: coarse-grained ($\textit{e.g.,}$ channel-wise) quantization and fine-grained ($\textit{e.g.,}$ group-wise) quantization. Fine-grained quantization has smaller quantization loss, consequently achieving superior performance. However, when applied to weight-activation quantization, it disrupts continuous integer matrix multiplication, leading to inefficient inference. In this paper, we introduce Dual Grained Quantization (DGQ), a novel A8W4 quantization for LLM that maintains superior performance while ensuring fast inference speed. DSQ dequantizes the fine-grained INT4 weight into coarse-grained INT8 representation and preform matrix multiplication using INT8 kernels. Besides, we develop a two-phase grid search algorithm to simplify the determination of fine-grained and coarse-grained quantization scales. We also devise a percentile clipping schema for smoothing the activation outliers without the need for complex optimization techniques. Experimental results demonstrate that DGQ consistently outperforms prior methods across various LLM architectures and a wide range of tasks. Remarkably, by our implemented efficient CUTLASS kernel, we achieve $\textbf{1.12}$ $\times$ memory reduction and $\textbf{3.24}$ $\times$ speed gains comparing A16W4 implementation. These advancements enable efficient deployment of A8W4 LLMs for real-world applications.

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

↑