Abstract
Large Language Models (LLMs) have revolutionized natural language processing tasks. However, their practical application is constrained by substantial memory and computational demands. Post-training quantization (PTQ) is considered an effective method to accelerate LLM inference. Despite its growing popularity in LLM model compression, PTQ deployment faces two major challenges. First, low-bit quantization leads to performance degradation. Second, restricted by the limited integer computing unit type on GPUs, quantized matrix operations with different precisions cannot be effectively accelerated. To address these issues, we introduce a novel arbitrary-bit quantization algorithm and inference framework, ABQ-LLM. It achieves superior performance across various quantization settings and enables efficient arbitrary-precision quantized inference on the GPU. ABQ-LLM introduces several key innovations: (1) a distribution correction method for transformer blocks to mitigate distribution differences caused by full quantization of weights and activations, improving performance at low bit-widths. (2) the bit balance strategy to counteract performance degradation from asymmetric distribution issues at very low bit-widths (e.g., 2-bit). (3) an innovative quantization acceleration framework that reconstructs the quantization matrix multiplication of arbitrary precision combinations based on BTC (Binary TensorCore) equivalents, gets rid of the limitations of INT4/INT8 computing units. ABQ-LLM can convert each component bit width gain into actual acceleration gain, maximizing performance under mixed precision (e.g., W6A6, W2A8). Based on W2*A8 quantization configuration on LLaMA-7B model, it achieved a WikiText2 perplexity of 7.59 (a 2.17 decrease vs 9.76 in AffineQuant). Compared to SmoothQuant, we realized 1.6x acceleration improvement and 2.7x memory compression gain.
Introduction
Post-training quantization (PTQ) is essential for deploying LLMs on consumer hardware, but it faces two primary obstacles. First is the Accuracy Wall: as bit-widths drop below 4 bits, model performance typically collapses. This is often due to sensitive layers, such as the down_proj in transformer blocks, and the disruption of attention maps. Second is the Hardware Wall: modern GPUs are highly optimized for specific precisions like INT8 and INT4. Utilizing "non-standard" precisions, such as 6-bit weights and activations (W6A6), often requires conversion back to INT8, negating efficiency gains. Furthermore, standard kernels struggle with the "GEMV problem"—inefficiency during single-token generation at batch size 1.
ABQ-LLM addresses these challenges by enabling high-performance LLM inference at arbitrary bit-widths. By combining sophisticated distribution correction algorithms with a custom GPU kernel powered by Binary TensorCores, it achieves significant speedups and memory compression while maintaining state-of-the-art accuracy at ultra-low precisions.
Methods
Algorithmic Innovations
ABQ-LLM introduces two key algorithmic strategies to overcome the accuracy wall:
- Distribution Correction (DLC & AKL Loss): Research identified the
down_projlayer and attention maps as highly sensitive to quantization. ABQ-LLM employs Double Cosine Similarity (DLC) loss to align quantized output distributions with full-precision counterparts. Additionally, Attention-aware KL (AKL) divergence ensures the quantized model maintains focus on the "anchor" first token, preserving critical "attention sinks" necessary for stable text generation. - Bit Balance Strategy: Standard 2-bit quantization is often asymmetric (e.g., representing values -2, -1, 0, 1). ABQ-LLM adopts a symmetric range ({-2, -1, 0, 1, 2}) to better match the near-normal distribution of pre-trained weights, significantly recovering performance for W2 configurations.
Custom Software Engine (ABQKernel)
To overcome the hardware wall, ABQ-LLM introduces a novel inference framework:
- Arbitrary Bit Reconstruction: Instead of relying on fixed INT4/INT8 instructions, the engine utilizes Binary TensorCores (BTC)—hardware units designed for 1-bit math. Any $p$-bit by $q$-bit multiplication is mathematically decomposed into a series of 1-bit operations and shifts, allowing for "quantization freedom."
- GEMV Optimization: The engine includes specific optimizations for small batch sizes, removing the padding overhead that typically plagues standard libraries like cuBLAS or CUTLASS when handling non-standard bit-widths.
Results
The researchers evaluated ABQ-LLM on the LLaMA and LLaMA-2 families (7B to 30B parameters) across standard benchmarks including WikiText2, C4, and various zero-shot tasks.
- Superior Accuracy: On LLaMA-7B (W2A8), ABQ-LLM achieved a WikiText2 perplexity of 7.59*, significantly outperforming AffineQuant's 9.76.
- Efficiency Gains: Compared to SmoothQuant (W8A8), ABQ-LLM delivered a 1.6x speedup and 2.7x memory compression.
- Hardware Breakthrough: The custom kernel achieved up to a 7.47x throughput improvement over unoptimized CUTLASS kernels for specific bit combinations.
- Practical Deployment: A LLaMA-30B model quantized with ABQ-LLM can run in just 10GB of VRAM, which is less than the memory required for a standard 16-bit 7B model.
Conclusion
ABQ-LLM demonstrates that treating Binary TensorCores as a programmable substrate allows software to dictate precision rather than hardware constraints. While currently optimized for NVIDIA GPUs with TensorCore support, this framework paves the way for mixed-precision models where every layer has a mathematically optimized bit-width. Future work may involve extending portability to other hardware accelerators and further optimizing the offline calibration process.
Summary updated