Skip to content
King Jin

4 July 2026

Floating-Point Precision in LLMs

When I started reading about LLM training and serving, I kept seeing FP32, FP16, BF16, FP8, INT4 and FP4 everywhere. At first I thought it was simple: more bits means better. It turns out that in LLMs the real trade-off is between range, precision, memory, speed and training stability. Today I want to figure out what each format is actually for.

Why it matters

LLMs are mostly huge matrix multiplications. The number format you choose changes:

  • whether training overflows or underflows
  • how much GPU memory the weights, activations, gradients and optimizer states take
  • how fast tensors move through memory bandwidth
  • how many users one GPU can serve
  • whether a quantized model still keeps its quality

This is why BF16 matters for training and INT4/FP4 matter for inference.

How a floating-point number is stored

A float is binary scientific notation:

(-1)^sign * 1.mantissa * 2^exponent

Each field has its own job:

FieldJob
Signpositive or negative
Exponenthow big or small the number can be (range)
Mantissahow finely you can tell nearby numbers apart (precision)

The common layouts:

FormatBitsSignExponentMantissaTrade-off
FP32321823stable, expensive
FP16161510more precision than BF16, much smaller range
BF1616187same range as FP32, less precision

The interesting part: FP16 has more mantissa than BF16, but BF16 keeps FP32's exponent. In training, range usually matters more than a few extra mantissa bits, because a value that overflows to infinity or underflows to zero can break the whole optimization.

Why BF16 works for training

Neural networks can live with some rounding noise. What they cannot live with is values silently blowing up or vanishing. BF16 halves memory compared with FP32 and still keeps the range that gradients and activations need. (BF16 means Brain Floating Point, from Google Brain. Nothing to do with biology.)

In practice nobody uses one format for everything. A real training stack is mixed precision:

  • BF16 for activations and matmul inputs
  • higher precision for the accumulation inside the kernels
  • FP32 for optimizer states and master weights

Why inference can go lower

Inference has no backward pass and no optimizer state, so we can push the weights down to 8 or 4 bits. For a 70B model, the raw weights alone take roughly:

PrecisionRaw weight memory
FP32280 GB
FP16 / BF16140 GB
FP8 / INT870 GB
FP4 / INT435 GB

These numbers are only the weights. Real serving also needs the KV cache, activations, scaling factors and runtime buffers.

INT4 vs FP4

INT4 uses evenly spaced integer levels plus a scale. FP4 uses floating-point style levels, so it can follow some value distributions more naturally. But "FP4" is not one single standard: the layout, block size, scaling rule and hardware support all change how it behaves.

Is FP4 training a thing?

Not in the "everything is FP4" sense. Four bits are too few for small gradients and small updates. Low-bit training systems keep higher precision somewhere: higher-precision accumulation, BF16 gradients, FP32 optimizer states, blockwise scaling, stochastic rounding or FP32 master weights.

Things I got confused about

  1. FP16 is not automatically better than BF16 just because it has more mantissa bits. Its smaller range makes training fragile.
  2. Memory tables for FP4/INT4 usually mean the raw weights only.
  3. "FP4 training" usually does not mean the whole pipeline runs in FP4.

A small exercise

Try converting 10.625 into binary, normalise it as 1.0101012×231.010101_2 \times 2^3, then write down its sign, biased exponent and mantissa in FP32 and FP16. After that it becomes obvious why BF16 keeps FP32's exponent but drops mantissa bits.

What I want to try next

  • Check the FP8 formats (E4M3 and E5M2) against hardware docs.
  • Run a tiny FP32 / FP16 / BF16 training comparison and record how stable the loss is.
OlderHow PyTorch Autograd Works →