bfloat16 is a 16-bit floating-point type designed for efficient computation on modern GPUs and TPUs. Compared with float16, it uses more exponent bits and fewer mantissa bits: the wider exponent gives greater numerical range, while the shorter mantissa gives lower resolution. section 18.3.2
Its layout determines the main practical difference from float16:
- bfloat16 uses 1 sign bit, 8 exponent bits, and 7 mantissa bits. section 18.3.2
- float16 uses 1 sign bit, 5 exponent bits, and 10 mantissa bits. section 18.3.2
- The extra exponent bits let bfloat16 represent a wider range of values, but its fewer mantissa bits reduce precision across that range. section 18.3.2
Choosing a reduced-precision format
When running inference on a newer GPU or TPU, try both float16 and bfloat16. Keep the option that delivers the better device-specific speed while providing an appropriate numerical range. section 18.3.2 section 16.4.1
Table 18.1 Difference between float16 and bfloat16
dtype
|
float16
|
bfloat16
|
|---|---|---|
|
Exponent bits
|
5
|
8
|
|
Mantissa bits
|
10
|
7
|
|
Sign bits
|
1
|
1
|
Compare the sign, exponent, and mantissa allocations for float16 and bfloat16. section 18.3.2


