Pruning and Quantization
Pruning and quantization are the two core techniques of model compression. Their goal is to make a huge model smaller and faster while keeping accuracy, so it can run on phones, embedded devices, and edge servers.
Pruning: Removing Unimportant Connections
Deep learning models contain a large amount of redundant parameters. Research has found that removing 90% of the weights from a trained network barely dents accuracy. Pruning works by finding the "unimportant" parameters and deleting them.
Unstructured pruning simply zeroes out individual weights. The compression ratio is high, but the result is a sparse matrix that ordinary hardware cannot speed up. Structured pruning removes whole channels, filters, or layers. The compression ratio is lower, but the computation genuinely drops, which is why it dominates in engineering.
The typical loop is train, prune, fine-tune, repeating: prune once, fine-tune to recover accuracy if it dips, prune again. This is iterative pruning, and it works far better than pruning everything at once.
Quantization: Lowering Numerical Precision
Quantization converts FP32 weights (32 bits) into INT8 (8 bits) or even INT4 (4 bits). Storage drops by 75-87.5% directly, and integer arithmetic is much faster than floating point.
Post-training quantization (PTQ) quantizes a trained model directly and needs a calibration dataset to measure the range of activations. It is simple to implement and suits fast deployment.
Quantization-aware training (QAT) simulates quantization error during training so the model adapts to low precision. Results are better, but retraining is required.
In the large-model era, weight-only quantization (such as GPTQ and AWQ) goes further: compressing a 70B model to 4 bit drops memory demand from 140GB to 35GB, so consumer-grade GPUs can run large models. The price is a slight accuracy loss, usually mitigated by quantizing only the weights and keeping activations at high precision.
How to Choose
If the goal is less storage, quantization comes first: simple and reliable. If the goal is faster inference, you need structured pruning or hardware that accelerates sparsity. In practice the two are often combined: prune first, then quantize, reaching compression ratios above 10x.
Applications
On-device AI (face unlock, voice assistants), automotive chips for self-driving, smart cameras, and local deployment of large models (llama.cpp and Ollama rely heavily on quantization).