MXFP4 Visualizer

MXFP4 Visualizer

Sixteen BF16 numbers share one power-of-two scale, then each is squeezed into four bits: one sign, two exponent, one mantissa. Change any input to watch what survives the trip and what gets rounded away.

Input

Sixteen BF16 values — one MXFP4 block.

Block size 16 values. The scale is chosen from the block maximum, so one outlier costs every other value precision.

Bits

What goes in, and what comes out.

0100000010100000
1011111110100000
0011111101100000
0100000010000000
0100000010100000
1011111110100000
0011111101100000
0100000010000000
0100000010100000
1011111110100000
0011111101100000
0100000010000000
0100000010100000
1011111110100000
0011111101100000
0100000010000000
0100
1010
0010
0110
0011
1001
0101
1100
0010
0110
1011
0101
1001
0011
1110
0110

Shared scale factor 1.0, stored once for the block.

What it costs

Memory saved, and the error you pay for it.

Original
256 bits
16 values, BF16
Compressed
96 bits
16 codes plus one scale
Ratio
2.67:1
62.5% smaller
Saved
160 bits
96 kept of 256
Max error
0.500
MSE 0.0938 · MAE 0.250

E2M1 codebook

All sixteen representable values. Lit cells are the ones this block uses.

Quantization

Each value divided by the scale, rounded to the nearest codeword.

Scale Factor: 1.0 (Max value: 4.0 → MXFP4 range: ±6.0)

Per-value error

Original against reconstruction, value by value.