Skip to main content
QUICK REVIEW

[Paper Review] QServe: W4A8KV4 Quantization and System Co-design for Efficient LLM Serving

Yujun Lin, Haotian Tang|arXiv (Cornell University)|May 7, 2024
Wireless Power Transfer SystemsEngineering6 citations
TL;DR

The paper proposes QoQ W4A8KV4 quantization and a co-designed QServe system to accelerate LLM serving, achieving significant throughput gains over TensorRT-LLM and prior 4-bit methods.

ABSTRACT

Quantization can accelerate large language model (LLM) inference. Going beyond INT8 quantization, the research community is actively exploring even lower precision, such as INT4. Nonetheless, state-of-the-art INT4 quantization techniques only accelerate low-batch, edge LLM inference, failing to deliver performance gains in large-batch, cloud-based LLM serving. We uncover a critical issue: existing INT4 quantization methods suffer from significant runtime overhead (20-90%) when dequantizing either weights or partial sums on GPUs. To address this challenge, we introduce QoQ, a W4A8KV4 quantization algorithm with 4-bit weight, 8-bit activation, and 4-bit KV cache. QoQ stands for quattuor-octo-quattuor, which represents 4-8-4 in Latin. QoQ is implemented by the QServe inference library that achieves measured speedup. The key insight driving QServe is that the efficiency of LLM serving on GPUs is critically influenced by operations on low-throughput CUDA cores. Building upon this insight, in QoQ algorithm, we introduce progressive quantization that can allow low dequantization overhead in W4A8 GEMM. Additionally, we develop SmoothAttention to effectively mitigate the accuracy degradation incurred by 4-bit KV quantization. In the QServe system, we perform compute-aware weight reordering and take advantage of register-level parallelism to reduce dequantization latency. We also make fused attention memory-bound, harnessing the performance gain brought by KV4 quantization. As a result, QServe improves the maximum achievable serving throughput of Llama-3-8B by 1.2x on A100, 1.4x on L40S; and Qwen1.5-72B by 2.4x on A100, 3.5x on L40S, compared to TensorRT-LLM. Remarkably, QServe on L40S GPU can achieve even higher throughput than TensorRT-LLM on A100. Thus, QServe effectively reduces the dollar cost of LLM serving by 3x. Code is available at https://github.com/mit-han-lab/omniserve.

Motivation & Objective

  • Motivate the need for efficient LLM serving beyond W8A8 and W4A16 quantization in cloud settings.
  • Introduce a 4-bit weight, 8-bit activation, 4-bit KV cache quantization (W4A8KV4) to maximize throughput while controlling accuracy loss.
  • Develop a system-software and algorithm co-design (QoQ and QServe) to minimize runtime overheads on GPUs during inference.
  • Mitigates accuracy degradation from KV4 quantization with SmoothAttention and other quantization optimizations.
  • Demonstrate real-world throughput improvements on multiple LLMs across A100 and L40S GPUs.

Proposed method

  • Introduce QoQ (Quattuor-Octō-Quattuor) quantization with progressive group quantization to enable W4A8KV4 computation on INT8 tensor cores.
  • Develop SmoothAttention to reduce accuracy loss from KV4 quantization by shaping key activations.
  • Design compute-aware weight reordering and register-level parallelism to reduce dequantization latency in the main loop of W4A8 GEMM.
  • Fuse dequantization into the GEMM kernel to maintain high throughput and achieve a memory-bound attention kernel.
  • Implement a QServe runtime that handles W4A8 inputs, FP16 outputs, per-head dynamic KV cache quantization, and in-flight batching.
  • Provide optimizations to make attention kernels memory-bound and minimize CUDA core overhead in the main loop.

Experimental results

Research questions

  • RQ1Can W4A8KV4 quantization with QoQ deliver higher end-to-end LLM serving throughput than existing 8-bit and 4-bit systems in cloud settings?
  • RQ2What quantization, scheduling, and kernel design strategies minimize dequantization overhead in the main loop of GEMM for LLMs?
  • RQ3How effective is SmoothAttention in preserving accuracy under KV4 quantization for Llama and Qwen models?
  • RQ4How does compute-aware weight reordering and fused KV4 attention impact overall serving throughput across different GPU architectures (A100 vs L40S)?
  • RQ5What are the practical throughput and cost benefits of QServe compared to TensorRT-LLM, Atom, and QuaRot in real-world serving scenarios?

Key findings

  • QServe achieves 1.2-2.4× higher throughput on Llama-3-8B and 2.4× on Qwen1.5-72B over the best TensorRT-LLM configuration on A100 GPUs.
  • QServe delivers 2.5-2.9× higher throughput than Atom and QuaRot on A100 GPUs across tested models.
  • On L40S GPUs, QServe attains 1.5-3.5× throughput improvements over TensorRT-LLM, with six of eight models matching or exceeding A100 performance while reducing cost.
  • QServe reduces LLM serving dollar cost by approximately 3× compared to baseline systems.
  • QoQ enables efficient W4A8 KV4 GEMM by ensuring computations run on INT8 tensor cores with minimized main-loop overhead.
  • SmoothAttention effectively mitigates accuracy loss from KV4 quantization for KV4 attention.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.