The case for 4-bit precision: k-bit Inference Scaling Laws

Tim Dettmers, Luke Zettlemoyer

TL;DR

This paper establishes "inference scaling laws" for Large Language Models (LLMs), revealing that 4-bit precision is the almost universal "sweet spot" for maximizing performance. For a fixed memory budget, it is consistently better to run a larger model at 4-bit precision than a smaller model at higher precision (like 8-bit or 16-bit).

What Problem Does This Paper Address?

Large Language Models (LLMs) like GPT-3 or BLOOM are notoriously resource-hungry, often requiring hundreds of gigabytes of GPU memory. Quantization—reducing the number of bits used to represent each model parameter—is the standard way to shrink these models.

However, researchers faced a fundamental trade-off: Is it better to have a smaller model with high precision, or a larger model with low precision? For example, a 30-billion parameter model in 8-bit precision and a 60-billion parameter model in 4-bit precision take up the same amount of memory. Until this paper, we didn't have a systematic way to know which one would actually perform better across different scales and model families.

Methods

The authors conducted a massive empirical study, running over 35,000 zero-shot experiments across model families including OPT, BLOOM, Pythia, and GPT-2, ranging from 19 million to 176 billion parameters.

Key methodological components included:

  • Bit-Precision Sweep: Testing everything from 3-bit to 16-bit (uncompressed) precision.
  • Data Type Comparison: Evaluating different ways to represent numbers, including standard Integers, Floats, Quantile Quantization (which ensures each "bin" has an equal number of values), and Dynamic Exponent Quantization.
  • Blocking/Grouping: Splitting parameters into small, independently quantized blocks (e.g., blocks of 64 or 128) to isolate the impact of "outlier" values.
  • Proxy Quantization: A novel, input-independent method to identify and protect outlier dimensions by looking at the standard deviation of weights in the previous layer.

Datasets

The researchers evaluated models using two primary metrics:

  1. Perplexity: Measured on the CommonCrawl subset of The Pile.
  2. Zero-Shot Accuracy: Evaluated using the EleutherAI LM Evaluation harness on four standard benchmarks: LAMBADA (word prediction), PiQA (physical commonsense), HellaSwag (sentence completion), and Winogrande (adversarial Winograd schemas).

Key Insights and Ideas

  • The 4-Bit Frontier: The most striking "aha moment" is that 4-bit is the optimal point on the Pareto frontier. While 3-bit quantization often causes performance to "fall off a cliff" (especially in models like OPT and Pythia), 4-bit maintains enough precision to allow the benefits of a larger parameter count to shine through.
  • Parallel Scaling: Scaling curves for different precisions (4, 8, 16-bit) are remarkably parallel. This means that the "cost" of quantization is relatively constant regardless of whether the model has 1 billion or 100 billion parameters.
  • Block Size is a "Free Lunch": Using a small block size (e.g., 64) for quantization adds a negligible amount of memory (about 0.25 bits per parameter) but improves accuracy as much as moving from 4-bit to 5-bit precision would.
  • Perplexity as a North Star: The authors found a -0.94 Pearson correlation between perplexity and zero-shot accuracy. This confirms that perplexity—a much "smoother" and less noisy metric—is an excellent proxy for how well a quantized model will actually perform on tasks.

Key Results

  • 4-bit is King: For a fixed total bit budget, 4-bit parameters yielded the highest zero-shot accuracy across almost all model families and scales.
  • 3-bit Instability: Models like OPT and Pythia became highly unstable at 3-bit precision, with performance dropping toward random chance. While "Proxy Quantization" could stabilize them, they still couldn't beat the scaling efficiency of 4-bit models.
  • Data Type Matters: Quantile quantization and Floating Point (Float) data types consistently outperformed standard Integer (Int) quantization at low bit-widths.
  • Optimal Block Size: For 4-bit models, a block size between 64 and 128 was found to be optimal for balancing memory overhead and accuracy.

Limitations and Future Work

  • Hardware Implementation: While Quantile Quantization is theoretically superior, it relies on lookup tables that are currently difficult to implement efficiently on highly parallel GPU hardware.
  • High-Throughput Scaling: The "inference scaling laws" presented here assume small batch sizes where memory bandwidth is the bottleneck. In high-throughput scenarios (large batches that don't fit in L1 cache), different scaling laws involving both low-bit weights and low-bit inputs may be required.
  • One-Shot Methods: The study focused on zero-shot quantization (no extra data needed). The authors note that "one-shot" methods like GPTQ (which use a small calibration dataset) show promise for making 2-bit or 3-bit precision viable, but these are significantly more computationally expensive to study at scale.
  • Software Optimization: The authors acknowledge that their current CUDA kernels are unoptimized; while the "roofline model" suggests 4x speedups are possible, current implementations haven't reached that ceiling yet.

Summary updated

BibTeX
@inproceedings{dettmers2023case,
  author = {Tim Dettmers and Luke Zettlemoyer},
  title = {{The case for 4-bit precision: k-bit Inference Scaling Laws}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=BM2JsvBRWSh_},
}
Figure