Computer Arithmetic
When training neural networks in FP16 (half precision: 1 sign, 5 exponent, 10 significand bits), which problem tends to arise and is countered by scaling up the loss (loss scaling)?
- AThe significand is too long, increasing memory usage
- BThe range is narrow, so small gradients become zero
- CValues are treated as integers, so fractions cannot be represented
Show answer and explanation
Answer: B. The range is narrow, so small gradients become zero
With only 5 exponent bits, FP16 represents positive values from about 6 × 10⁻⁸ (including subnormals) to 65504, a narrow range. Many gradients computed during training are very small and underflow to zero in FP16, stalling learning. Loss scaling multiplies the loss by, say, 1024 before backpropagation, lifting gradients into the representable range, and undoes the scaling before updating weights. The significand is 10 bits, shorter than FP32's, and fractions are representable.
- A. The significand is shorter than FP32's, halving memory use.
- B. Correct. Its narrow range makes small gradients vanish.
- C. FP16 is a floating-point format and represents fractions.