Unit 5 of 12 · about 4 hours · explain, measure

Post-training and quantization-aware methods, and quality checks by slice

A smaller model that fails the quality contract can never ship. Methods differ in what they cost to apply; checks differ in what they can catch.

You'll be able to

  • Contrast post-training quantization with quantization-aware training by data, pipeline access and accuracy cost.
  • Check a quantized model with perplexity, a task benchmark and a workload slice, and state what each check can hide.
  • Rank weights, activations, KV cache and attention by quantization sensitivity and defend a mixed-precision sketch.

Covers

Post-training and quantization-aware vocabularyPerplexity, task and slice quality checksMixed-precision layer sensitivity search
1

Read

In this order, only the parts listed

0 of 3 done

  1. Approaches and quality measurementInference Engineering - Section 5.1, Quantization

    Section 5.1.2, Quantization Approaches: PTQ versus QAT definitions, the two decisions (what parts, what format), and the least-to-most sensitivity ordering from weights to attention; Section 5.1.3, Measuring Quality Impact: perplexity, intelligence benchmarks and custom evals

  2. Accuracy trade-offs and evaluation toolingHands-On LLM Serving and Optimization - Quantization (Chapter 6) and Speculative Decoding (Chapter 7)

    Chapter 6: Accuracy trade-offs with the GPTQ, AWQ and FP8 minimal-loss results, Quantization-aware training versus PTQ with the comparison table, and the LM Eval code snippet for gsm8k_cot

    Treat the book accuracy figures as the authors result on their models, not as your expected result.

  3. Day 14: comparing GPTQ, AWQ and SmoothQuant100 Days of LLM Inference - Days 13, 14 and 15

    Notebook day14/quantization-gptq-awq-smoothquant.ipynb: Comparing Quantization Methods and Experiments: Try These, comparing output error of gptq_quantize_layer, awq_quantize and smoothquant_calibrate against naive round-to-nearest

2

Focus on

  • PTQ converts finished weights with calibration data only; QAT trains or fine-tunes with fake quantization so weights adapt to the rounding. PTQ is the only option for weights you did not train.
  • Perplexity is the cheapest check but the weakest: it scores likelihood on reference text, not task success. Add one task benchmark and one product slice before any ship claim.
  • Sensitivity runs weights, then activations, then KV cache, then attention with softmax last. Early and late layers often stay in high precision inside an otherwise quantized model.
  • GPTQ compensates rounding with Hessian structure, AWQ protects salient channels, SmoothQuant migrates outlier difficulty. All three report near-FP16 quality at W4A16 or W8A8 on the authors workloads; yours needs its own numbers.
Common mistakes · 3
  • Reporting pooled perplexity only. Averages hide slice regressions; long context, code and other languages can degrade while prose perplexity barely moves.
  • Quoting paper quality as your quality. Published minimal-loss results are the authors models on their evals; calibration and slice differences move them.
  • Treating QAT as strictly better. It costs pipeline access and retraining; for many deployments calibrated PTQ meets the bar and ships sooner.
3

Try it yourself

Closed-book, before checking anything

Without notes, define PTQ and QAT in one sentence each, list the three quality checks in cheap-to-expensive order, and sketch which of weights, activations, KV cache and attention you quantize first with one line of justification each.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.When is QAT unavailable no matter how attractive its accuracy looks?Answer

    When you hold only finished weights without training-pipeline access. PTQ with calibration is then the only route; QAT needs fake quantization during training or fine-tuning.

  2. 2.Quantized perplexity rises minimally but the product slice fails. What did the check miss?Answer

    Perplexity measures likelihood on reference sequences, not task behavior. The slice exercises distributions the reference set underweights; add task and slice evals.

  3. 3.Rank weights, activations, KV cache and attention by quantization sensitivity, least first.Answer

    Linear-layer weights, then activations, then KV cache, then attention with softmax. Errors in attention compound token to token, and KV errors persist across positions.

  4. 4.Why might input and output layers stay in high precision?Answer

    They are more sensitive than middle layers: the input layer shapes every downstream representation and the output layer directly sets token probabilities.

5

Practice

  • 100 Days of LLM Inference Day 14: method comparison

    Comparing Quantization Methods and Experiments: Try These: benchmark naive round-to-nearest against gptq_quantize_layer, awq_quantize and smoothquant_calibrate on one layer, reporting error per method

    Use a fixed held-out input batch for all four; the calibration inputs must not be the scoring inputs.

You're done when

You rank the four components by sensitivity without notes and can say for a stated workload which two quality checks gate the ship decision and why perplexity alone does not.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section
  • Hands-On LLM Serving and Optimization - Quantization (Chapter 6) and Speculative Decoding (Chapter 7)Chi Wang and Peiheng Hu (O'Reilly) · primary

    Read "Model Compression" in Chapter 6 for quantization and "Speculative Decoding" in Chapter 7, with its hands-on example. For each method write its correctness contract, the engine support it needs and a predicted winning and losing workload before running it.

  • 100 Days of LLM Inference - Days 13, 14 and 15Elizabeth Thomas · support

    Use the numeric-format, quantization-algorithm and speculative-decoding notebooks as compact preparation. Keep their synthetic demos separate from production-engine and hardware evidence.

  • Inference Engineering - Section 5.1, QuantizationPhilip Kiely (Baseten Books) · support

    Read 5.1.1 Number Formats for the format table and Precision/Type/Scale-factor with Dynamic range/Granularity, 5.1.2 for PTQ versus QAT and the what-to-quantize decisions, and 5.1.3 for the perplexity, benchmark and custom-eval quality checks.

Also in this section