Why it matters

GPTQ is why INT4 LLMs work well. Understanding it explains the quality of community-quantized models on HF Hub.

Advertisement

The architecture

Calibration data: 128-1024 samples representative of target use.

Layer-by-layer: quantize each layer's weights sequentially. Use previous layers' output to compute next layer input.

GPTQ algorithmCalibration samples128-1024 examplesLayer-by-layersequentialMinimize errorOBS optimizationOBS (Optimal Brain Surgeon) heuristic guides quantization choices per layer
GPTQ steps.
Advertisement

How it works end to end

Optimization: for each weight matrix, find quantized version that minimizes output error on calibration data. Uses second-order information (approximate Hessian).

Trade-offs: small vs large group size (quality vs storage overhead).

Speed: quantization takes minutes to hours per model. One-time cost.

Alternatives: AWQ (activation-aware), SmoothQuant (activation redistribution).