TL;DR
Researchers have discovered that neither integer (INT) nor floating-point (FP) formats are universally superior for quantizing Large Language Models (LLMs). By introducing Mixture of Formats Quantization (MoFQ)—a method that selects the optimal format layer-by-layer—they achieved state-of-the-art accuracy in 4-bit and 8-bit quantization with speeds up to 15x faster than industry standards like GPTQ.
What Problem Does This Paper Address?
As Large Language Models (LLMs) grow to hundreds of billions of parameters, deploying them on consumer or even enterprise hardware requires "quantization"—the process of shrinking the precision of model weights and activations (e.g., from 16-bit to 4-bit).
Historically, researchers used integer formats (INT8/INT4). However, new hardware like NVIDIA’s H100 now supports low-bit floating-point (FP8). This creates a dilemma: Which format is better for LLMs? Integer formats provide uniform distribution, while floating-point formats offer higher precision for small values but lower precision for large ones. This paper investigates this trade-off and addresses the "one-size-fits-all" limitation of current quantization schemes.
Methods
The authors propose a two-pronged approach:
- Comparative Analysis: They first benchmarked the hardware cost (silicon area) of INT vs. FP operators. They found that while FP is usually more expensive, the gap vanishes at low bit-widths; at 8-bit, the hardware cost is nearly identical.
- Mixture of Formats Quantization (MoFQ): Instead of forcing the whole model into one format, MoFQ evaluates each layer using both INT and FP. It then selects the format that minimizes a chosen error metric (like Mean Squared Error).
- FP4 Redesign: Standard IEEE FP4 formats waste bit patterns on "Special Values" like NaN (Not a Number) and Inf (Infinity), which aren't useful for model weights. The authors reallocated these 4 bit-patterns to represent additional normalized numbers (±4 and ±6), reducing quantization error by roughly 35%.
Crucially, MoFQ uses a "Round-to-Nearest" (RTN) approach rather than the complex second-order optimization used by methods like GPTQ, making it much faster to execute.
Datasets
The researchers evaluated their approach on two major model families:
- LLaMA (7B, 13B, 33B, and 65B parameters)
- OPT (350M to 30B parameters)
They tested these models across four standard NLP benchmarks:
- WikiText-2: To measure language modeling perplexity.
- LAMBADA, PIQA, and HellaSwag: To measure zero-shot accuracy on common sense reasoning and word prediction.
Key Insights and Ideas
- No Universal Winner: The "aha moment" is that the optimal format depends on the specific tensor. Weights (static) often prefer INT8, but activations (dynamic) often prefer FP8 because they contain significant outliers that the floating-point exponent can handle better.
- The 4-bit Convergence: At 8-bit, INT has a clear advantage for weights. However, at 4-bit, the advantage disappears as the distributions of INT and FP become more similar, making layer-wise selection critical.
- Hardware-Friendly Hybridity: Because MoFQ keeps the bit-width constant (e.g., everything stays 4-bit, just the meaning of the bits changes), it incurs no extra hardware memory overhead compared to single-format quantization.
- Speed Matters: By avoiding the heavy mathematical optimization of GPTQ and focusing on format selection, the authors proved you can get better results in a fraction of the time.
Key Results
- 4-bit Weight-Only (W4A16): MoFQ outperformed GPTQ in accuracy across most LLaMA models. More impressively, it was 10x to 15x faster to compute. For LLaMA-65B, MoFQ took ~5 minutes, while GPTQ took over an hour.
- 8-bit Weight-Activation (W8A8): MoFQ significantly outperformed both INT8-only and FP8-only methods. In many cases, the MoFQ-quantized model performed almost identically to the original uncompressed FP16 model.
- Redesigned FP4: Their custom FP4 format (without NaN/Inf) allowed more layers to "prefer" the FP format over INT4, leading to lower overall model error.
Limitations and Future Work
- Empirical Nature: The study is primarily experimental. While it shows that certain layers prefer different formats, a deeper theoretical framework for why specific weight distributions favor one over the other is still needed.
- Granularity: The current method works at the layer level. The authors suggest that moving to a finer granularity (e.g., choosing formats for individual channels or blocks) could improve accuracy further, though this would increase software complexity.
- Hardware Implementation: While FP8 is supported on H100, the custom "software-level" FP4 requires dequantization during inference, which might limit some of the theoretical speed gains until hardware natively supports these specific bit-mappings.
Summary updated