Inferensys

Glossary

Quantization

A model optimization technique that reduces the numerical precision of weights and activations from high-precision floating-point to low-precision integers, dramatically decreasing memory bandwidth and energy consumption.
ML engineer working on model compression and quantization, laptop showing performance benchmarks, technical workspace.
MODEL OPTIMIZATION

What is Quantization?

A compression technique that reduces the numerical precision of a neural network's parameters to decrease its memory footprint and energy consumption.

Quantization is a model optimization technique that maps high-precision floating-point representations (typically FP32 or FP16) to low-precision integer formats (such as INT8 or INT4), dramatically reducing the memory bandwidth and computational resources required for inference. This process converts continuous weight and activation values into a discrete, finite set of levels, trading a small, controlled loss in numerical fidelity for substantial gains in hardware efficiency and deployment speed.

The primary mechanism involves defining a scaling factor and a zero-point to linearly map the floating-point range to the target integer range, a process known as affine quantization. Techniques like Post-Training Quantization (PTQ) apply this conversion after training without retraining, while Quantization-Aware Training (QAT) simulates the precision loss during the training loop, allowing the model to adapt and recover accuracy, making it essential for deploying large language models on edge devices and mobile processors.

PRECISION REDUCTION

Key Quantization Techniques

Quantization encompasses several distinct methodologies for reducing numerical precision, each offering different trade-offs between model accuracy, inference speed, and deployment complexity.

01

Post-Training Quantization (PTQ)

A one-shot compression technique applied after model training is complete. PTQ converts pre-trained 32-bit floating-point weights and activations directly to 8-bit integers using a small, unlabeled calibration dataset to determine optimal scaling factors.

  • No retraining required: Fastest path to deployment
  • Calibration dataset: Typically 100-1000 representative samples
  • Accuracy trade-off: May degrade performance on models sensitive to weight perturbation
  • Common formats: INT8, FP16, BF16

Frameworks like TensorRT and ONNX Runtime provide automated PTQ pipelines that complete in minutes.

4x
Typical Model Size Reduction
< 1%
Accuracy Loss (ResNet-50)
02

Quantization-Aware Training (QAT)

A technique that simulates quantization noise during the forward pass of training while maintaining full-precision weights for the backward pass. This allows the model to learn parameters that are inherently robust to the precision loss introduced by subsequent integer conversion.

  • Higher accuracy retention than PTQ for aggressive bit-widths
  • Straight-through estimator (STE): Approximates gradients through non-differentiable quantization nodes
  • Best for: INT4 and lower precision targets
  • Training overhead: 20-50% slower than standard training

QAT is the preferred method when deploying vision transformers or large language models at 4-bit precision.

INT4
Minimum Viable Precision
~1.5x
Training Time Overhead
03

Dynamic vs. Static Quantization

Two fundamental approaches to when scaling factors are computed:

Dynamic Quantization

  • Weights quantized ahead of time; activations quantized on-the-fly during inference
  • Lower latency reduction but simpler implementation
  • Ideal for LSTM and Transformer models where activation ranges vary per input

Static Quantization

  • Both weights and activations quantized offline using calibration data
  • Enables full integer arithmetic on CPU and edge accelerators
  • Requires representative calibration dataset

Static quantization achieves maximum throughput gains but demands more engineering effort.

2-3x
Static Quantization Speedup
1.5x
Dynamic Quantization Speedup
04

Granularity: Per-Tensor vs. Per-Channel

Quantization scaling factors can be applied at different levels of granularity, directly impacting accuracy preservation:

Per-Tensor Quantization

  • Single scale and zero-point for an entire weight tensor
  • Simplest implementation, fastest execution
  • Significant accuracy drop when weight distributions vary across channels

Per-Channel Quantization

  • Independent scale and zero-point for each output channel
  • Preserves accuracy by accommodating channel-wise variance
  • Standard for convolutional layers in production deployments

Per-Group Quantization (used in GPTQ, AWQ)

  • Divides channels into groups of 64-128 for finer granularity
  • Critical for 4-bit LLM compression without catastrophic accuracy loss
128
Typical Group Size (LLMs)
2-5%
Accuracy Gain (Per-Channel vs Per-Tensor)
05

Weight-Only vs. Weight-and-Activation Quantization

A strategic choice determining which tensors undergo precision reduction:

Weight-Only Quantization

  • Only model weights stored in low precision; activations remain FP16/BF16
  • Reduces memory footprint and bandwidth but compute still in higher precision
  • Dominant approach for LLM inference (GPTQ, AWQ, GGUF formats)
  • Enables running 70B parameter models on consumer GPUs

Weight-and-Activation Quantization

  • Both weights and activations reduced to INT8 or INT4
  • Enables full integer matrix multiplication on CPU and NPU
  • Required for maximum throughput on edge devices
  • More challenging to tune due to activation range sensitivity

Memory-bound workloads benefit most from weight-only; compute-bound workloads require full quantization.

70B
Max Parameters (Weight-Only, 24GB VRAM)
4x
Throughput Gain (Full Quantization)
06

LLM-Specific Quantization: GPTQ & AWQ

Specialized algorithms designed for the extreme compression of large language models to 4-bit and 3-bit precision:

GPTQ (Post-Training Quantization for GPTs)

  • One-shot weight quantization using approximate second-order information
  • Processes weights column-by-column, compensating for quantization error in remaining weights
  • Requires ~100 samples for calibration; completes in hours on a single GPU

AWQ (Activation-Aware Weight Quantization)

  • Identifies salient weight channels based on activation magnitudes
  • Applies per-channel scaling to protect critical weights before quantization
  • Outperforms GPTQ on instruction-tuned models

Both methods enable serving 13B+ parameter models on edge hardware with minimal perplexity degradation.

4-bit
Standard Precision Target
< 0.5
Perplexity Increase (LLaMA-2 70B)
QUANTIZATION EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about model quantization, its mechanisms, and its role in sustainable AI deployment.

Quantization is a model optimization technique that reduces the numerical precision of a neural network's weights and activations from high-precision floating-point representations (typically 32-bit) to low-precision integer formats (such as 8-bit or 4-bit). This process maps continuous floating-point values to a discrete set of integer levels, dramatically decreasing the model's memory footprint, memory bandwidth requirements, and energy consumption per inference. The core mechanism involves defining a scaling factor and a zero-point to linearly map the original range of float values to the target integer range. For example, converting a FP32 tensor to INT8 reduces the storage requirement by a factor of four, enabling deployment on resource-constrained edge devices and reducing operational carbon emissions in data centers.

MODEL COMPRESSION TECHNIQUES

Quantization vs. Other Compression Methods

Comparison of quantization against alternative methods for reducing model size, memory bandwidth, and inference energy consumption.

FeatureQuantizationPruningDistillationLow-Rank Factorization

Primary Mechanism

Reduces numerical precision of weights/activations

Removes redundant weights or neurons

Trains smaller student model from larger teacher

Decomposes weight matrices into lower-rank approximations

Model Size Reduction

2-4x

1.5-10x

5-50x

1.5-3x

Inference Speedup

2-4x

1-2x

5-100x

1-2x

Requires Retraining

Preserves Original Architecture

Hardware Compatibility

Requires INT8/FP16 support

Standard hardware

Standard hardware

Standard hardware

Energy Reduction per Inference

2-4x

1-2x

5-100x

1-2x

Accuracy Impact

0.1-1%

0.5-5%

1-5%

0.5-3%

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.