What is AI 16-bit floating point (FP16)?
FP16 is the 16-bit half precision floating point format of the IEEE 754 standard, with 1 sign bit, 5 exponent bits and 10 fraction bits and a largest finite value of 65,504. In deep learning it halves memory and bandwidth against FP32.
Unlike Brain Floating Point 16, which trades precision to keep range, FP16 gives more bits to the fraction for finer precision but a narrow range: tiny gradients can underflow to zero and large values overflow. Training in FP16 therefore usually needs loss scaling.
- Topic
- Infrastructure and runtime
- Also known as
- Half precision, binary16, float16
- Origin
- IEEE 754-2008, binary16 format
How AI 16-bit floating point (FP16) works
- Weights, activations and gradients are stored in FP16 and matrix multiplications run in it.
- An FP32 master copy of weights receives each update and is rounded to FP16 for the next pass.
- The loss is multiplied by a factor so small gradients do not underflow, then divided back before the update.
- For inference, trained weights are converted to FP16 to save memory and gain speed.
In more detail
Dynamic loss scaling and numeric limits
IEEE 754 binary16 represents numbers down to 6.10 × 10^-5 as normal numbers and 5.96 × 10^-8 as subnormals, leaving any smaller gradient to underflow to zero. Dynamic loss scaling addresses this automatically by multiplying the loss by a large factor, checking gradients for overflow (Inf/NaN) before each optimiser step, halving the scale on overflow and gradually increasing it during stable steps.
The real memory budget in training and inference
While FP16 weights and activations cut inference memory in half, mixed-precision training with AdamW stores FP16 weights (2 bytes), FP16 gradients (2 bytes) and FP32 master weights plus first and second moments (12 bytes), totaling 16 bytes per parameter. Consequently, training memory savings come primarily from halving activation tensors and from FP16 Tensor Core throughput rather than parameter storage.
FP32 accumulation and its current place in LLM inference
FP16 relies on FP32 accumulation inside GPU Tensor Cores (FMA: FP16 × FP16 + FP32) to prevent rounding errors from compounding across large dot products. In modern LLM serving, FP16 remains widely used for model weights and KV caches on older architectures, though newer deployments increasingly pair FP16 compute with BF16 or FP8 to eliminate overflow risks in large activations.
Commonly confused terms
| Term | How it differs |
|---|---|
| TF32 | TF32 (TensorFloat-32) is an internal compute format on NVIDIA Ampere+ Tensor Cores that uses 19 bits (1 sign, 8 exponent, 10 mantissa) while storing tensors in 32-bit FP32, whereas FP16 is a 16-bit storage and compute format. |
| INT8 | FP16 is a floating-point format with exponent and fraction bits suited to wide dynamic ranges, whereas INT8 represents uniformly spaced 8-bit integers requiring affine quantisation scales and zero-points. |
Why AI 16-bit floating point (FP16) matters for on-premises AI
FP16 is an early, widely used way to speed up training and inference with GPUs' low-precision matrix units. The paper introducing mixed precision training showed that with an FP32 master copy and loss scaling the method works across convolutional, recurrent and generative networks, nearly halving memory use. Its limit is narrow range; BF16, with FP32's range, usually needs less tuning.
An automotive supplier converts its quality control line's vision model from FP32 to FP16 to run on its factory server; comparing accuracy before and after on the same test images and seeing no difference, it releases the model.
Common questions
How does FP16 differ from BF16?
FP16 gives 10 bits to the fraction and 5 to the exponent, more precise but narrow in range. BF16 gives 8 to the exponent, keeping FP32's range.
Why does FP16 training need loss scaling?
With its narrow range, tiny gradients can underflow to zero. Scaling up the loss preserves them.
Related terms
- AI brain floating point 16 (BF16)
- AI 8-bit floating point (FP8)
- Mixed precision training
- AI numerical precision
- AI quantisation
- AI graphics processing unit (GPU) memory
Sources
- IEEE, IEEE Standard for Floating-Point Arithmetic (IEEE 754-2019)
- Mixed Precision Training, 2017
- NVIDIA, Train With Mixed Precision
In the glossary: Glossary, A to D