Medium6 min readUpdated 2026-08-12

What is model quantization and how does it reduce LLM cost?

Quantization stores model weights and activations in fewer bits, which shrinks memory and speeds up inference at some accuracy cost. Here is how it works, the main schemes, and what interviewers probe for.

A hand-drawn knowledge card showing 32-bit numbers being compressed into 4-bit numbers to save memory.
TL;DR
  • Model quantization compresses model numbers by mapping high precision weights and activations to lower precision, for example from 3232-bit floats to 88-bit integers.
  • That reduces memory, cache pressure, and bandwidth, giving lower inference cost and faster latency on many CPUs and specialized hardware.
  • You can use uniform, symmetric, per-channel and mixed precision schemes depending on accuracy needs and hardware support. Key tradeoffs: lower precision cuts cost and latency but can drop accuracy and require calibration or fine tuning.

In this question, we will learn what model quantization is and how it reduces LLM cost.

We will cover the following:

  • The intuition
  • How it actually works (with a worked example)
  • Common quantization schemes and a comparison
  • Practical tips for using quantization in LLMs
  • Tradeoffs and failure modes
  • Interviewer-style questions

Direct answer: Model quantization reduces LLM cost by replacing high precision numbers with lower precision representations so the model uses less memory, requires less bandwidth, and performs cheaper arithmetic. With careful choice of scheme and calibration you can often quantize to 88-bit or lower with small accuracy loss, cutting memory and often FLOPs-equivalent compute cost by multiple times.

The intuition (an analogy that makes it click)

Think of weights and activations as water stored in many glass bottles of different sizes and shapes. Floating point is like having custom bottles with fine graduations so you can measure precisely. Quantization is like standardizing to a set of small labeled jars. You lose some granularity, but you store more water in less space and pass jars faster through the door. For many tasks the lost granularity does not change the final mix much. We choose jar sizes and labels so the important differences remain visible.

How it actually works (the real mechanics, with one concrete worked example)

At the core quantization finds a mapping from full precision values xx to integers xqx_q using a scale ss and zero point zz. A common uniform affine mapping is:

xq=round ⁣(xs)+zx_q = \text{round}\!\left(\frac{x}{s}\right) + z

and we reconstruct (dequantize) as

xs(xqz).x \approx s\,(x_q - z).

Here ss is a positive real scale and zz is an integer zero point. Both are chosen to minimize quantization error over a calibration dataset or a tensor's range.

Worked example: quantize a small weight vector from 3232-bit float to 88-bit integer.

Original weights (float32):

IndexWeight
000.120.12
110.87-0.87
220.450.45
330.02-0.02

Find range: xmin=0.87x_\text{min} = -0.87, xmax=0.45x_\text{max} = 0.45. For unsigned 88-bit we often use symmetric mapping with zero point z=0z=0 and scale

s=max(xmin,xmax)2b11=0.871270.00685,s = \frac{\max(|x_\text{min}|,|x_\text{max}|)}{2^{b-1}-1} = \frac{0.87}{127} \approx 0.00685,

with b=8b = 8. Quantized integers:

IndexFloat xxQuantized xq=round(x/s)x_q = \text{round}(x/s)
000.120.12round(17.5)=18\text{round}(17.5) = 18
110.87-0.87round(127)=127\text{round}(-127) = -127
220.450.45round(65.7)=66\text{round}(65.7) = 66
330.02-0.02round(2.9)=3\text{round}(-2.9) = -3

Memory savings: original 44 weights at 3232-bit each use 4×32=1284 \times 32 = 128 bits. Quantized to 88-bit they use 4×8=324 \times 8 = 32 bits, a 32/8=432/8 = 4 times reduction. In large LLMs this scales to gigabytes saved.

Practical notes: you store the integer array plus per-tensor or per-channel scales and zero points. For inference you operate in integer or mixed integer-float arithmetic.

Types of quantization and a comparison

SchemeBitsProsCons
Uniform symmetric88, 44Simple, efficient on many HW, single scaleMay lose precision for skewed distributions
Uniform asymmetric (affine)88Handles nonzero-centered data with zero point zzSlightly more compute to add/subtract zz
Per-channel weight88Each output channel has its own scale, better accuracyMore parameters to store, slightly complex kernels
Mixed precision16/8/416/8/4Keeps sensitive tensors high precision, big savings elsewhereNeeds profiling to choose which tensors to lower

When quantizing LLMs we often use per-channel weight quantization and either symmetric or affine activation quantization. For very low-bit (44-bit or lower) we sometimes use mixed precision: keep layernorm and embedding layers at 1616-bit while quantizing matrix multiplications to lower bits.

Practical tips for LLMs

  • Calibrate activations with representative data to pick scales. A small holdout of tokens is often enough.
  • Start with per-channel weight 88-bit and affine activation 88-bit as a safe baseline. Measure perplexity or task accuracy.
  • If quality drops, try mixed precision: keep layernorm, softmax, and small matrices in 1616-bit.
  • Some hardware supports efficient integer GEMM for 88-bit and 44-bit. Test latency on your target hardware, not just theoretical FLOPs.

Tradeoffs and failure modes

Quantization reduces memory, memory bandwidth, and often energy. But it introduces rounding noise that can change model outputs, especially in deep networks with many matrix multiplies. Small models or sensitive layers can suffer noticeable accuracy loss when naively quantized.

Quantizing aggressively without calibration or selective preservation of sensitive tensors can break model stability. Watch for distribution shift in activations and validate on held out prompts before deploying.

Common failure modes:

  • Activation outliers cause scale choice to blow up error.
  • Layernorm and softmax are sensitive and may need higher precision.
  • Per-channel scales reduce error but complicate kernel implementations.

Questions the interviewer might ask

Some follow-up questions you might get: How does per-channel quantization help?
Per-channel uses a separate scale for each output channel so values with different dynamic ranges do not share one scale. That reduces quantization bias for heavy-tail or heterogeneous channels.

What is the difference between symmetric and affine quantization?
Symmetric sets zero point z=0z=0 and maps around zero. Affine allows a nonzero zz so the integer mapping can represent tensors whose range is not symmetric about zero.

When would you use 44-bit quantization versus 88-bit?
Use 44-bit when memory or throughput constraints are severe and you can tolerate more accuracy loss or apply fine tuning or quantization-aware training. Start with 88-bit for a safer tradeoff.

How do you handle activations at inference time?
You collect activation ranges via calibration, choose per-tensor scales, and either quantize activations on the fly or use mixed-precision kernels that keep activations in higher precision where needed.

Does quantization always reduce FLOPs?
Not necessarily. It reduces memory and can enable cheaper integer ops. But if hardware does not provide efficient low-bit matmul kernels you may still compute in float and only save memory, not FLOPs.

Some things to note:

  • Measure on target hardware for real latency and cost numbers.
  • Calibration data should be representative of inference inputs.

What the interviewer is really testing

They want to see that you understand both the math and the systems impact: how quantization maps values to integers, how scales and zero points matter, and how memory, bandwidth, and hardware support affect cost. They also want to hear about practical mitigations like per-channel scales, calibration, and mixed precision so you can deploy LLMs safely.

Further reading in the curriculum

Go deeper on the fundamentals behind this question.

  • Choosing the Right Model A practical framework for navigating the 2026 model landscape and picking the right model for your use case, budget, and latency requirements.
  • Inference Optimization How LLM serving works under the hood, and the techniques that make it fast, cheap, and scalable in production.

Related questions

#quantization#inference-optimization#llm#cost

How would you rate the quality of this article?

Prepare for your AI engineering interview

This is one of many detailed questions and explainers on StudyAIDesign. Browse the full set, work through the curriculum, and walk into your interview ready.

Follow along for new questions and explainers:Instagram