Sam Babichenko

Reading notes / Low-precision training

End-to-end 4-bit training

Cook et al., 2026

A linear layer
xxlayer input, TT tokens by KK features
wwweight, NN outputs by KK inputs
yylayer output xqwq⊤x_q w_q^\top
xq,x_q, wqw_qNVFP4 encodings used in the forward pass
gggradient ∂L/∂y\partial L/\partial y of the loss LL, T×NT\times N
Number formats
viv_ia high-precision value before encoding
qiq_iits 4-bit E2M1 code, in {0,±0.5,…,±6}\{0,\pm0.5,\dots,\pm6\}
sks_kE4M3 scale of block kk (16 values)
α\alphaFP32 outer scale (per token or per expert here)
v^i\hat v_idecoded value qiskαq_i s_k\alpha
RN\mathrm{RN}round to nearest in a given format
QQstochastic rounding onto a grid
a<ba\lt badjacent grid points around a value uu
Communication
C,C, BBpeak compute (FLOPs/s), bandwidth (bytes/s)
Vcomp,V_{\rm comp}, VcommV_{\rm comm}FLOPs computed and bytes sent per token
vv32 consecutive output values, rotated as a unit
HH32×3232\times32 Hadamard matrix scaled to be orthogonal, entries hij/32h_{ij}/\sqrt{32}
DDdiagonal matrix of random signs εj\varepsilon_j
zzrotated values HDvHDv; z^\hat z after encoding and decoding
MMsize of an outlier among the 32
Post's symbols
xiFP4,x^{\rm FP4}_i, xi//16FP8,x^{\rm FP8}_{i//16}, xFP32x^{\rm FP32}what the post writes for qiq_i, sks_k, α\alpha
dx,dx, dwdwwhat the post writes for ∂L/∂x\partial L/\partial x, ∂L/∂w\partial L/\partial w

Context. Matrix multiplications in fewer bits run faster. A 4-bit NVFP4 general matrix multiplication, the product of two matrices; GEMMs account for most of the compute of training a transformer peaks at 15 PFLOPS on NVIDIA's GB300 GPU, compared with 5 in the 8-bit format MXFP8 and 2.5 in bfloat16: a 16-bit floating-point format with 8 exponent bits and 7 mantissa bits, the default for large-model training. Fewer bits bring heavy rounding error. A 4-bit number holds only 15 distinct values, so each entry can shift by a large fraction of itself at every layer and step. Thinking Machines (Cook et al., 2026) trained Inkling 2 Small, a MoE: a model whose feed-forward layers hold many expert networks, of which a learned router sends each token to a few; most of the parameters sit in the experts language model, using 4-bit matrix multiplications from the start of pretraining through the final RL rollout. Their post explains the numerics.

The recipe puts 4 bits in the forward pass of the expert layers, where speed pays off most and rounding error is manageable. The backward pass runs in an 8-bit microscaling format: 8-bit floating-point values (E4M3, with 4 exponent bits and 3 mantissa bits, or E5M2) with one power-of-two scale per 32 values, 8.25 bits per value in all on tensors that match the forward tensors in expectation rather than bit for bit. Transposing a tensor for the backward pass regroups its scaling blocks. To keep fine 16-value blocks in the forward pass, the recipe decodes each 4-bit tensor, transposes it in higher precision, and re-encodes it in MXFP8 using unbiased rounding a value to one of its two neighbors on the grid at random, the nearer one more often, with probabilities chosen so that the expected result equals the value. Once matrix multiplications speed up, inter-GPU traffic becomes the bottleneck. A 4-bit dispatch and an 8-bit combine after a random Hadamard rotation cut that traffic down. On the authors' largest jobs, this setup trains 8% faster in pretraining and 20% faster in RL than full MXFP8, while pretraining pays about a 2% cost in the FLOPs a baseline would need to reach the same loss, as a fraction of the FLOPs used: a 2% cost means the MXFP8 model reaches this loss with about 2% fewer FLOPs. The same numerics run across pretraining, fine-tuning, and the RL sampler, so the model ships in its training precision without a calibration step.

Four bits go in the forward pass of the expert layers. In the authors' experience, expert layers are computationally expensive and tolerate quantization better than other layers. Running them fully in MXFP8 barely changed compute efficiency, while running them fully in NVFP4 cost more than the authors would accept. Between the two passes, putting 4 bits in the forward pass gave the better speed-accuracy tradeoff. Forward rounding error becomes part of the function being trained, so the loss sees it and the weights adapt. Backward weight gradients act differently. Summing over a batch averages out zero-mean rounding noise, while any directional bias compounds across layers, samples, and steps.

In RL, the 4-bit forward pass also drives the sampler. Generating tens of thousands of tokens per rollout requires reading every weight from memory on each token. Weights roughly half the size of 8-bit ones speed up every token, and the trainer evaluates the same function as the sampler. Composer 2 (Cursor, 2026) uses the same NVFP4 forward and MXFP8 backward split in its expert layers so its RL trainer matches its 4-bit sampler.

NVFP4 stores 4-bit values with one 8-bit scale per 16 values and a 32-bit outer scale. A 4-bit a 4-bit floating-point number with 1 sign bit, 2 exponent bits and 1 mantissa bit number holds a sign bit and a magnitude∣q∣∈{0,0.5,1,1.5,2,3,4,6},|q|\in\{0,0.5,1,1.5,2,3,4,6\},so values past 6 need scaling. NVFP4 splits each row of a tensor into 16-value blocks. Each block kk carries one an 8-bit floating-point format with 4 exponent bits and 3 mantissa bits; its positive values run from 2−92^{-9} to 448 scale the 8-bit E4M3 scale of block kk, shared by its 16 values, while one 32-bit a single FP32 number α\alpha that multiplies a large group of values, such as a whole tensor, a token's activations or an expert's weights, and shifts the range that the block scales can reach α\alpha is shared across a whole tensor, token, or expert. Entry ii of block kk decodes asv^i=qi sk α.\hat v_i=q_i\,s_k\,\alpha.The encoder sets sks_k so the block's largest magnitude lands at 6, then rounds both the scale and the scaled values:sk=RNE4M3(max⁡j∈k∣vj∣6α),qi=RNFP4(visk α).\begin{aligned}s_k&=\mathrm{RN}_{\rm E4M3}\Big(\frac{\max_{j\in k}|v_j|}{6\alpha}\Big),\\ q_i&=\mathrm{RN}_{\rm FP4}\Big(\frac{v_i}{s_k\,\alpha}\Big).\end{aligned}Here a high-precision value before encoding; j∈kj\in k runs over the 16 values of its block kk is the input value and round to nearest: RNF(u)\mathrm{RN}_{\rm F}(u) is the value of format F closest to uu rounds to the nearest value in the format. At α=1\alpha=1, a block whose largest value is −54-54 gets sk=9s_k=9 and stores −54-54 exactly as −6-6. Rounding the scale itself adds error. A peak of 593.7 asks for 98.95, snaps to the nearest E4M3 value 96, and decodes as 96×6=57696\times6=576. At α=1\alpha=1, reachable magnitudes span 2−102^{-10} to 6×448=26886\times448=2688, and α\alpha shifts that window. Storage comes to 4+8/16=4.54+8/16=4.5 bits per value, against 8+8/32=8.258+8/32=8.25 for MXFP8.

Sharing a block scale makes small entries vulnerable to outliers. Halfway between 0 and 0.5 is 0.25, so an entry rounds to zero whenever ∣vi∣<0.25 skα|v_i|\lt 0.25\,s_k\alpha. Because skα≈max⁡j∈k∣vj∣/6s_k\alpha\approx\max_{j\in k}|v_j|/6, any value below about 1/241/24 of its block's largest magnitude is erased. One large entry in a 16-value block wipes out its small neighbors.

The backward pass needs the same tensors blocked along the other dimension. Take a linear layer with input the input of a linear layer: TT tokens by KK features (TT tokens by KK features) and weight the weight of the linear layer: NN output features by KK input features (NN outputs by KK inputs). Write the NVFP4-encoded input and weight used in the forward pass (decoded values v^i\hat v_i in each entry) for their NVFP4 encodings, and the gradient of the loss LL with respect to the layer's output yy, a T×NT\times N matrix that arrives from the layer above for the gradient of the loss LL arriving at the output. A training step runs three matrix products:y=xq wq⊤,∂L/∂x=g wq,∂L/∂w=g⊤xq.\begin{aligned}y&=x_q\,w_q^\top,\\ \partial L/\partial x&=g\,w_q,\\ \partial L/\partial w&=g^\top x_q.\end{aligned}The the GPU units that execute block-scaled matrix multiplications; they require both operands to be blocked along the dimension that the product sums over require both operands to be blocked along the summed dimension. The forward pass yy sums over the KK input features, so xx and ww use row blocks. The input gradient ∂L/∂x\partial L/\partial x sums over the NN outputs and needs ww blocked down its columns. The weight gradient ∂L/∂w\partial L/\partial w sums over the TT tokens and needs xx blocked across 16 tokens. Regrouping gives each value 15 new neighbors and a new scale, so it can round differently. When it does, the backward pass differentiates a function the forward pass never computed. In the post's example, a 16 by 16 tile with one row of large values keeps all 256 entries under row blocks. Under column blocks, every block gets a large entry, and the 1/241/24 rule zeroes 221 of the 256 values.

NVIDIA's NVFP4 recipe (NVIDIA, 2025) eliminates the weight mismatch by assigning one scale to each 16 by 16 tile, so the encoding is identical in both orientations. DeepSeek-V3 used the same idea for FP8 weights with square 128 by 128 blocks. A tile has 256 members, so a single outlier sets the scale of all of them. In the post's tile with one outlier, row blocks keep 241 of 256 values, while the square tile keeps only the outlier. The authors found that tile scales cost more compute efficiency than they would accept.

Re-encoding with stochastic rounding gives the backward pass the forward tensors in expectation. Square tiles force forward and backward weights to match bit for bit. The backward pass only needs unbiased copies that match in expectation. The recipe decodes xqx_q and wqw_q exactly into higher precision, transposes them, and re-encodes them in MXFP8 with stochastic rounding. For a value uu between adjacent grid points a<ba\lt b,Q(u)={bwith prob. u−ab−a,aotherwise,E Q(u)=a+(b−a) u−ab−a=u.\begin{aligned}Q(u)&=\begin{cases}b&\text{with prob. }\frac{u-a}{b-a},\\ a&\text{otherwise,}\end{cases}\\ \mathbb E\,Q(u)&=a+(b-a)\,\tfrac{u-a}{b-a}=u.\end{aligned}In the post's example, 5.4 sits in a block of scale 9, encodes as 5.4/9=0.65.4/9=0.6, rounds to 0.5, and enters the forward pass as 4.5. After transposing into a block of scale 2, the value 4.5/2=2.254.5/2=2.25 must be re-encoded. Round to nearest always gives 2, which decodes to 4. Stochastic rounding picks 3 a quarter of the time and 2 otherwise, giving expectation 2 (0.75⋅2+0.25⋅3)=4.52\,(0.75\cdot2+0.25\cdot3)=4.5. That example uses the FP4 grid for illustration, while the recipe re-encodes onto MXFP8's finer grid.

The arriving BF16 gradient gg also gets encoded in MXFP8 with stochastic rounding in both orientations. Each backward product rounds its two operands independently, so the expected product is unbiased:E[Q(g) Q(wq)]=g wq,\mathbb E\big[Q(g)\,Q(w_q)\big]=g\,w_q,and the same holds for g⊤xqg^\top x_q. Following TetraJet-v2 (Chen et al., 2026) and Quartet II (Panferov et al., 2026), the recipe re-encodes the decoded 4-bit tensors rather than the original BF16 ones. The chain rule calls for the values xqx_q and wqw_q that the forward pass actually used. Decoding first also separates backward precision from the forward format, and MXFP8 GEMMs gave the authors the best accuracy-speed tradeoff. They eliminate the underflow problem. With E4M3 elements, the usual MXFP8 choice, a value rounds to zero only when it is more than 100,000 times smaller than its block's largest (computed here from the format).

Faster expert GEMMs make inter-GPU traffic the bottleneck. Under splitting a mixture-of-experts layer's experts across GPUs: each token is sent to the GPUs holding its chosen experts (dispatch), and their outputs are sent back and summed with the router's weights (combine), each GPU holds a subset of experts. Tokens travel out to their routed experts (dispatch), and expert outputs return to be summed (combine). Within a GB300 NVL72 rack, NVIDIA's direct GPU-to-GPU interconnect; within a GB300 NVL72 rack it carries 900 GB/s per GPU in each direction delivers 900 GB/s per GPU in each direction while NVFP4 GEMMs peak at 15 PFLOPS, or about 16,700 floating-point operations per arriving byte. DeepSeek-V4 (DeepSeek-AI, 2026) writes the condition for hiding communication behind compute asCB≤VcompVcomm.\frac{C}{B}\le\frac{V_{\rm comp}}{V_{\rm comm}}.Here peak compute throughput of a GPU, in FLOPs per second is peak compute, interconnect bandwidth, in bytes per second is interconnect bandwidth, and VcompV_{\rm comp} and VcommV_{\rm comm} are the FLOPs computed and bytes sent per token. Moving from MXFP8 to NVFP4 triples CC at fixed BB. In the authors' runs, expert GEMMs stalled waiting for dispatched tokens, or the next layer, a short convolution in Inkling 2 Small, stalled waiting for combined ones. Dispatch drops cleanly to NVFP4 at 4.5 bits per value. The receiver needs no high-precision copy because the backward pass uses xqx_q. Combine stayed in 16-bit BF16, making up 16 of the 20.5 round-trip bits per value, or 78% (computed here).

A random Hadamard rotation lets the combine travel in 8 bits. Sending combine outputs directly in MXFP8 hurt accuracy too much, which the authors attribute to outliers. Instead, the recipe rotates each block of 32 consecutive output values vv before encoding the rotated vector zz:z=HDv,HH⊤=I.z=HDv,\qquad HH^\top=I.Here the 32×3232\times32 Hadamard matrix scaled by 1/321/\sqrt{32}: entries hij/32h_{ij}/\sqrt{32} with hij=±1h_{ij}=\pm1, and orthogonal rows is the 32×3232\times32 orthogonal Hadamard matrix with entries hij/32h_{ij}/\sqrt{32} (hij=±1h_{ij}=\pm1), and a diagonal matrix of independent random signs εj=±1\varepsilon_j=\pm1 is a diagonal matrix of random signs εj\varepsilon_j. The rotated vector is encoded in block-scaled an 8-bit fixed-point format: a signed 8-bit integer mm read as m/64m/64, so 256 evenly spaced values from −2-2 to 127/64127/64; used here with one scale per 32 values, an 8-bit fixed-point format with one scale per 32 values. Because HDHD is orthogonal, it preserves the norm, ∥z∥2=∥v∥2\|z\|_2=\|v\|_2. Its equal-magnitude entries and random signs spread energy evenly across coordinates:zi=132∑jhij εjvj,E zi2=132∥v∥22.\begin{aligned}z_i&=\tfrac{1}{\sqrt{32}}\textstyle\sum_j h_{ij}\,\varepsilon_j v_j,\\ \mathbb E\,z_i^2&=\tfrac{1}{32}\|v\|_2^2.\end{aligned}An outlier of magnitude the magnitude of a single outlier among the 32 values adds only ±M/32\pm M/\sqrt{32} to each coordinate, cutting the block's largest value from about MM to a small multiple of its root mean square.

On a uniform grid with round to nearest, each coordinate's error is at most half the grid step, and the step scales with the block's largest value. Let z^\hat z be the encoded-and-decoded rotated block. Because the inverse rotation (HD)⊤(HD)^\top is orthogonal, it preserves the error norm:∥v−(HD)⊤z^∥2=∥(HD)⊤(z−z^)∥2=∥z−z^∥2.\begin{aligned}&\|v-(HD)^\top\hat z\|_2\\&\quad=\|(HD)^\top(z-\hat z)\|_2\\&\quad=\|z-\hat z\|_2.\end{aligned}Rounding error therefore falls in proportion to the block's peak. Take 31 values of standard deviation 10 and one of 300. Under power-of-two scales and round to nearest, the rotation lowers the largest value from 300 to about 75 and cuts the error about fourfold (computed here). Rotated blocks have few outliers, so they suit S2F6's uniform grid, matching prior work where integer grids beat floating-point ones on rotated data. Blackwell GPUs convert block-scaled S2F6 in single instructions, and the rotation and encoding fuse into the expert's second GEMM. The receiver decodes and sums incoming vectors, then inverts the rotation once, which is exact by linearity. Combine traffic drops from 16 to 8.25 bits per value, cutting the round trip from 20.5 to 12.75 bits (38% less, computed here) with no measured loss in training accuracy. DeepSeek-V4-style wave scheduling overlaps each wave's GEMMs with the next wave's dispatch and the previous wave's combine. In the post's figure, the smaller combine shortens the tail of combine traffic left over after the final wave.

The remaining choices draw on published NVFP4 recipes. The final sixth of the layers stays in MXFP8, echoing NVIDIA's recommendation of about 15% higher-precision layers on a scaling ladder whose depth grows in multiples of 6. Activations use 4/6 (Cook et al., 2025): each NVFP4 block is encoded twice, with its largest value mapped to 6 and to 4, and the version with the smaller error is kept (Cook et al., 2025). Because the FP4 grid has no point between 4 and 6, mapping a block's peak to 6 rounds values between two-thirds of the peak and the peak itself coarsely. Four Over Six also tries mapping the peak to 4 and keeps whichever encoding has smaller error. On [10,20,30,40][10,20,30,40], mapping 40 to 6 gives E4M3 scale 6.5 and sends 30 to 4.62→44.62\to4, a 13% error. Mapping 40 to 4 sends 30 to 3 exactly. Weights skip 4/6. The post gives no reason, though the 4/6 paper's pretraining ablations found activations-only comparable to all-tensors at lower overhead.

Following Composer 2, the NVFP4 outer scales are per expert for weights and per token for activations. A per-tensor activation scale makes each token's encoding depend on other tokens in the batch, while a per-sequence scale lets later tokens alter earlier ones. Per-token scaling avoids both. Deterministic in-house kernels keep the tensor cores fed across arithmetic-heavy steps such as scale computation, re-encoding, and stochastic rounding, for instance by fusing the Hadamard rotation and S2F6 encoding into the second GEMM.

What it bought. On Inkling 2 Small, the recipe ran unchanged through pretraining, supervised fine-tuning, and RL, with no discernible difference in RL reward. If the 2% pretraining compute-efficiency cost and the 8% wall-clock speedup on the largest jobs held on the same run, reaching a fixed loss would take about 1.02/1.08≈0.941.02/1.08\approx0.94 of MXFP8's time (computed here). Inkling 2 Small was pretrained in 68 hours on GB300 NVL72 racks, a runtime the authors credit to many stack-wide changes alongside the numerics. Inkling 2 Mini (26.4B parameters, 3.4B active), released afterward, followed the same recipe and ships in its training precision. Its release specifies NVFP4 "in the expert layers on all forward passes from pretraining through RL" with the final 4 of 24 layers in MXFP8. The checkpoint's quantization config lists NVFP4 for expert weights in layers 0 to 19, MXFP8 in layers 20 to 23, and BF16 for attention, convolutions, router weights, and embeddings. That release reports strong benchmark scores, with no higher-precision twin to compare against.

Evidence and limits. The recipe rests on one production model family trained end to end, including what the authors call the largest model they know of trained with a native 4-bit forward pass. Internal comparisons backed each design choice. The authors tried and rejected tile scales and an MXFP8 combine for their cost in compute efficiency or accuracy, while the rotated 8-bit combine showed no measurable loss. The building blocks also draw on published recipes with fuller evaluations. NVIDIA trained a 12B model on 10 trillion tokens mostly in NVFP4 (forward and backward), reaching 62.58% on MMLU-Pro against 62.62% in FP8. Even so, the post reports quality only as the 2% pretraining compute-efficiency cost and no discernible difference in RL reward. It gives no loss curves, benchmark tables, ablation numbers, or size for Inkling 2 Small. Nor does it separate how much of the 8% pretraining and 20% RL speedups comes from 4-bit GEMMs, quantized communication, or custom kernels.

Terms

NVFP4
E2M1 values, an E4M3 scale per 16, an FP32 outer scale: v^i=qiskα\hat v_i=q_i s_k\alpha, 4.5 bits per value
MXFP8
8-bit float values (E4M3 or E5M2) with a power-of-two E8M0 scale per 32: 8.25 bits per value
Underflow rule
in NVFP4 a value below about 1/241/24 of its block's largest rounds to zero
Transpose problem
backward GEMMs need blocks along the other dimension, so each value gets new neighbors and a new scale
16 by 16 tiles
NVIDIA's transpose-proof weight scales; too coarse here, since one outlier sets 256 values' scale
Stochastic rounding
round up with probability (u−a)/(b−a)(u-a)/(b-a); E Q(u)=u\mathbb E\,Q(u)=u
Re-quantization
decode the forward's 4-bit tensor, transpose, re-encode in MXFP8 with stochastic rounding
RHT + S2F6 combine
rotate 32 values by HDHD, encode in 8-bit fixed point; 16 to 8.25 bits per value
Four Over Six
encode each block with its largest value at 6 and at 4, keep the smaller error; activations only
Outer scales
per token for activations, per expert for weights: batch-invariant, no leak from later tokens
Result
about 2% compute-efficiency cost in pretraining; on the largest jobs 8% faster pretraining, 20% faster RL than full MXFP8

Sources

Connected notes

  • Dividing the numerator of softmax attention by its L2 norm, which fixes the output's length, follows the softmax loss curve, while dividing by the sequence length behind a gate, with scores clamped at 5 and gradients clipped, still gives loss spikes.

  • With two gradient steps per batch the PPO loss is clipped on fewer than 5% of tokens, and turning clipping off, then dropping the ratio as well, does not hurt, since the policy has little room to move far from the one that sampled the data.

  • In wide transformers trained with Adam, correlated queries and keys make attention logits grow like dheadd_{\rm head} by the LLN rather than dhead\sqrt{d_{\rm head}}, so μ\muP rescales logits by 1/dhead1/d_{\rm head} and hidden learning rates by 1/fan-in1/\text{fan-in} to keep scales bounded with width.

  • Each token's clipped ratio corrects its probability given its prefix and ignores the change in the distribution of the prefix, so it is accurate only while the two policies are close, and Laminar relies on keeping each trajectory's staleness small, typically below 3 steps, instead of correcting it further.

Threads