Before you start: words you need#
| Word | Plain meaning |
|---|---|
| FP4 (E2M1) | A 4-bit float: 1 sign bit, 2 exponent bits, 1 mantissa bit. It can hold only 0, 0.5, 1, 1.5, 2, 3, 4 and 6 (and their negatives). |
| Block scaling (microscaling) | Every small block of values (16 or 32) shares one scale, stored next to it. The block’s largest value is mapped to FP4’s largest, 6. |
| MXFP4 | The Open Compute Project’s format: blocks of 32, each with a power-of-two scale (an 8-bit exponent, “E8M0”). Native on NVIDIA Blackwell and AMD MI350X/MI355X. |
| NVFP4 | NVIDIA’s format: blocks of 16, each with an FP8 (E4M3) scale, plus one FP32 scale per tensor. Native on Blackwell and later. |
| W4A4 | Weights and activations in 4 bits, so the tensor cores multiply in FP4 (13.b). |
13.f covered 4-bit integer weights, which are unpacked to 16 bits before the multiply. This lesson is about 4-bit floating point with hardware support: the multiply itself runs in 4 bits. That is the difference that matters.
1. What is it?#
FP4 inference stores weights — and usually activations — as 4-bit floats in small blocks with their own scales, and runs the matrix multiplies on tensor cores that read FP4 directly.
FORMAT BITS STATUS (checked 11 November 2026)
BF16 16 the reference precision
FP8 8 production standard on Hopper, Blackwell, MI300+ (13.e)
INT4 4 weight-only, production-common on Hopper and older (13.c, 13.f)
MXFP4 4 native on Blackwell and MI350X/MI355X; gpt-oss ships in it
NVFP4 4 native on Blackwell and Rubin; official checkpoints for most
large open models; NVFP4 KV cache in vLLM since v0.32.0
FP6/MXFP6 6 native on Blackwell and MI355X; a quality/speed middle ground2. Why does it exist?#
Two reasons, one for each phase of inference (12.c):
- Decode is memory-bound. 4-bit weights are a quarter of BF16’s bytes, so each step reads four times less. INT4 already gives that.
- Prefill and high-batch decode are compute-bound. Only a format the tensor cores can multiply directly makes those faster. On Blackwell, FP4 tensor-core throughput is twice FP8’s and four times BF16’s.
Decode gain Prefill gain Weight memory
INT4 W4A16 2.5–3.5x ~1.0x 0.28x memory benefit only
FP4 W4A4 2.5–4x 2.5–3.5x 0.28x memory AND computeFP4 is the first format that speeds up both phases at 4 bits.
3. Simple analogy#
Pricing groceries with only eight price tags: 0, 50p, £1, £1.50, £2, £3, £4 and £6. One set of tags for the whole shop is hopeless — a £60 item and a 20p item cannot both be priced. Give each shelf its own multiplier (“on this shelf, multiply every tag by 10”) and the eight tags become usable again, because items on one shelf have similar prices.
Shelves are blocks. NVFP4’s shelves are smaller (16 items) and its multipliers can be any of many values; MXFP4’s shelves hold 32 items and the multiplier must be a power of two (×1, ×2, ×4 …).
4. Tiny example#
The program quantizes 64 weights to FP4 five ways and measures the error. Run it with go run.
// fp4blocks: quantize one tensor to 4-bit floats (E2M1) with three kinds of scaling.
package main
import (
"fmt"
"math"
)
// The 8 non-negative values an E2M1 (FP4) number can hold.
var e2m1 = []float64{0, 0.5, 1, 1.5, 2, 3, 4, 6}
// toFP4 rounds v to the nearest representable FP4 value (sign kept separately).
func toFP4(v float64) float64 {
a, best := math.Abs(v), 0.0
for _, q := range e2m1 {
if math.Abs(a-q) < math.Abs(a-best) {
best = q
}
}
return math.Copysign(best, v)
}
// toE4M3 rounds a positive scale to FP8 E4M3 (3 mantissa bits), as NVFP4 stores it.
func toE4M3(v float64) float64 {
e := math.Floor(math.Log2(v))
step := math.Pow(2, e-3)
return math.Round(v/step) * step
}
// quantize splits x into blocks of size n; each block gets scale = amax/6, stored
// either exactly, as FP8 E4M3 (NVFP4) or rounded up to a power of two (MXFP4, E8M0).
func quantize(x []float64, n int, scaleKind string) []float64 {
out := make([]float64, len(x))
for b := 0; b < len(x); b += n {
end := min(b+n, len(x))
amax := 0.0
for _, v := range x[b:end] {
amax = math.Max(amax, math.Abs(v))
}
s := amax / 6 // map the block's largest value to FP4's largest, 6
switch scaleKind {
case "e4m3":
s = toE4M3(s)
case "e8m0":
s = math.Pow(2, math.Ceil(math.Log2(s)))
}
for i := b; i < end; i++ {
out[i] = toFP4(x[i]/s) * s
}
}
return out
}
func rmsErr(a, b []float64) float64 {
var num, den float64
for i := range a {
num += (a[i] - b[i]) * (a[i] - b[i])
den += a[i] * a[i]
}
return math.Sqrt(num / den)
}
func main() {
// 64 weights: mostly small, with one larger value in each half (a typical shape).
x := make([]float64, 64)
for i := range x {
x[i] = 0.02 * math.Sin(float64(i)*1.7) * (1 + float64(i%5))
}
x[5], x[40] = 0.9, -0.6
fmt.Printf("%-34s %s\n", "scheme", "relative RMS error")
fmt.Printf("%-34s %.3f\n", "one scale for all 64 (per-tensor)", rmsErr(x, quantize(x, 64, "exact")))
fmt.Printf("%-34s %.3f\n", "blocks of 32, exact scale", rmsErr(x, quantize(x, 32, "exact")))
fmt.Printf("%-34s %.3f\n", "MXFP4: blocks of 32, 2^k scale", rmsErr(x, quantize(x, 32, "e8m0")))
fmt.Printf("%-34s %.3f\n", "blocks of 16, exact scale", rmsErr(x, quantize(x, 16, "exact")))
fmt.Printf("%-34s %.3f\n", "NVFP4: blocks of 16, FP8 scale", rmsErr(x, quantize(x, 16, "e4m3")))
}Output:
scheme relative RMS error
one scale for all 64 (per-tensor) 0.147
blocks of 32, exact scale 0.128
MXFP4: blocks of 32, 2^k scale 0.230
blocks of 16, exact scale 0.086
NVFP4: blocks of 16, FP8 scale 0.096Two lessons in five lines:
- Smaller blocks help. Going from one scale to blocks of 16 cuts the error from 0.147 to 0.086, because each block’s scale fits its own values.
- The scale’s precision matters. A power-of-two scale can be almost 2x larger than needed, wasting most of FP4’s eight levels; here it nearly doubles the error. An FP8 scale costs very little (0.086 → 0.096). Real MXFP4 implementations round the scale down and clip the largest values instead, which trades this error for clipping error — either way the coarse scale costs accuracy. This is why NVFP4 usually beats MXFP4 at the same 4 bits on post-training quantization, and why MXFP4 models tend to be trained for the format.
5. Technical explanation#
The two formats#
MXFP4 (OCP standard) NVFP4 (NVIDIA)
Element FP4 E2M1 FP4 E2M1
Block size 32 16
Block scale E8M0 (power of two, 8 bits) FP8 E4M3 (8 bits)
Tensor scale none one FP32 per tensor
Bits per value 4 + 8/32 = 4.25 4 + 8/16 = 4.5
Hardware Blackwell, MI350X/MI355X Blackwell, Rubin
Typical use gpt-oss; AMD-native serving most NVIDIA-published checkpointsAMD’s MI350X/MI355X run MXFP4 natively but not NVFP4. AMD’s ROCm team documents an online NVFP4 → MXFP4 re-quantization path in SGLang so NVFP4 checkpoints can still be served on MI355X, and AMD’s Quark toolkit exports both formats.
NVIDIA has also shown NVFP4 pretraining: its research reports reaching the same loss as FP8 on large runs, and that MXFP4 needed about 36% more training tokens to match NVFP4 — vendor numbers, but consistent with the example above.
Making 4-bit activations work#
Weights can be prepared offline with care. Activations arrive at run time with outliers (13.d). FP4 checkpoints keep activations usable with:
- dynamic per-block scales computed in the kernel for each block of 16 activations;
- rotations (Hadamard transforms, 13.d) that spread outliers before quantizing;
- calibrated tensor-level scales (NVFP4’s FP32 scale), fitted with tools such as ModelOpt and llm-compressor, often using GPTQ-style error correction (13.c).
What stays in higher precision#
✓ 4-bit: FFN and MoE expert weights (the bulk of the bytes), their activations
~ careful: attention projections — often kept at FP8
✗ keep high: embeddings, LM head, norms, MoE router weights
✗ always: accumulation in FP32; softmax, norm reductions, residual stream,
RoPE and sampling in 16 or 32 bitsThe state in November 2026#
- Checkpoints. NVIDIA, model makers and Red Hat publish NVFP4 versions of most large open models (DeepSeek, Kimi, GLM, Qwen, MiniMax, Llama, Nemotron); gpt-oss is distributed in MXFP4.
- Engines. TensorRT-LLM, vLLM and SGLang serve NVFP4 and MXFP4 on Blackwell. vLLM v0.32.0 (18 October 2026) added NVFP4 KV caches across several NVIDIA generations (13.h).
- Tools. NVIDIA ModelOpt, llm-compressor (MXFP4 from v0.9, GPTQ for FP4 from v0.10) and AMD Quark produce FP4 checkpoints.
- Accuracy. Red Hat reported NVFP4 recovering roughly 95–98% of BF16 accuracy on 7B–14B models (February 2026); larger models usually recover more. Independent comparisons are mixed — on some models INT4 AWQ matches or beats NVFP4 on accuracy — so evaluate on your task.
6. Under the hood#
Blackwell FP4 multiply, per tile:
memory → shared memory: FP4 weights (½ byte each) + one FP8 scale per 16
tensor core: reads FP4 operands AND their block scales directly,
multiplies, accumulates in FP32 — no unpacking step
epilogue (13.j): apply the tensor-level scales, add bias, activation,
quantize the output to FP4 for the next layer (fused)The hardware applies block scales inside the multiply, which is why FP4 has no conversion overhead and why the block size is fixed by the hardware, not a free choice.
7. Performance implications#
- On Blackwell, FP4 tensor-core throughput is ~2x FP8. Expect roughly 1.5–2x more throughput than FP8 end to end for compute-bound serving, less for memory-bound decode where FP8 already halved the bytes.
- Memory: a 670B-class MoE model drops from ~1.3 TB in BF16 to ~380 GB in NVFP4. On an 8-GPU B200 node (~1.4 TB of HBM) that turns “the weights barely fit, no room for KV cache” into “a TB left for KV cache”.
- The gain shrinks wherever the step is not dominated by the quantized multiplies: attention over long contexts (KV cache bytes, 13.h, 13.l), communication (Module 14) and CPU overhead (13.k).
8. Production implications#
- On Blackwell: deploy FP8 first, then evaluate NVFP4 with the official checkpoint if one exists. Keep the FP8 version ready for rollback.
- On MI355X: MXFP4 is the native 4-bit format; NVFP4 checkpoints need re-quantization.
- On Hopper and older: FP4 has no tensor-core support; use INT4 weight-only (13.c) instead.
- Validate at Level 3 (11.k): long generations, reasoning traces, tool calls. 4-bit errors compound over long outputs.
- Record the format exactly — NVFP4 and MXFP4 checkpoints are not interchangeable.
9. Common mistakes#
- Treating FP4 like INT4. FP4 W4A4 speeds up compute; INT4 W4A16 does not.
- Assuming NVFP4 and MXFP4 are interchangeable. Different block sizes and scales, different hardware support.
- Quantizing embeddings, the LM head or MoE routers to 4 bits.
- Validating with perplexity only.
- Expecting FP4 gains on Hopper. No FP4 tensor cores there.
10. Hands-on exercise#
A. Run the example. Change the block size to 8 and 64 and the outlier values to 2.0 and −3.0. How do the five errors change? Explain each change.
B. Round down instead of up. Change the e8m0 case to round the exponent down (the OCP rule)
and clip values above 6. Compare the error with rounding up. Which hurts more for this data?
C. FP8 vs NVFP4 on Blackwell. If you have a Blackwell GPU (B200, RTX 50, GB10), serve the official FP8 and NVFP4 versions of one model. Measure prefill and decode throughput and one task evaluation. Is the speedup worth the quality change for your task?
11. Interview questions#
- How does FP4 W4A4 differ from INT4 W4A16 in what it speeds up?
- Compare NVFP4 and MXFP4: block size, scale format, bits per value, hardware.
- Why does block scaling make 4 bits usable?
- Why does a power-of-two block scale cost accuracy?
- What would you keep out of FP4, and why?
- You must serve an NVFP4 checkpoint on MI355X. What happens?
12. Further reading#
- [ESTABLISHED] OCP, “Microscaling (MX) Formats Specification v1.0”
- [ESTABLISHED] Rouhani et al., “Microscaling Data Formats for Deep Learning” (2023)
- [EMERGING] NVIDIA Research, “Pushing Intelligence to 4-bit” — NVFP4 training and inference
- [REFERENCE] Red Hat, “Accelerating large language models with NVFP4 quantization” (February 2026)
- [REFERENCE] AMD ROCm blog, “Serving NVFP4 models on AMD Instinct MI355” and “High-accuracy MXFP4, MXFP6 and mixed-precision models on AMD GPUs”
- [REFERENCE] vLLM v0.32.0 release notes — NVFP4 KV cache
- [REFERENCE] NVIDIA TensorRT Model Optimizer