Skip to main content

Quantization concepts and selection

Quantization stores weights (and sometimes activations) in lower precision to cut memory and often improve throughput β€” with quality trade-offs.

Adapted for this playbook from the πŸ€— Transformers documentation by Hugging Face. Official page: https://huggingface.co/docs/transformers/quantization/overview. Images Β© Hugging Face (documentation-images) unless noted. This is not a substitute for the upstream docs β€” verify against the current version.

Covers Hugging Face pages: quantization/overview, quantization/selecting, quantization/concept_guide

Quantization visual overview β€” Source: Hugging Face

Source: Hugging Face Transformers documentation.

Mental model​

IdeaMeaning
Weight-onlyWeights low-bit; activations higher precision
PTQQuantize after training
QATTrain aware of quantization
CalibrationRepresentative data to set scales
PackingDense storage of low-bit weights

Weight packing illustration β€” Source: Hugging Face

Source: Hugging Face Transformers documentation.

Dequantization path illustration β€” Source: Hugging Face

Source: Hugging Face Transformers documentation.

Official: Overview, Selecting a method, Concept guide.

FP8 illustration β€” Source: Hugging Face

Source: Hugging Face Transformers documentation.

Discussion

Comments​

Share feedback or questions about this page. No account required.

Loading comments…