arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2408.11743cs.LG
收藏

MARLIN:大型语言模型上的混合精度自回归并行推理

MARLIN: Mixed-Precision Auto-Regressive Parallel Inference on Large Language Models

Institute of Science and Technology Austria (ISTA)(奥地利科学技术研究所);CITIC, Universidade da Coruña(拉科鲁尼亚大学CITIC研究所);ETH Zurich(苏黎世联邦理工学院);Neural Magic, Inc.(Neural Magic公司)

Elias Frantar, Roberto L. Castro, Jiale Chen, Torsten Hoefler, Dan Alistarh

AI总结:

本文提出混合精度自回归线性内核MARLIN,通过异步内存访问、任务调度与流水线等技术,在批处理场景下实现接近最优的LLM量化推理加速,并兼容vLLM与2:4稀疏性。

摘要:

随着大型语言模型(LLM)上的推理成为机器学习应用中的重要工作负载,权重量化已成为高效 GPU 部署的标准技术。量化不仅减小了模型大小,而且由于减少了内存移动,已被证明能在对准确率影响较低的情况下为单用户推理带来显著的加速。然而,在具有多个并行客户端的批处理设置中是否也能实现加速,仍然是一个未解决的问题,而这对于实际服务高度相关。目前尚不清楚是否可以设计出 GPU 内核,使其在支持批处理工作负载大幅增加的计算需求的同时,仍能在实际中保持内存受限。本文通过描述名为 MARLIN 的混合精度自回归线性内核的设计,肯定地解决了这个问题。具体而言,给定一个权重通过量化压缩为(例如)每个元素 4 比特的模型,MARLIN 表明可以支持高达 16-32 的批大小,并实现接近最大(4 倍)的量化加速;对于高达 64-128 的更大批大小,则能实现逐渐减小但仍显著的加速。MARLIN 通过结合异步内存访问、复杂任务调度与流水线化,以及专门的量化支持等技术来实现这一点。我们的实验表明,MARLIN 在不同场景下的单个 LLM 层上接近最优的性能,在集成到流行的 vLLM 服务引擎时,也能带来端到端的 LLM 推理加速(高达 2.8 倍)。最后,MARLIN 可扩展至其他压缩技术,如 NVIDIA 2:4 稀疏性,从而带来额外的加速。

英文摘要:

As inference on Large Language Models (LLMs) emerges as an important workload in machine learning applications, weight quantization has become a standard technique for efficient GPU deployment. Quantization not only reduces model size, but has also been shown to yield substantial speedups for single-user inference, due to reduced memory movement, with low accuracy impact. Yet, it remains open whether speedups are achievable also in \emph{batched} settings with multiple parallel clients, which are highly relevant for practical serving. It is unclear whether GPU kernels can be designed to remain practically memory-bound, while supporting the substantially increased compute requirements of batched workloads. This paper resolves this question positively by describing the design of Mixed-precision Auto-Regressive LINear kernels, called MARLIN. Concretely, given a model whose weights are compressed via quantization to, e.g., 4 bits per element, MARLIN shows that batchsizes up to 16-32 can be supported with close to maximum ($4\times$) quantization speedup, and larger batchsizes up to 64-128 with gradually decreasing, but still significant, acceleration. MARLIN accomplishes this via a combination of techniques, such as asynchronous memory access, complex task scheduling and pipelining, and bespoke quantization support. Our experiments show that MARLIN's near-optimal performance on individual LLM layers across different scenarios can also lead to end-to-end LLM inference speedups (of up to $2.8\times$) when integrated with the popular vLLM serving engine. Finally, MARLIN is extensible to further compression techniques, like NVIDIA 2:4 sparsity, leading to additional speedups.

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

↑