LO-BCQ: Locally Optimal Block Clustered Quantization for 4-bit (W4A4) LLM Inference

Reena Elangovan, Charbel Sakr, Anand Raghunathan, Brucek Khailany

TL;DR

This paper introduces LO-BCQ, a novel post-training quantization (PTQ) method that achieves state-of-the-art accuracy for 4-bit weight and activation quantization (W4A4) in Large Language Models (LLMs). By intelligently clustering blocks of tensor data and designing custom codebooks for each cluster, LO-BCQ significantly reduces model size and computational cost with minimal accuracy loss, paving the way for more efficient LLM deployment.

What Problem Does This Paper Address?

Large Language Models (LLMs) are computationally expensive and require significant memory, making their deployment challenging. Quantization, the process of reducing the precision of model weights and activations, is a key technique to address this. While previous work has focused on quantizing weights to very low bitwidths (e.g., 4-bit) while keeping activations at higher precision (e.g., 8-bit), accurately quantizing both weights and activations to sub-8-bit precision without requiring costly re-training (quantization-aware training or QAT) has remained a significant hurdle. This paper tackles the challenge of achieving aggressive W4A4 quantization using post-training quantization (PTQ) methods, aiming to minimize accuracy degradation.

Methods

The core innovation is Block Clustered Quantization (BCQ), a framework that breaks down tensors into blocks (groups of contiguous scalars). These blocks are then clustered based on their statistical properties. For each cluster, a dedicated, optimal quantization codebook is generated.

The paper proposes Locally-Optimal BCQ (LO-BCQ), an iterative algorithm that refines both the block clustering and the codebook generation. It works by:

  1. Block Clustering: Assigning each block to a cluster that minimizes its quantization error, given the current codebooks.
  2. Codebook Update: Using the Lloyd-Max algorithm (a standard method for optimal quantization) to generate new, improved codebooks for each cluster, based on the blocks assigned to them.

This iterative process greedily minimizes the quantization Mean Squared Error (MSE). A key aspect is that the generated codebooks are static and can be used across different models and layers, simplifying deployment. The method also incorporates per-block array scale factors and uses 6-bit integers for codebook entries, with an effective bitwidth of around 4.5 bits for W4A4.

Datasets

The paper evaluates its method on several large language models and downstream tasks.

  • Models: GPT3 (1.3B, 8B, 22B), Llama2 (7B, 70B), and Nemotron4 (15B, 340B).
  • Downstream Tasks:
    • Perplexity: Wikitext-103 (for language modeling performance).
  • Accuracy: * LM evaluation harness (including tasks like RA, BQ, WG, HS, PQ).
  • MMLU (Massive Multitask Language Understanding).

Calibration data was sampled from GPT3 models on the Wikitext-103 dataset.

Key Insights and Ideas

  • Clustering is Key for Aggressive Quantization: The paper demonstrates that simply quantizing blocks isn't enough. Clustering blocks with similar statistical properties allows for the creation of more specialized and effective codebooks, leading to better accuracy at low bitwidths.
  • Universally Calibrated Codebooks: A surprising finding is that codebooks calibrated on a general dataset (like GPT3 on Wikitext-103) perform comparably to layer-specific or tensor-specific calibrated codebooks across various models and layers. This significantly simplifies the deployment pipeline.
  • Trade-off Between Flexibility and Overhead: LO-BCQ balances the flexibility of mapping blocks to different codebooks with the overhead of storing codebook selectors. The paper shows that increasing the number of codebooks generally improves accuracy, but this comes at the cost of increased bitwidth.
  • Codebook Entries Matter: The choice of bitwidth for codebook entries (e.g., INT6 vs. INT4) has a significant impact on accuracy. INT6 entries provide a good balance, achieving near-INT8 performance with much smaller storage.

Key Results

  • State-of-the-Art W4A4 Quantization: LO-BCQ achieves less than 1% loss in average accuracy across downstream tasks (MMLU, LM evaluation harness) and less than 0.12% loss in perplexity on Wikitext-103 for W4A4 quantization, outperforming existing PTQ methods.
  • Minimal Accuracy Loss: For W4A4, LO-BCQ demonstrates < 1% loss in average accuracy on LM evaluation harness tasks and < 0.1% loss in perplexity on Wikitext-103 across large models like GPT3, Llama2, and Nemotron4.
  • Efficient Codebooks: The method uses a small number of codebooks (Nc <= 16) with few entries (16 per codebook), resulting in a negligible memory footprint (<= 0.19KB).
  • Competitive with Weight-Only Methods: Even when compared to weight-only quantization methods, LO-BCQ shows competitive results, especially considering it quantizes both weights and activations.

Limitations and Future Work

  • Calibration Effort: While universal calibration is a strength, the initial calibration process still requires some data.
  • Bitwidth Trade-off: The paper acknowledges an inherent trade-off between accuracy and complexity (bitwidth) as described by Equation 3. Increasing the number of codebooks or decreasing block length improves accuracy but increases bitwidth.
  • Future Work: The authors suggest exploring opportunities to improve inference efficiency, potentially by leveraging the static nature of the codebooks and the reduced computational requirements. They also aim to investigate even more aggressive quantization schemes.

Summary updated

BibTeX
@article{elangovan2025lo,
  author = {Reena Elangovan and Charbel Sakr and Anand Raghunathan and Brucek Khailany},
  title = {{LO-BCQ: Locally Optimal Block Clustered Quantization for 4-bit (W4A4) LLM Inference}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=loWISTqGwW},
}
Figure