← Contents Volume VIII · Lecture 18

Volume VIII · The Precision of Memory

18

The Four-Bit Era

In August 2025 OpenAI released a model with 116.8 billion parameters and said it fits on a single 80 GB accelerator. Multiply that out at BF16 and the weights alone come to 233.6 GB, nearly three cards' worth. The model did not get smaller. Each of its numbers did, down to four bits plus a share of a scale.

The mental model

Four bits cannot hold a number. They can hold a position on a grid of sixteen codes whose spacing someone else has already chosen. Every 4-bit format is that alphabet plus a scale shared by a block of neighbours, and the craft of the era is making the weights fit the alphabet — either by rounding them afterwards or by training them to live there.

Sixteen codes

The 4-bit float used in these formats is E2M1: one sign bit, two exponent bits, one mantissa bit. Lecture 17's decoding rule gives it exactly eight magnitudes — 0, 0.5, 1, 1.5, 2, 3, 4 and 6 — and their negatives. That is sixteen codes but fifteen values, since plus and minus zero coincide. There is no infinity and no NaN. Its entire reach is a ratio of 12 between the smallest and largest nonzero magnitude, against the roughly 218 that E4M3 had and the 2261 of BF16.

A weight matrix does not live inside a ratio of 12. Its entries span orders of magnitude, and a bare E2M1 tensor would clip the large ones or flush the small ones to zero — the outlier problem of Lecture 17, at the extreme. So no 4-bit format is used bare. Each pairs the 4-bit element with a scale, and the scale carries the range.

FP4 · E2M1 · NON-NEGATIVE HALF, THE NEGATIVE HALF MIRRORS IT 0 0.5 1 1.5 2 3 4 6 steps of 0.5 steps of 1 steps of 2 INT4 · SAME REACH, EVENLY SPACED · UNITS OF THE SCALE 0 1 2 3 4 5 6 7
Figure 18a Two ways to spend sixteen codes. The float's grid is dense near zero and sparse near its limit, so relative error stays roughly level. The integer grid is uniform: the same absolute error everywhere, which is cheap and works when a block's values are spread evenly. Either way the scale decides what a step is worth.

A scale for every block

Lecture 17 ended on DeepSeek-V3 putting one scale on each 1 × 128 tile, in software. Micro-scaling writes that idea into the number format. A block of adjacent values shares one scale, stored beside the block, and the block size is small enough that a single outlier spoils few neighbours. The 2023 paper that named the idea paired a per-block scale with narrow float and integer elements, and an industry consortium standardised it as the OCP Microscaling Formats specification: MXFP8, MXFP6, MXFP4 and MXINT8.

MXFP4 takes a block of 32 E2M1 elements and gives them one 8-bit scale, E8M0 — eight exponent bits and no mantissa, so the scale is always a power of two. The cost is 8 bits of scale over 32 elements, a quarter of a bit per value: 4 + 8/32 = 4.25 bits per value. That is exactly the figure OpenAI gave for gpt-oss.

NVFP4, NVIDIA's variant for Blackwell, makes two changes. The block shrinks to 16 elements, so the scale tracks local magnitude twice as closely. And the scale becomes an FP8 E4M3 value, which can take fractional steps instead of only powers of two. Because E4M3 reaches no further than 448, a second scale, one FP32 number per tensor, keeps the block scales inside the range E4M3 can encode. The cost is 4 + 8/16 = 4.5 bits per value plus one FP32 per tensor. NVIDIA's estimate is a memory footprint about 3.5 times smaller than FP16 and about 1.8 times smaller than FP8.

MXFP4 · 32 ELEMENTS SHARE ONE E8M0 SCALE E8M0 32 × 4 + 8 = 136 bits, which is 4.25 bits per value NVFP4 · 16 ELEMENTS PER E4M3 SCALE, PLUS ONE FP32 PER TENSOR E4M3 E4M3 FP32 per tensor (16 × 4 + 8) / 16 = 4.5 bits per value, plus one FP32 per tensor
Figure 18b The block layouts, with the scale cost stated under each. Halving the block and swapping a power-of-two scale for a fractional one costs a quarter of a bit per value, which buys finer tracking of local magnitude.
Reading a block xi ≈ qi × sblock  (× stensor in NVFP4)
qi ∈ {0, ±0.5, ±1, ±1.5, ±2, ±3, ±4, ±6}  ·  bits per value = 4 + scale bits / block size

Why the scale format matters

The difference between a power-of-two scale and a fractional one is easiest to see by doing the arithmetic once. Take a toy block of four values — 0.9, −0.35, 0.02 and 2.4 — and quantize it two ways. The numbers below are illustrative, not a benchmark; a real block holds 16 or 32 values.

One toy block, two scale formats
SchemeBlock scaleE2M1 codesReconstructedWorst error
NVFP4-style (E4M3 scale)0.406252, −1, 0, 60.8125, −0.40625, 0, 2.43750.0875, on the 0.9
MXFP4-style (E8M0 scale)0.52, −0.5, 0, 41.0, −0.25, 0, 2.00.4, on the 2.4

The NVFP4-style scale aims the block maximum at 6: 2.4 / 6 = 0.4, which E4M3 stores as 0.40625. The MXFP4-style scale must be a power of two. Under the OCP reference rule it is the exponent of the block maximum minus the element's own largest exponent, here 21−2 = 0.5, which puts the maximum at 4.8 and rounds it down to 4. The largest value in the block, the one that matters most, loses 17%. A scale that can only double or halve leaves the block maximum sitting wherever the powers of two happen to put it. NVIDIA's own account of NVFP4 makes the same argument, with an example of its own, and that is the reason it pays the extra scale bits.

NVIDIA's pretraining paper adds three more devices to stop 4-bit training from diverging: a random Hadamard transform applied to bound the outliers inside a block, stochastic rounding on gradients so that rounding errors average out instead of accumulating, and a short list of layers left in higher precision. Using those, the authors trained a 12-billion- parameter model on 10 trillion tokens in NVFP4 and report training loss and downstream accuracy comparable to an FP8 baseline. They describe it as the longest publicly documented 4-bit training run to date.

Round it afterwards, or learn it

A 4-bit grid raises a second question: when do the weights meet it? There are two answers, and the choice between them is what separates the shipped models of 2025.

Post-training quantization (PTQ) takes a finished model and rounds it. A calibration set of text is run through the network to pick scales, and the better methods choose which weights to protect. GPTQ rounds layer by layer using approximate second-order information, and quantized a 175-billion-parameter model to 3 or 4 bits in about four GPU hours. AWQ observes that roughly 1% of weights are salient — identifiable from activation statistics rather than weight magnitude — and scales those channels up before rounding. PTQ is cheap, needs no gradients and cannot repair damage: whatever the rounding does to the model is what you ship. For weights alone, GPTQ and AWQ report that 4 bits holds up well on the models they test. Push further — fewer bits, or activations quantized as well as weights — and the 2023 LLM-QAT study reports that post-training methods break down.

Quantization-aware training (QAT) puts the rounding inside the training loop. The forward pass runs on quantized weights, so the loss includes the rounding error. The backward pass cannot differentiate through a rounding — its derivative is zero almost everywhere — so it uses the straight-through estimator and passes the gradient across as though the rounding were the identity. The optimizer keeps a high-precision copy of each weight, updates that, and re-quantizes on the next step. At the end the 4-bit copy is exported. The weights have spent their last training steps learning positions on the grid where the loss is lowest.

FORWARD · THE LOSS SEES ONLY THE 4-BIT WEIGHTS latent w BF16 / FP32 round to grid scale · clip · snap layer · loss uses w_q, not w gradient passes straight through the rounding the optimizer updates the latent weights, never the 4-bit copy
Figure 18c One QAT step. The forward path is honest about the grid, so the loss reflects rounding error. The backward path pretends the rounding is not there, which is wrong in the small and works in the large — the estimator is a 2013 trick for exactly this problem.
Fake quantization with a straight-through gradient wq = s · clip( round( w / s ), −qmax, +qmax )
∂wq / ∂w ≈ 1  inside the clip range · 0 outside it

The scheme's roots are older than language models. A 2018 paper co-designed integer-only inference with a training procedure that preserved accuracy after quantization, for mobile vision networks. LLM-QAT carried it to language models in 2023, with a twist forced by the absence of the original training data: it trains the quantized model on text generated by the full-precision one, quantizing weights, activations and the KV cache, on LLaMA models from 7B to 30B down to 4 bits.

Who ships four bits, and how

By the end of 2025 four different routes to a 4-bit model had public evidence behind them. The interesting column in the table below is the third. Four of the five rows decide the precision during training or post-training, whatever the format. The fifth rounds a finished model, and is the contrast.

Four-bit models, and where the four bits enter
Model / workFormatWhere it entersNote
gpt-oss-120b / 20b (OpenAI, 2025)MXFP4, MoE weightsApplied during post-training4.25 bits per parameter; the card does not say whether the method was PTQ or QAT
Kimi K2 Thinking (Moonshot, 2025)INT4, weight-only, MoE componentsQAT during post-training1T total, 32B active; card reports all benchmarks at INT4 and roughly 2× generation speed
NVIDIA's NVFP4 pretraining runNVFP4From the first training step12B parameters, 10T tokens; loss and accuracy comparable to an FP8 baseline
Nemotron 3 Super / Ultra (NVIDIA, 2025)NVFP4TrainingReport states both were trained with NVFP4; this site's appendix records Ultra (550B) as the first 4-bit pretrain at that scale unconfirmed
DeepSeek-R1-0528 (via NVIDIA tooling)NVFP4PTQ, FP8 → NVFP4NVIDIA reports 1% or less loss on key language tasks vendor-reported

Kimi's choice of INT4 over a 4-bit float is worth a line. An integer grid is uniform and needs no exponent hardware, and with weight-only quantization the activations stay at 16 bits: the kernel unpacks the 4-bit weights to a wider format, multiplies, and gets its saving from memory traffic. The model card does not state a group size, which is the integer analogue of the block size and the main knob. A 4-bit float with block scales, run on tensor cores that multiply it natively, gets the saving from arithmetic as well. Native FP4 matrix instructions arrived with NVIDIA's Blackwell generation.

How a 120B model fits on one card

Take the gpt-oss-120b figures from the model card: 116.8 billion parameters in total, about 5.1 billion active per token, with the mixture-of-experts layers accounting for more than 90% of the parameters. Quantize the experts to MXFP4 at 4.25 bits and the weights follow straight from the multiplication.

116.8B parameters, by storage format (80 GB read as 80 GiB, as Plate 17.1 does)
FormatBits per parameterWeights80 GiB cards
BF1616217.6 GiB2.7
FP8, element bits only8108.8 GiB1.4
NVFP4, all parameters4.561.2 GiB0.8
MXFP4, all parameters4.2557.8 GiB0.7
gpt-oss-120b, reported checkpointmixed60.8 GiB0.8

The reported checkpoint, 60.8 GiB, sits a little above the all-MXFP4 floor because the parameters outside the expert layers stay wider. The experts carry nearly everything, and quantizing nearly everything is enough. That leaves roughly 19 GiB on the card for the KV cache, activations and runtime — a ceiling rather than a budget, since the KV cache of Lectures 2 to 4 is still stored in 16-bit values unless it is quantized too. Four-bit weights shrink the model and leave the context exactly the size it was.

Plate 18.1 The same plate, pointed at this lecture's number. Set the model size to 117 and step through the formats: BF16 reads about 2.7 cards, FP8 about 1.4, and FP4 about 0.7 — the arithmetic behind a single-card 120B model. The plate counts the 4 element bits alone; the shared scales of § 18.2 add the quarter or half bit per value that Figure 18b spells out.

Memory capacity is half the benefit. At small batch sizes, decoding is bound by how fast the active weights stream out of memory, because each generated token reads them once. For this model that is about 5.1 billion parameters per token: roughly 10 GB at BF16, and at most around 2.7 GB at 4.25 bits, if every active parameter were stored that narrowly. The real figure is somewhat higher, since attention and other unquantized parameters are wider, but the direction is a cut of nearly fourfold in the bytes moved per token. Sparsity reduces how many parameters are read and the narrow format reduces what each one costs to read, so the two savings multiply.

What stays wide, again

Across both lectures the shape of the answer holds. The large matrix multiplications go narrow, with a scale for every small group. Accumulators, master weights, normalization, embeddings, the gating of a mixture of experts and the cache that stores context stay wide, because they are small or fragile or both. Four bits did not abolish the higher-precision parts of a model. It made the boundary between the two explicit, and something to be chosen.

Volume IX turns from what a weight is made of to how it gets taught: how a run is kept stable over trillions of tokens, and the optimizer that did it for one trillion-parameter model.

Read the primary source

❦