fp16/bf16 – explained simply
fp16 and bf16 are two 16-bit number formats that models are often stored in; both need 2 bytes per parameter.
Also: fp16, bf16, bfloat16, float16, Half precision
Both formats use 16 bits, but split them differently. fp16 has 5 bits for the exponent and 10 for the decimal places, so it is more precise but covers a smaller range of numbers. bf16 has 8 exponent bits like the 32-bit format and only 7 decimal bits: large value range, lower precision.
In practice, this is not just theory. The diffusers documentation for FLUX points out that results in fp16 differ from bf16 because some values are clipped in the T5 text encoder. Many current models are released in bf16.
Older graphics cards sometimes do not support bf16 efficiently; in that case, switch to fp16 or fp32.
What does that mean for you? Use the format recommended in the Model Card; if your VRAM is tight, choose the fp8 or a quantized variant.
Related terms
Errors where that matters
- expected scalar type Half but found Float (number formats do not match)
- faster-whisper: Requested float16 compute type, but the target device or backend do not support efficient float16 computation (rechen format doesn't match the device)
- vLLM: Bfloat16 is only supported on GPUs with compute capability of at least 8.0 (graphics card too old for BF16)