Model Compression with Quantization
Quantization is one of the most important model compression techniques used to make neural networks smaller, faster, and more memory-efficient. It works by mapping continuous, high-precision numerical values (such as floating-point parameters) into a smaller, discrete set of lower-precision values.
The Core Concept: Lowering Bit Precision
When deep learning models (LLMs, CNNs, Diffusion Models, etc.) are trained, their weights and activations are typically stored in high-precision formats:
- FP32 (32-bit Floating Point) — Full single-precision. Highest accuracy, but expensive in memory and compute.
- FP16 / BF16 (16-bit Floating Point) — The standard mixed-precision formats used in modern training.
Quantization converts these values into lower-bit representations:
- INT8 (8-bit Integer) — Reduces memory footprint by 4× compared to FP32.
- INT4 / FP4 (4-bit) — Reduces memory by 8× compared to FP32. This is currently the sweet spot for running large language models on consumer GPUs, laptops, and edge devices.
- Extreme schemes (2-bit, 1.58-bit, ternary, binary) — Used in specialized research and hardware.
Why Quantization Matters
- Dramatically reduced memory footprint A 70-billion-parameter model in FP16 requires ~140 GB of VRAM just to load. Quantizing it to 4-bit (via GGUF, AWQ, etc.) brings the requirement down to roughly 35–40 GB, making it runnable on a single high-end consumer GPU.
- Faster inference Modern CPUs, GPUs, and NPUs execute integer arithmetic (especially INT8) significantly faster than 32-bit floating-point operations, increasing throughput and lowering latency.
- Lower power consumption and edge deployment Fewer bits mean less data movement between memory and compute units, which directly reduces energy use — critical for smartphones, IoT devices, and robotics.
Primary Approaches to Quantization
(will dive deep in later session).
- Post-Training Quantization (PTQ)
Takes a finished model and compresses it after the fact to smaller size.
- Dynamic Quantization: Weights are quantized offline; activation ranges are computed on-the-fly during inference.
Static Quantization: A calibration dataset is run through the model in advance to fix activation scales, enabling faster runtime.
Get Anandha L Ranganathan’s stories in your inbox
Join Medium for free to get updates from this writer.
Pros: Fast to apply, no need to retrain.
Cons: Can cause noticeable accuracy loss when pushing to very low bit-widths (especially INT4 and below).
2. Quantization-Aware Training (QAT)
Quantization is simulated during training or fine-tuning.
- The forward pass uses “fake quantization” so the model learns to compensate for the reduced precision.
- Gradients flow through the simulated quantization steps during backpropagation.
Pros: Maintains much higher accuracy even at 4-bit or 2-bit precision.
Cons: Requires more compute and access to training (or fine-tuning) data.
Here’s a clear breakdown of how model size (in parameters) translates into memory usage under different precisions.









