Mixed Precision Training: fp16 Loss Scaling Versus bf16
Last updated: November 29, 2026
Quick Overview
Explain why training large models in fp16 needs loss scaling while bf16 usually does not, why an fp32 master copy of the weights is still kept, and how you would debug a run where loss becomes NaN after switching precision.
OpenAI
November 29, 20260
0
0 solved
Explain why training large models in fp16 needs loss scaling while bf16 usually does not, why an fp32 master copy of the weights is still kept, and how you would debug a run where loss becomes NaN after switching precision.
Every large training and fine-tuning job at OpenAI runs in reduced precision for speed and memory, and precision bugs are a frequent source of silent degradation or divergence. Interviewers want exact reasoning about exponent and mantissa bits, not memorized rules.
What the Interviewer Expects
- States the bit layouts and what range versus precision each gives
- Explains gradient underflow in fp16 and how loss scaling fixes it
- Explains why small updates vanish without fp32 master weights
- Knows which operations are kept in fp32 such as reductions and softmax
- Gives a concrete NaN debugging procedure
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
- How does dynamic loss scaling decide when to raise or lower the scale?
- What changes with fp8 training?
- Why is the optimizer state usually kept in fp32?
- How do you tell whether a NaN came from the forward pass or the backward pass?
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
fp32: 8 exponent bits, 23 mantissa bits. fp16: 5 exponent, 10 mantissa; max about 65,504, smallest normal about . bf16: 8 exponent, 7 mantissa; same range as fp32 (up to about $3.4...
Approach
fp16 problem: range. Many gradients in large networks are around to , below fp16's normal range, so they flush to zero or lose precision as subnormals. Loss scaling multiplies t...