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

Tim Dettmers, Luke Zettlemoyer

Abstract

Quantization methods reduce the number of bits required to represent each parameter in a model, trading accuracy for smaller memory footprints and inference latencies. However, the final model size depends on both the number of parameters of the original model and the rate of compression. In this work, we study this trade-off by developing inference scaling laws of zero-shot performance in Large Language Models (LLMs) to determine the bit-precision and model size that maximizes zero-shot performance. We run more than 35,000 experiments with 16-bit inputs and k-bit parameters across the LLM families BLOOM, OPT, NeoX/Pythia, and GPT-2. Overall, our findings show that 4-bit precision is almost universally optimal for total model bits and zero-shot accuracy.

Introduction

Large Language Models (LLMs) are notoriously resource-hungry, with models like GPT-3 (175B) requiring over 350 GB of GPU memory just for loading. Quantization—reducing the bit-precision of model parameters—is the standard approach to mitigate these costs. However, practitioners face a fundamental dilemma: given a fixed memory budget, is it better to deploy a smaller model at high precision (e.g., 16-bit) or a larger model at lower precision (e.g., 4-bit)? This paper establishes systematic "inference scaling laws" to answer this question across various model scales and families.

Methodology

The study encompasses over 35,000 experiments evaluating models from 19M to 176B parameters across four major families: OPT, BLOOM, Pythia, and GPT-2. The researchers tested bit-precisions ranging from 3-bit to 16-bit while maintaining 16-bit inputs. They explored various quantization techniques, including data type comparisons (Integers vs. Floats), block-wise quantization (e.g., size 64 or 128), and "Proxy Quantization" to protect outlier dimensions.

Performance was measured using zero-shot accuracy on datasets like LAMBADA, PiQA, HellaSwag, and Winogrande, as well as perplexity on the CommonCrawl subset of The Pile. A strong correlation (-0.94) was found between perplexity and zero-shot accuracy, validating its use as a performance proxy.

The 4-Bit Universal Optimum

The core finding is that 4-bit precision is the "Goldilocks" zone for LLM inference. Across nearly every model family and scale, a larger model compressed to 4 bits consistently outperforms a smaller model at higher precision when both occupy the same total number of bits.

Zero-shot accuracy vs. total model bits across different model families and bit-precisions. 4-bit (yellow) consistently provides the best accuracy for a given bit budget.

As shown in the figure above, the 4-bit scaling curves (yellow) generally sit above the 8-bit (green) and 16-bit (orange) curves. This indicates that for a fixed "bit budget" on the x-axis, the 4-bit configuration yields the highest mean zero-shot accuracy. In contrast, 3-bit precision (blue) often leads to a performance "cliff," where accuracy drops precipitously, especially in the OPT and Pythia families.

Key Insights

Small Blocks and Data Types

Reducing the quantization block size (e.g., to 64) adds a negligible memory overhead (approx. 0.25 bits/parameter) but significantly boosts accuracy, effectively providing a "free" gain in precision. Furthermore, at low precisions (4-bit and below), specialized data types like Float and Quantile quantization significantly outperform standard Integers. For 6-bit to 8-bit, the choice of data type matters less as precision is already sufficient.

Latency and Throughput

Reducing total model bits translates directly into inference speedups because LLM inference is typically memory-bandwidth bound. The study found that 3-bit kernels can achieve up to a 4.46x speedup over 16-bit implementations. However, in high-throughput scenarios with large batch sizes where computation becomes the bottleneck, these scaling laws may shift as the system becomes compute-bound rather than bandwidth-bound.

Conclusion

This work demonstrates that for maximizing zero-shot performance within a memory budget, the optimal strategy is to use the largest possible model that can be quantized to 4 bits. While 3-bit precision offers further memory savings, the resulting accuracy degradation usually makes it a sub-optimal choice compared to a slightly smaller 4-bit model. Future work may explore whether "one-shot" calibration methods like GPTQ can push this optimal point down to 3 bits, though such methods are computationally expensive to scale.

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