179 questions
No questions match those filters.
← All questions
Training & Fine-tuningMedium· Numerical Stability· Floating Point Precision
Why does training with FP16 sometimes produce NaN value...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansFP16 has a 5-bit exponent capping representable values at 65504. Attention logits, activation values, or gradient products can exceed this threshold, overflowing to infinity, which converts to NaN in subsequent operations. BF16’s 8-bit exponent matches FP32’s dynamic range, eliminating this overflow path. The loss in mantissa precision (7 bits vs. 23) is negligible for per-layer computation.