Train With Mixed Precision Without Losing Gradient Information
Last updated: November 29, 2026
Quick Overview
Explain how mixed-precision training with fp16 or bf16 works, why loss scaling is needed for fp16, and what parts of training must stay in fp32.
Amazon
November 29, 20260
0
0 solved
Explain how mixed-precision training with fp16 or bf16 works, why loss scaling is needed for fp16, and what parts of training must stay in fp32.
Training on AWS GPUs and Trainium relies on reduced precision for throughput and memory. Senior MLE interviews test whether a candidate knows the number formats, where precision is lost, and how to debug silent divergence.
What the Interviewer Expects
- Compare fp32, fp16 and bf16 exponent and mantissa bits
- Explain master weights in fp32
- Explain gradient underflow and dynamic loss scaling
- List operations kept in fp32 (reductions, softmax, norms)
- Describe memory and throughput gains
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- Why does bf16 usually not need loss scaling?
- What happens to small weight updates if weights are stored in fp16 only?
- How would you detect that loss scaling keeps skipping steps?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Ask hardware (bf16 support), model size and whether training diverges or just underperforms. Formats: fp32 has 8 exponent and 23 mantissa bits; fp16 has 5 and 10 (max about 65,504, smallest normal abo...
Approach
Run forward and backward matmuls in 16-bit for speed, but keep an fp32 master copy of weights and do the optimizer update in fp32. With fp16, many gradients are smaller than its smallest subnormal (ab...