In October 2022, two research labs unveiled a technique that quantized massive 175-billion-parameter models down to just 4 bits per weight in under four hours, with almost no loss in accuracy. This method, known as GPTQ (Generative Pre-Trained Transformer Quantization), has since become the benchmark for all subsequent quantization research.
Why Round-to-Nearest (RTN) Fell Short
Standard rounding methods discarded valuable information, causing significant quality degradation at low bit widths. GPTQ solves this by preserving the rounding error and compensating for it across the model.
The Core Idea: Don't Drop the Rounding Error
Instead of simply rounding each weight independently, GPTQ adjusts the remaining weights to counteract the error introduced by rounding each weight. This is achieved by leveraging second-order information (the Hessian matrix) to minimize the overall impact on the model's output.
From OBS to OBQ to GPTQ
The lineage of GPTQ traces back to Optimal Brain Surgeon (OBS) from 1993, which used Hessian-based pruning. OBQ (Optimal Brain Quantization) adapted this idea for quantization. GPTQ made it practical with three key engineering tricks:
- Lazy batch updates – postponing updates to reduce computational overhead.
- Cholesky decomposition – efficiently solving the update equations.
- Precomputed Hessian – reusing Hessian information across layers.
Calibration Data Matters
GPTQ requires a small calibration dataset (typically 128 samples) to compute the Hessian. The choice of calibration data can impact the final quantization quality, but the method is robust across diverse datasets.
Running GPTQ on Qwen 2.5 7B
Even on consumer hardware like an RTX 3060, GPTQ can quantize a 7-billion-parameter model in under an hour, resulting in a 4-bit model that runs efficiently with minimal memory footprint.
With GPTQ, large language models become accessible on edge devices, democratizing AI deployment without sacrificing performance.