Model compression: quantization-aware training, distillation and more
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI/ML design interview question asked in Waymo's technical phone screen, last asked Nov 2025. It tests quantization, distillation and inference optimization.
Explain four topics from training and deploying deep learning models: quantization-aware training, knowledge distillation, evaluation mode in deep learning frameworks, and contrastive learning. For each, cover what it is for, how it works, when it helps, common pitfalls, and how you would show it improved a production model.
Requirements
- Quantization-aware training (QAT): its goal compared with post-training quantization, and how it works during training.
- Knowledge distillation: what a student learns from a teacher, and the loss.
- Evaluation mode (
model.eval()in PyTorch): what it changes and what it doesn't. - Contrastive learning: what is learned and how the objective is built.
- For each: when it is useful, pitfalls, and how you would evaluate the result on a production model.
Clarifying questions
- What deployment target (mobile, onboard GPU, server) and what latency or memory budget?
- Which precision: int8 weights only, or weights and activations?
- Is a teacher model already available?
- Is labelled data scarce (which favours contrastive pre-training)?
What a strong answer covers
- QAT: fake-quantize weights and activations in the forward pass (quantize then dequantize) with a straight-through estimator for gradients, so the model learns to tolerate int8 rounding; better accuracy than post-training quantization at the cost of retraining. Pitfalls: calibration ranges, layers that should stay in higher precision, mismatch between simulated and real kernels.
- Distillation: train a smaller student on the teacher's softened outputs (temperature-scaled softmax, KL divergence) mixed with the true labels; intermediate-feature matching. Pitfalls: a capacity gap too big, a teacher's mistakes copied.
- Eval mode: dropout off, batch norm uses running statistics instead of batch statistics; it does not stop gradient tracking (that is
torch.no_grad()orinference_mode). Pitfall: forgetting it at inference, or evaluating with tiny batches in train mode. - Contrastive learning: pull positive pairs together and push negatives apart in embedding space (InfoNCE, as in SimCLR or CLIP); depends on augmentations, batch size or a negative queue, and temperature.
- Evaluation: accuracy on the task and on slices, latency and memory on the target hardware, calibration, and an online comparison before rollout.
Follow-ups
- Int8 quantization drops accuracy on one class badly. How do you find the cause?
- Combine distillation and quantization. In what order?
- Why might a model behave differently in eval mode with batch size 1?
- How do you choose negatives in contrastive learning, and what goes wrong with false negatives?
Where it's asked
- Waymo · Technical phone screen · Last asked Nov 202545 min · Coding: a classic algorithm problem or an original, under-specified problem framed around self-driving
What it tests
quantization · distillation · inference optimization
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
