bf16 in one picture: 8 bits of mantissa, round-to-nearest-even, and what it hides A developer measured bfloat16's limits on PyTorch 2.10, showing that adding 1.0 to a bf16 counter a thousand times yields exactly 256 and that summing 4,096 random values between 0 and 1 in bf16 gives 256 versus an exact total near 2,020. The experiments trace the failures to bf16's 8-bit mantissa and round-to-nearest-even behavior, and conclude that bf16 should be used for storage while reductions accumulate in fp32. Add 1.0 to a bfloat16 counter a thousand times. The answer is 256. Not 1000, not "about 1000". Exactly 256. I ran it on my laptop PyTorch 2.10, CPU and the counter stops at 256 and never moves again. Then I summed 4,096 random numbers between 0 and 1. The true total is about 2,020. A bf16 accumulator says 256. bf16 is the default weight format for most open LLMs. Here is the whole format in one picture and a handful of measured experiments, so you know what it keeps, what it throws away, and where it bites. fp32: S EEEEEEEE MMMMMMMMMMMMMMMMMMMMMMM 1 + 8 + 23 bits bf16: S EEEEEEEE MMMMMMM 1 + 8 + 7 bits \ / bf16 = the top 16 bits of fp32, rounded bf16 keeps the sign and all 8 exponent bits of fp32 and only the top 7 stored mantissa bits. With the implicit leading 1, that is 8 significant bits. Converting fp32 to bf16 means dropping the low 16 bits, with rounding. You can see it in the hex: php 3.14159265 fp32 0x40490FDB bf16 0x4049 - 3.140625 0.1 fp32 0x3DCCCCCD bf16 0x3DCD - 0.10009765625 1/3 fp32 0x3EAAAAAB bf16 0x3EAB - 0.333984375 1000.0 fp32 0x447A0000 bf16 0x447A - 1000.0 The bf16 pattern is the first four hex digits of the fp32 pattern, sometimes plus one. That "plus one" is the rounding: 0x3DCCCCCD becomes 0x3DCD, not 0x3DCC, because the dropped half 0xCCCD is more than halfway. Between 1 and 2 there are exactly 128 bf16 values: 1.0, 1.0078125, ..., 1.9921875. I counted them by enumerating the bit patterns 0x3F80 to 0x3FFF. The gap between neighbours one "ulp" doubles at each power of two. Measured with torch.nextafter : So above 256, bf16 can't represent odd integers. Above 1024 it can only represent multiples of 8. That is where the counter result comes from. At 256 the next value up is 258. 256 + 1 = 257 lands exactly halfway between 256 and 258, and the tie goes to 256 more on why below . The counter is stuck. The uniform-sum result is the same effect, only worse. Every input is less than 1, which is less than half an ulp at 256, so every addition rounds back to 256. The fp32 accumulator, given the same bf16 inputs, gets 2020.6592 against an exact fp64 sum of 2020.6596. Lesson one: bf16 is a storage format, not an accumulation format. Every serious kernel multiplies bf16 inputs but accumulates in fp32. If you write your own reduction and leave the accumulator in the input dtype, you get 256. fp16 spends its bits the other way: 5 exponent bits, 10 mantissa bits. From torch.finfo : fp16 is 8 times more precise, but 70,000 in fp16 is inf . In bf16 it is 70144: wrong in the third digit, but finite. For training, where activations and gradients can swing over many orders of magnitude, overflow is the failure that kills a run, so the range wins. That is the whole reason bf16 exists: same range as fp32, half the bytes, and conversion is just "take the top half". The flip side shows up in the first experiment. fp16's largest value, 65504, is not representable in bf16 and becomes 65536. When the dropped bits are exactly half an ulp, IEEE rounding picks the neighbour whose last bit is 0 the "even" one . Converting the integers 250 to 265 to bf16: php 256 - 256 257 - 256 258 - 258 259 - 260 260 - 260 261 - 260 262 - 262 263 - 264 257 and 261 are ties and go down. 259 and 263 are ties and go up. Each one goes to whichever neighbour is "even" in the last mantissa bit. Near 1.0, same story: The last line matters. A tie is only a tie if every dropped bit after the first is zero. One bit set anywhere in the low 15 bits and the value rounds up. Why bother with "even" instead of always rounding ties up? Because ties then go up half the time and down half the time, so there is no systematic drift. I measured it on one million N 0,1 values, comparing proper rounding with plain truncation zeroing the low 16 bits, which some fast conversion code does : Truncation doubles the error. Worse, it is biased: every value moves toward zero, so the signed mean equals the absolute mean. Rounding's signed mean is essentially zero. The max relative error for rounding stays under 2^-8 = 0.0039, which is exactly the bound you expect from 8 significant bits. Two more numbers from the same run. 99.9986% of the values changed when converted almost no random fp32 number fits in 8 bits . And 49.98% of them came out differently under truncation and rounding, which is the coin flip you would expect: whenever the dropped half is at least halfway, rounding goes up and truncation doesn't. Here is the part that matters for LLM inference. A 4096-long dot product of N 0,1 vectors 4096 is a typical hidden size : Three observations. First, quantizing the inputs moved the answer by 0.056. That is the price of storing weights in bf16, and it is fixed: every engine that loads the same bf16 checkpoint pays exactly the same price. Second, the output rounding is coarse. Near 64, the bf16 ulp is 0.5, so everything from 64.75 to 65.25 comes out as 65.0. This is the "hiding" in the title. Two engines that sum the same products in different orders get fp32 results that differ in the last few bits, and most of the time both round to the same bf16 output. A spot check says "identical". Third, most of the time is not always . When the fp32 result sits near the midpoint between two bf16 values here, near 64.75 or 65.25 , a difference in the 20th bit flips the rounding and the outputs differ by a whole bf16 ulp. In a transformer that flip feeds the next layer, and a few dozen layers later it can be a different token. bf16 doesn't remove nondeterminism. It makes it rare, which makes it harder to catch. The whole post comes from one script, blog 03 script.py , about 80 lines and PyTorch only. The core of it: python import torch torch.manual seed 0 a bf16 counter acc = torch.tensor 0.0, dtype=torch.bfloat16 for i in range 1000 : acc = acc + torch.tensor 1.0, dtype=torch.bfloat16 print acc.item 256.0 round-to-nearest-even vs truncation x = torch.randn 1 000 000 rne = x.to torch.bfloat16 .float trunc = x.view torch.int32 & ~0xFFFF .view torch.float32 for name, y in "rne", rne , "trunc", trunc : rel = y - x / x print name, rel.abs .max .item , rel.abs .mean .item , rel.mean .item Seed 0, PyTorch 2.10 on a Windows laptop CPU. The bit-level results hex patterns, ulps, ties, the 256 counter are the same on any IEEE-conforming machine. The random-sample statistics depend on the seed, but not by much. I'm building Vahana, an open-source engine for exact MoE inference: github.com/vahana-ai/Vahana