The Maths You Actually NeedLesson 68 of 76

Module 8 · Numbers inside a machine

bf16, fp16, and why training keeps a float32 copy

In this lesson

  • 9 min read
  • 8 reading sections
  • Knowledge check
  • Lesson 2 of 10 in this chapter

This chapter’s goalPredict from the bit layout of float32, fp16 and bf16 which computation will overflow, underflow or lose its digits, explain why a long sum drifts and how to fix it, quantise a weight to int8 by hand and say what an outlier does to the rest of the tensor, derive the initialisation scale that keeps variance constant through a layer, and diagnose a NaN in training back to the operation that produced it.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
Sixteen bits, spent two waysfp16: 5 exponent bits, 10 mantissa bitsLargest value 65,504Smallest normal value 0.00006About three decimal digitsA logit of 12 already overflows expTraining survives only with dynamic lossscalingbf16: 8 exponent bits, 7 mantissa bitsLargest value 3.4 followed by 38 zerosExactly float32’s rangeAbout two decimal digitsConverting from float32 is a truncationThe default for training wherever hardwareallowsA weight update does not need many digits; it needs to be representable at all, which is why rangebeat precision. It is also why the optimiser keeps a float32 master copy: near 1 the gap between bf16numbers is 0.0078, so an update of 0.0001 added there vanishes entirely.
A weight update does not need many digits; it needs to be representable at all, which is why range beat precision. It is also why the optimiser keeps a float32 master copy: near 1 the gap between bf16 numbers is 0.0078, so an update of 0.0001 added there vanishes entirely.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 9Free · no account needed
Lesson steps

Two ways to spend sixteen bits

Halve the width of a float and you must give up either range or precision. The two sixteen-bit formats make opposite choices.

Text
format   sign  exponent  mantissa   max value   epsilon    digits
fp16      1       5        10        65,504     9.8e-4     ~3
bf16      1       8         7       3.4e38      7.8e-3     ~2
float32   1       8        23       3.4e38      1.2e-7     ~7

fp16 keeps ten bits of mantissa, three decimal digits, and spends only five on the exponent. Its largest value is 65,504 and its smallest normal value is 6 × 10^-5. bf16, “brain float”, keeps float32’s eight exponent bits and therefore its whole range, and pays with a seven-bit mantissa: two and a bit decimal digits. A bf16 number is a float32 with its bottom sixteen bits cut off, which makes conversion a truncation rather than a computation.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Stuck on something?Ask Funke, your AI tutor

How to cite: Addaly (2026) ‘bf16, fp16, and why training keeps a float32 copy’, in The Maths You Actually Need. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/maths-you-need/half-precision-and-mixed-precision (Accessed: 29 November 2026).