What is bfloat16?
A 16-bit floating-point format with 1 sign, 8 exponent and 7 significand bits. Sharing FP32's exponent width gives it a wide range, so despite low precision it is used for AI training. FP16, with 5 exponent and 10 significand bits, is more precise but has a narrow range.
Field: Computer Arithmetic
Japanese name: bfloat16
What the bit layout implies
bfloat16 (brain floating point) is simply the upper 16 bits of an FP32 number: the same sign bit and 8-bit exponent, with the significand cut from 23 bits to 7. Converting from bfloat16 to FP32 is exact, done by appending 16 zero bits, and converting the other way only requires rounding off the low 16 bits. The range matches FP32, roughly 1e-38 to 3e38 for normal numbers, but with 8 significant bits including the hidden bit, values carry only about two to three decimal digits; the spacing just above 1.0 is 2 to the power -7, about 0.0078.
bfloat16 vs. FP16
FP16 spends its bits the other way, with a 5-bit exponent and a 10-bit significand. It is more precise, about three decimal digits, but its largest value is 65504 and its smallest normal value is about 6e-5. In training, small gradients can underflow to zero in FP16, so FP16 training usually needs loss scaling, multiplying the loss by a large factor and later dividing the gradients back. bfloat16's FP32-sized range generally makes that unnecessary and makes conversion from existing FP32 models straightforward, which is why it is popular for training.
Why master weights stay in FP32
Low precision fails when tiny updates are added to large values. With a weight of 1.0 stored in bfloat16, the next representable value is 1.0078125, so an update of 0.001 is less than half a step and the sum rounds back to exactly 1.0: the update is absorbed. Mixed-precision training therefore keeps master weights and optimizer state in FP32 and uses bfloat16 copies for the forward and backward passes. Matrix units likewise typically multiply bfloat16 inputs but accumulate the products in FP32, so long sums do not lose their small contributions.
Where you will meet it
bfloat16 is supported by the matrix units of many GPUs and AI accelerators, and by vector extensions on some CPUs, for both training and inference. Halving the size of each value relative to FP32 halves memory capacity and bandwidth needs and allows more multipliers per unit of chip area. It is not a good general-purpose format, though: with so few significand bits, sums of many values, small differences and anything needing more than a few digits of accuracy must be done in a wider type.
Try it: questions about bfloat16
- AIts exponent is 8 bits like FP32, so its range is wide
- BIts significand is longer than FP32's, so it is more precise
- CIt can be computed with integer arithmetic
Show answer and explanation
Answer: A. Its exponent is 8 bits like FP32, so its range is wide
bfloat16 is a 16-bit format with 1 sign, 8 exponent and 7 significand bits. Sharing FP32's exponent width gives nearly the same range, so very small or large values such as gradients during training rarely overflow or underflow, and converting FP32 models is easy. Precision is low, but training tolerates some error, and data size is halved while the arithmetic units become smaller. Its significand is shorter than FP32's, and it is computed with floating-point, not integer, arithmetic.
- AWhen small updates are added to weights, a low-precision format would lose them to absorption
- BFP32 computes faster than FP16, so all weight calculations are left to FP32
- CFP16 and bfloat16 values are not allowed to be stored in memory
Show answer and explanation
Answer: A. When small updates are added to weights, a low-precision format would lose them to absorption
Training repeatedly adds very small amounts, learning rate × gradient, to the weights. FP16 and bfloat16 have short significands, so if an update is too small relative to the weight, the rounded sum equals the old weight and the update vanishes (absorption). Weights are therefore kept in FP32 so updates accumulate correctly, while lower-precision copies are used for the forward and backward passes. On hardware that supports it, lower precision computes faster, and low-precision values can be stored in memory.
FAQ
Is bfloat16 the same as FP16?
No. Both are 16 bits, but bfloat16 has an 8-bit exponent and 7-bit significand, while FP16 has a 5-bit exponent and 10-bit significand. bfloat16 trades precision for FP32's range.
How do you convert FP32 to bfloat16?
Keep the top 16 bits of the FP32 bit pattern, ideally rounding to nearest even based on the discarded 16 bits rather than just truncating. Converting back is exact: append 16 zero bits.
Why does bfloat16 training usually not need loss scaling?
Loss scaling exists to keep small gradients from underflowing in FP16's narrow range. bfloat16 has the same exponent range as FP32, so such gradients normally remain representable.
Books on Computer Arithmetic Ad
As an Amazon Associate I earn from qualifying purchases.
Comparisons that include this term
Semiconductor, Electronics and Computing Calculators
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.
Back to the glossary