Quantization
Quantization represents weights or activations using lower-precision formats. It can save memory and change speed, with quality and hardware-dependent trade-offs.
Before you start: Review KV cache first. Python-like examples use variables, lists and functions.
Follow the mechanism
Baseline
Measure full-precision quality and memory.
Start with an everyday explanation
A photograph can be stored with fewer color levels. The file becomes smaller, but details may change and the reader must support the format.
See a concrete example
Seven billion parameters require about 14 GB at 16 bits or 3.5 GB at 4 bits before scales, metadata and runtime allocations. These are decimal GB, not total GPU memory.
A claim to question
Four-bit weights do not guarantee a fourfold throughput or concurrency increase.
Try before revealing the answer
Use the GPU calculator to compare 16-bit and 4-bit weights while keeping a long-context cache fixed.
Show the worked answer
Only the modeled weight allocation shrinks. KV state and overhead remain unless independently changed; cache-heavy workloads may still exceed capacity.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
Distinguish weight-only, activation and KV-cache quantization. Scale factors, group metadata and runtime buffers add overhead beyond the nominal bit count.
Benchmark quality, latency and hardware kernel support. Reduced weight size does not guarantee proportional speedup or more users.
Reason through the example
Seven billion parameters require about 14 GB at 16 bits or 3.5 GB at 4 bits before scales, metadata and runtime allocations. These are decimal GB, not total GPU memory.
Implement and test
Use the GPU calculator to compare 16-bit and 4-bit weights while keeping a long-context cache fixed.
Inspect the reasoning and expected result
Only the modeled weight allocation shrinks. KV state and overhead remain unless independently changed; cache-heavy workloads may still exceed capacity.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
When would you quantize a model?
A defensible answer
When measured memory or serving constraints justify it and the quality drop is acceptable on representative tasks. Check hardware support, calibration data, total memory and latency rather than relying on nominal bits alone.
Prepare the follow-up
How would outlier values or a domain shift affect a quantized model?
Show follow-up reasoning
Lower precision can distort sensitive or outlier values, and calibration data may fail to represent the target workload. Compare representative slices and regression cases with the baseline. Hardware kernels, scales and metadata affect both memory and speed, so benchmark the actual serving stack.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define quantization with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…