AppliedAIPrep logoAppliedAI/Prep
ML Infrastructure & GPUs / 03
hard★ EssentialNVIDIAOpenAIxAI

Explain quantization for inference: INT8/INT4, GPTQ/AWQ, what breaks, and how you validate it.

Quantization is the first lever for fitting and speeding up models, and the interviewer wants more than 'use fewer bits.' The signal is knowing what precision buys you, why outliers break naive quantization, and how you prove quality held. Here is that answer.

Updated Aug 2026 · Grounded in real Applied AI Engineer interview loops and written to a senior-engineer editorial bar.

TL;DR: Quantization maps weights/activations from FP16 to lower-precision integers (INT8, INT4), shrinking memory and speeding memory-bound inference. Naive rounding fails because a few large-magnitude outliers blow up the scale; methods like GPTQ and AWQ handle this (error-compensated rounding, protecting salient weights). Weight-only quantization is safe and common; activation quantization is harder. Always validate on your eval set, not just perplexity.

QUANTIZATION (pick a precision)
65,536 levels
0.62
0.69
-0.63
-0.59
0.54
0.21
-0.65
0.13
0.89
-0.19
-0.90
0.18
0.62
-0.39
-0.34
0.75
0.31
-0.90
-0.33
0.75
0.09
-0.59
0.34
0.66
7B MODEL SIZE14.0 GB
AVG ERROR0.000
A 7B model's weights at FP16 take 14.0 GB with an average rounding error of 0.000. Drop the precision and the grid bands into fewer distinct values: memory falls fast while quality degrades slowly, until it does not.

How to approach it

State why you quantize (memory to fit, and bandwidth-bound decode speedups), then the central difficulty (dynamic range and outliers), then the methods and the validation step, because "did quality actually hold" is the real question. The candidates who pass name outliers as the failure mode and name a task eval, not perplexity, as the proof.

A strong answer

Why. Weights at FP16 are 2 bytes each; INT8 halves that, INT4 quarters it. Beyond fit, LLM decode is memory-bandwidth-bound (you stream weights per token), so reading fewer bytes per weight directly speeds generation. That is why a quantized 70B can serve on one GPU and run faster.

The hard part: dynamic range. Quantization maps a float range to a small integer grid via a scale. If a tensor has a few huge-magnitude outliers, the scale stretches to cover them and the many normal values collapse into a couple of buckets, destroying precision. Naive round-to-nearest at INT4 wrecks accuracy for exactly this reason.

Methods.

  • Weight-only PTQ (GPTQ, AWQ). GPTQ quantizes weights greedily while compensating for the error introduced, using second-order (Hessian) information; AWQ identifies and protects the salient weight channels that matter most for output. Both are post-training (no retraining), need only a small calibration set, and hold quality well at INT4 for many models.
  • Activation quantization (INT8 weights+activations, SmoothQuant) is harder because activation outliers are large and input-dependent; SmoothQuant shifts difficulty from activations into weights to make it tractable.
  • FP8 (on newer hardware) keeps floating-point dynamic range at 8 bits and is increasingly used for both training and inference.
  • QLoRA is the training-side cousin: fine-tune adapters on top of a 4-bit frozen base.
PrecisionQualityWhen to use
INT8 weight-onlyNear-lossless for most modelsSafe default for memory and speed
INT4 (AWQ/GPTQ)Small hit, usually fineFit a big model on one GPU, validated on tasks
INT8 weights+activationsTrickier, outlier-sensitiveOnly with SmoothQuant and measurement
Below INT4Degrades fastOnly with QAT

Validation. Perplexity alone is a weak proxy; run your task eval set (accuracy, exact-match, judge scores) and compare to the FP16 baseline. Quantization error is non-uniform across capabilities, so a model can hold perplexity yet regress on reasoning or code. Keep sensitive components (sometimes the embedding/output layers, or attention) at higher precision if needed. The defensible position: weight-only INT4 (AWQ/GPTQ) is a safe default for serving, validated on real tasks; push to activation or INT4-everything only with measurement.

Key takeaways

  • The failure mode is outliers stretching the scale, not "fewer bits" in the abstract; GPTQ/AWQ exist to fix it.
  • INT8 is near-lossless; INT4 weight-only is the workhorse serving default; below INT4 needs QAT.
  • Activation quantization is strictly harder than weight-only because activation outliers are input-dependent.
  • Validate on a task eval against the FP16 baseline, not perplexity alone, because errors hit capabilities unevenly.

What interviewers probe next

  • "Why does INT4 help latency, not just memory?" Decode is bandwidth-bound; fewer bytes per weight means less memory traffic per token.
  • "Per-tensor vs per-channel/group scales?" Finer-grained scales (per-channel, group-wise) handle varying ranges far better than one global scale, at a small overhead.
  • "QAT vs PTQ?" Quantization-aware training recovers more accuracy at very low bits but costs a training run; PTQ (GPTQ/AWQ) is cheaper and usually enough at INT8/INT4.
  • "How low can you go?" INT8 is nearly lossless for most models; INT4 is usually fine with good methods; below that quality degrades fast without QAT.

Common mistakes

  • "Just use fewer bits" with no mention of outliers or dynamic range, the thing that actually breaks.
  • Validating on perplexity only and missing task-specific regressions.
  • Treating activation quantization as easy as weight quantization.
  • Calibrating on unrepresentative data, so the scales are wrong for production inputs.
HOW DID IT GO?
0
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

No comments yet — be the first to share your approach.