Quantization & Model Compression

FP8, INT8, INT4, and FP4 quantization. Post-training quantization (PTQ) vs quantization-aware training (QAT). GPTQ, AWQ, SmoothQuant, and the NVIDIA Transformer Engine.

Overview

Quantization lowers the numerical precision of model weights (and optionally activations) from 32-bit or 16-bit floating point to fewer bits. It saves memory, bandwidth and compute; the risk is quantization error that compounds through the layers and costs accuracy.

Start from a trained model in FP32 or BF16 and quantize its weights, and optionally its activations. Three gains follow. The model takes less memory, 2x less at INT8 and 4x less at INT4. Decode, which is memory-bound, reads fewer bytes per weight. And the math can run on faster low-precision tensor cores. The price is the quantization error, which compounds through the layers.

Data types

Each format splits its bits between exponent (range) and mantissa (precision), and that split decides where it is used.

  • FP32 (8 exponent bits, 23 mantissa bits) is standard full precision. It holds optimizer states and loss scaling and is not used for inference.
  • BF16 (8, 7) keeps FP32's dynamic range with lower precision than FP16, so it is robust to overflow. H100 tensor cores run it at 1979 TFLOPS, NVIDIA's figure with 2:4 sparsity (about 989 dense). It is the standard precision for LLM training and inference.
  • FP16 (5, 10) has more precision than BF16 but a narrower range (max ~65504), so training needs loss scaling. Older models use it.
  • FP8 e4m3 (4, 3) is computed by Hopper at 2x BF16 throughput. It carries weights and activations in the forward pass and is the production standard for H100 inference in 2025-2026.
  • FP8 e5m2 (5, 2) has a wider range and is used for gradients.
  • INT8 is an 8-bit signed integer that needs a per-tensor or per-channel scale. It serves W8A16 or W8A8, and SmoothQuant is the standard W8A8 technique.
  • INT4 / FP4 are 4-bit formats, and Blackwell runs FP4 at 2x INT8 throughput. They are used weight-only, as W4A16 with FP16 activations, and GPTQ and AWQ are the standard PTQ algorithms for them.

Interview questions

  • Compare GPTQ and AWQ for deploying a LLaMA-3 70B model in INT4. Which would you choose and why?

Sign up free to read the full topic

More AI Infrastructure topics

Start free on Cariara · Coding problems · System design studio