Sub-4-Bit Quantization: AQLM, QuIP#, & HQQ
State-of-the-art methods for 2-3 bit quantization of LLMs: additive quantization (AQLM), incoherence processing (QuIP#), half-quadratic quantization (HQQ), and the information-theoretic limits of compression.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- Why Sub-4-Bit Is Hard
- AQLM: Additive Quantization
- QuIP#: Incoherence Processing
- HQQ: Half-Quadratic Quantization
- SqueezeLLM: Sensitivity-Based Sparsity
- Quality at 2-3 Bits
- Information-Theoretic Limits
- Common Pitfalls
- Summary
- Exercises
Learning Objectives
- Explain why standard quantization fails below 4 bits.
- Describe AQLM's multi-codebook approach.
- Derive QuIP#'s incoherence transformation and its benefit.
- Compare 2-bit methods (AQLM, QuIP#, HQQ) against each other.
- Analyze the theoretical minimum bits needed to represent a model without quality loss.
Notation
- — codebook
- — number of residual codebooks (AQLM)
- — random orthogonal matrix (incoherence processing)
Core Intuition
Below 4 bits, the number of representable values is so small (8 at 3 bits, 4 at 2 bits) that scalar quantization cannot preserve weight distributions. Advanced methods overcome this by: (1) quantizing GROUPS of weights jointly (vector quantization/codebooks), (2) making the weight matrix "easier" to quantize via random rotations (incoherence), or (3) combining sparse outlier storage with aggressive low-bit compression of the remaining weights.
Sub-4-Bit Quantization
Why Sub-4-Bit Is Hard
The fundamental problem: At 2 bits, only 4 values represent each weight. For a Gaussian with :
16x more error at 2-bit vs 4-bit. This compounds across layers.
Additional problems:
- Weight correlations are ignored by scalar quantization.
- Outlier weights cannot be represented with so few levels.
- Per-group overhead becomes prohibitive (need very small groups → more scales).
AQLM: Additive Quantization
Key idea (Egiazarian et al., 2024): Instead of scalar quantization, use VECTOR quantization with multiple additive codebooks:
where each is a learned codebook with entries, and is the codebook index.
Bits per weight: Group of weights represented by codebook indices of bits each:
For : BPW = bits.
Training: Alternate between:
- Fix codebooks, optimize assignments (beam search).
- Fix assignments, optimize codebooks (least squares).
- Fine-tune with STE.
Result: At 2 bits, AQLM achieves perplexity close to GPTQ at 3 bits.
QuIP#: Incoherence Processing
Key idea (Chee et al., 2024): Make the weight matrix "maximally spread out" before quantization.
Incoherence: A matrix is incoherent if its entries are roughly uniform in magnitude (no outliers). Quantization error is lower for incoherent matrices.
Random Hadamard rotation:
where are random orthogonal matrices (implemented via Hadamard + random signs for cost).
Why it helps: Outlier weights are "spread" across many entries after rotation. Each entry becomes more uniform → standard quantization works better.
Lattice quantization: After incoherence processing, use E8 lattice (8D geometric structure) for vector quantization — provably optimal packing at 2 bits.
Result: State-of-the-art 2-bit quantization. LLaMA-2 70B at 2 bits approaches 4-bit GPTQ quality.
HQQ: Half-Quadratic Quantization
Key idea (Badri & Shaji, 2023): Formulate quantization as an optimization problem with a half-quadratic penalty:
Solved via alternating minimization:
- Optimize continuous relaxation.
- Project to quantization grid.
- Repeat.
Advantages:
- No calibration data needed (unlike GPTQ, AWQ).
- Very fast (minutes, not hours).
- Comparable quality to GPTQ at 4 bits; competitive at 2-3 bits.
SqueezeLLM: Sensitivity-Based Sparsity
Hybrid approach (Kim et al., 2024):
- Identify sensitive weights via second-order information (Hessian diagonal).
- Store sensitive weights as sparse FP16 values.
- Quantize remaining weights aggressively (3-4 bits).
Typical sparsity: 0.5-1% of weights stored in FP16. These are the "outliers" that would ruin quantization.
BPW calculation: BPW for sparsity.
Quality at 2-3 Bits
LLaMA-2 70B perplexity (WikiText-2):
| Method | 2-bit | 3-bit | 4-bit |
|---|---|---|---|
| RTN | diverges | 12.5 | 5.8 |
| GPTQ | 15.2 | 6.1 | 5.5 |
| AQLM | 6.8 | 5.7 | 5.4 |
| QuIP# | 6.2 | 5.6 | 5.4 |
| FP16 | 5.3 | 5.3 | 5.3 |
Key takeaway: At 2 bits, advanced methods (AQLM, QuIP#) maintain usable quality. RTN and even GPTQ struggle significantly. The gap narrows at 3-4 bits.
Information-Theoretic Limits
Rate-distortion theory: For a source with distribution and MSE distortion :
For near-zero distortion: Need approximately - bits for typical weight distributions.
Practical minimum: Around 1.5-2 bits before quality degrades irrecoverably (assuming optimal coding like AQLM). This aligns with BitNet b1.58 results.
Implication: There IS a hard floor. Below 1.5 bits, no method can maintain quality without increasing model width.
Common Pitfalls
Pitfall 1. Evaluating 2-bit models on perplexity alone. Perplexity may look acceptable but downstream task quality (reasoning, coding) degrades disproportionately at extreme quantization.
Pitfall 2. Using GPTQ/AWQ at 2 bits. These methods are designed for 4-bit; they lose competitiveness below 3 bits. Use AQLM or QuIP# instead.
Pitfall 3. Ignoring the decoding overhead of vector quantization. Codebook lookups add latency; actual inference speed may not improve proportionally to memory savings.
Summary
- Sub-4-bit requires fundamentally different approaches than scalar quantization.
- AQLM: Multi-codebook vector quantization; best quality at 2 bits.
- QuIP#: Random rotation for incoherence + lattice quantization.
- HQQ: No calibration data needed; fast; competitive quality.
- SqueezeLLM: Sparse outliers in FP16 + aggressive low-bit dense.
- Limits: 1.5-2 bits is the information-theoretic floor for Gaussian weights.
- Below 3 bits: specialized methods essential; above 3 bits: GPTQ/AWQ sufficient.
Exercises
Exercise 1. For AQLM with : compute BPW and total model size for a 7B model.
Exercise 2. Prove that multiplying by a random orthogonal matrix reduces the maximum entry of a matrix in expectation (incoherence argument).
Exercise 3. Compute the rate-distortion function for a Gaussian with . What MSE corresponds to 2 bits? Is this tolerable?
Exercise 4. Design a codebook with entries optimized for a standard normal distribution. Where should the 16 centroids be placed?
Exercise 5. Compare the decode throughput (tokens/sec) of AQLM-2bit vs GPTQ-4bit on GPU, accounting for codebook lookup overhead.