Fast and Efficient 2-bit LLM Inference on GPU: 2/4/16-bit in a Weight Matrix with Asynchronous Dequantization

Jinhao Li, Jiaming Xu, Shiyao Li, Shan Huang, Jun Liu, Yaoxiu Lian, Guohao Dai

Abstract

Deploying Large Language Models (LLMs) at scale is constrained by high memory and compute costs. While 4-bit quantization is standard, 2-bit quantization typically suffers from significant accuracy degradation. This paper introduces a novel framework for practical 2-bit LLM inference on GPUs. By employing intra-weight mixed-precision (combining 2-bit and 4-bit within a single matrix), exclusive sparse outliers, and an asynchronous GPU kernel for dequantization, the proposed method achieves a 1.74× speedup on Llama2-7b with minimal accuracy loss. The approach reduces the total cost of ownership by over 2× while outperforming existing state-of-the-art quantization methods like GPTQ and OmniQuant.

Introduction

Large Language Models (LLMs) are notoriously expensive to deploy due to their massive parameter counts. Quantization—reducing the bit-precision of model weights—is the primary solution to save memory and accelerate inference. While 4-bit quantization has become an industry standard, pushing precision down to 2-bit often results in an "accuracy cliff" (typically >3% loss), rendering models unusable for many downstream tasks.

Existing mixed-precision attempts to mitigate this accuracy loss face three major hurdles:

  1. Uneven Distribution: Sensitivity varies significantly not just between layers, but within individual weight matrices.
  2. The Outlier Penalty: Retaining critical weights at high precision (FP16) helps accuracy but degrades GPU performance due to the overhead of processing sparse data.
  3. Dequantization Bottlenecks: On GPUs, "unpacking" quantized weights can consume over 50% of total execution time.

Methodology

To overcome the 2-bit barrier, we propose a three-pronged strategy focusing on intra-weight precision, outlier management, and kernel optimization.

Overview of challenges and the proposed three-pronged methodology.

Intra-weight Mixed-Precision Quantization

Rather than applying uniform precision to a layer, we analyze the sensitivity of small weight groups using Hessian values (second-order derivatives). We assign 4-bit precision to the most sensitive 25% of groups, while the remaining 75% use 2-bit precision. This "islands of 4-bit in a 2-bit sea" approach optimizes the accuracy-to-speed trade-off.

Exclusive 2-bit Sparse Outliers

To minimize speed degradation, we restrict 16-bit "outliers" exclusively to 2-bit groups. By capping the outlier ratio at <0.5%, we remain within the "kernel launch" region of GPU overhead, where the latency of processing these outliers is effectively hidden.

Asynchronous Dequantization

We developed a custom GPU kernel that overlaps scale calculation (2-order dequantization) with weight loading. By treating dequantization as an asynchronous task rather than a sequential step, we hide the unpacking latency behind memory loads, making 2-bit dequantization nearly "free" in terms of time.

Evaluation and Results

The framework was evaluated across several model families, including Llama1/2/3, ChatGLM3-6b, and BERT-base, using benchmarks like WikiText-2 and various zero-shot tasks (Piqa, HellaSwag, etc.).

Performance and accuracy comparison across models and quantization methods.

Efficiency and Cost

For Llama2-7b, the system achieved a 1.74× end-to-end speedup over the original FP16 model. This efficiency translates to a reduction in total cost of ownership (hardware + energy) by up to 2.29×. Our custom GEMV kernel demonstrated speedups of 1.33× to 3.92× over standard FP16 implementations on various NVIDIA GPUs (RTX 3090, A100, RTX 2080).

Accuracy

The method achieves an average of 2.91 bits per weight. On Llama2-7b, it reduced the accuracy loss from 8.7% (standard 2-bit) to just 2.2%, significantly outperforming state-of-the-art methods like GPTQ and OmniQuant at similar bitrates.

Conclusion and Future Work

This work demonstrates that 2-bit LLM inference is practical on standard GPUs without sacrificing model utility. While the current implementation relies on Quantization-Aware Training (QAT) for peak accuracy and focuses on weight-only quantization (W2A16), it provides a significant leap in deployment efficiency. Future work will explore activation quantization to leverage INT8/INT4 tensor cores and porting these optimized kernels to non-NVIDIA hardware architectures.

Summary updated

BibTeX
@misc{li2023fast,
  author = {Jinhao Li and Jiaming Xu and Shiyao Li and Shan Huang and Jun Liu and Yaoxiu Lian and Guohao Dai},
  title = {{Fast and Efficient 2-bit LLM Inference on GPU: 2/4/16-bit in a Weight Matrix with Asynchronous Dequantization}},
  year = {2023},
  eprint = {2311.16442},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.16442},
}
Figure