quantization

Quantization reduces neural network weight and activation precision from floating point (FP32/FP16) to lower bit widths (INT8, INT4), decreasing memory footprint and accelerating inference on supported hardware. Types: (1) post-training quantization (PTQ—quantize trained model with calibration data, no retraining), (2) quantization-aware training (QAT—simulate quantization during training, higher quality but requires training), (3) dynamic quantization (quantize weights statically, activations at runtime). Schemes: symmetric (zero-centered range), asymmetric (offset for skewed distributions), per-tensor vs. per-channel (finer granularity = better accuracy). INT8: 4× memory reduction, 2-4× inference speedup on CPUs (VNNI) and GPUs (INT8 tensor cores). INT4: 8× memory reduction, primarily for LLM weight compression (GPTQ, AWQ). Hardware support: NVIDIA tensor cores (INT8/INT4), Intel VNNI/AMX, ARM dot-product, and Qualcomm Hexagon. Frameworks: PyTorch quantization, TensorRT, ONNX Runtime, and llama.cpp. Trade-off: larger models tolerate aggressive quantization better (redundancy absorbs error). Standard optimization for production deployment.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account