arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.10960cs.LGcs.CLcs.DC
收藏

面向查找表量化大语言模型的快速矩阵乘法

Fast Matrix Multiplications for Lookup Table-Quantized LLMs

Massachusetts Institute of Technology(麻省理工学院);High School of Mathematics Plovdiv(普罗夫迪夫数学中学);Carnegie Mellon University(卡内基梅隆大学);MBZUAI(穆罕默德·本·扎耶德人工智能大学);Petuum Inc.(派图公司)

Han Guo, William Brandon, Radostin Cholakov, Jonathan Ragan-Kelley, Eric P. Xing, Yoon Kim

AI总结:

针对查找表量化大语言模型推理的内存带宽瓶颈与高性能内核开发难题,本文提出FLUTE引擎,通过权重离线重构、查找表向量化复制等优化,实现比现有GEMM内核2-4倍的速度提升,并应用于LLaMA3量化获得1.5-2倍端到端吞吐量提升。

摘要:

大语言模型(LLM)的部署通常受限于内存带宽,其主要瓶颈在于将模型参数从GPU全局内存传输到寄存器的开销。因此,仅权重量化结合融合反量化与矩阵乘法运算的自定义内核,可通过减少内存移动量实现更快的推理。然而,为权重量化的LLM开发高性能内核存在巨大挑战,尤其是当权重通过非均匀查找表(LUT)量化被压缩到非整数字宽(如3比特)时。本文提出FLUTE——一种面向LUT量化LLM的灵活查找表引擎,它通过对量化权重矩阵进行离线重构,最大限度减少解包相关的位操作,并对查找表进行向量化与复制,以缓解共享内存带宽限制。在批量大小小于32、量化组大小为128(LLM推理中的典型设置)的情况下,FLUTE内核的速度可达现有GEMM内核的2-4倍。作为FLUTE的一项应用,我们对基于查找表的NormalFloat量化进行了简单扩展,并将其用于将LLaMA3量化为多种配置,在取得与强基线相当的量化性能的同时,实现了1.5至2倍的端到端吞吐量提升。

英文摘要:

The deployment of large language models (LLMs) is often constrained by memory bandwidth, where the primary bottleneck is the cost of transferring model parameters from the GPU's global memory to its registers. When coupled with custom kernels that fuse the dequantization and matmul operations, weight-only quantization can thus enable faster inference by reducing the amount of memory movement. However, developing high-performance kernels for weight-quantized LLMs presents substantial challenges, especially when the weights are compressed to non-evenly-divisible bit widths (e.g., 3 bits) with non-uniform, lookup table (LUT) quantization. This paper describes FLUTE, a flexible lookup table engine for LUT-quantized LLMs, which uses offline restructuring of the quantized weight matrix to minimize bit manipulations associated with unpacking, and vectorization and duplication of the lookup table to mitigate shared memory bandwidth constraints. At batch sizes < 32 and quantization group size of 128 (typical in LLM inference), the FLUTE kernel can be 2-4x faster than existing GEMM kernels. As an application of FLUTE, we explore a simple extension to lookup table-based NormalFloat quantization and apply it to quantize LLaMA3 to various configurations, obtaining competitive quantization performance against strong baselines while obtaining an end-to-end throughput increase of 1.5 to 2 times.

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

↑