Three main levers. Quantization stores weights and often activations at lower precision, typically int8 or 4 bit, cutting memory and speeding up memory bound inference at a small accuracy cost. Distillation trains a smaller student to match a large teacher's outputs. Pruning removes weights or whole structures. Quantization is usually first because it needs no retraining.
Why interviewers ask this
Serving cost is a real constraint on every ML team, and interviewers want to see a hierarchy rather than a single trick. The ordering matters: post training quantization first because it is cheap, then distillation if you can afford a training cycle, then structured pruning. Knowing that unstructured pruning rarely produces real speedups without hardware support is a strong discriminator.
How to structure your answer
- Name the three levers in one line each.
- Say which one you try first and why it is cheapest.
- Distinguish structured from unstructured pruning on real speedup.
- Anchor the decision in the latency or memory target you were given.
Example answer
I start by asking which constraint we are actually hitting, because memory, latency, and cost point at different fixes. Assuming it is all three, quantization is the first thing I try, since post training int8 needs no retraining, usually takes an afternoon, and on memory bound inference it often gives close to a linear speedup for a fraction of a point of accuracy. If int8 hurts too much I look at where: it is usually a handful of layers with wide activation ranges, so per channel scales or leaving those layers in higher precision recovers most of it. If quantization is not enough, distillation is next, training a smaller student on the teacher's soft outputs, which typically beats training that same small model from scratch on labels alone. That costs a full training cycle, so it is a bigger commitment. Pruning I use least, and I am careful to say structured, meaning whole heads or channels, because unstructured sparsity gives you a smaller checkpoint and almost no wall clock gain unless the hardware supports sparse kernels. And I measure end to end p99, not FLOPs, because on real serving stacks tokenization and data loading can dominate.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- What is the difference between post training quantization and quantization aware training?
- Why does distillation on soft targets beat training the small model directly?
- How would you decide the accuracy loss you are willing to accept?
Related machine learning engineer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions