Stochastic & Neuromorphic Computing  /  Explore  /  Microscaling (MXFP) encoding

Microscaling weight encoding
one exponent for a whole block

Neural-network weights that sit near each other tend to share a magnitude. Block floating-point exploits that: a block of weights keeps a single shared exponent, and every element in it stores only a handful of bits. That is the idea behind the OCP Microscaling (MX) formats — MXFP4, MXFP6, MXFP8 — and SC-NeuroCore encodes weights into them for compact weight storage. Drive the encoder below and watch the trade between size and fidelity.

The idea — a block shares one exponent

In ordinary float32 every number carries its own 8-bit exponent, most of which is redundant across neighbouring weights. Microscaling factors that redundancy out: partition the weights into blocks of $B=32$, store one 8-bit exponent for the block, and give each element just $k\in\{4,6,8\}$ bits. The block's exponent sets the scale; the element bits place each value within it.

$$E_{\text{shared}} = \big\lfloor \log_2 \max_i |v_i| \big\rfloor + E_{\text{bias}}, \qquad W_{\text{block}} = E_{\text{shared}} + B\cdot k, \qquad \mathrm{CR} = \frac{32\,B}{E_{\text{shared}} + B\,k}$$
Live — encode a block of 32 weights, then decode it back
original float32 MXFP reconstruction
shared exponent: bits / block: compression vs float32: round-trip RMSE:

Every reconstructed value snaps to one of a few discrete levels set by the block scale — coarsely for MXFP4 (one mantissa bit per element, so each nonzero weight rounds to $0$ or the block scale), finely for MXFP8. Widen the weight spread and the shared exponent climbs to keep the largest weight in range, spreading the same levels over a wider window. The compression ratio and round-trip error shown are the ones the library produces on this block, computed the same way its encoder and decoder do.

The format family

Each format is a point on a single trade-off: fewer element bits give more compression and coarser weights. The bit budgets and compression ratios below are exact for a 32-element block with an 8-bit shared exponent; the round-trip error figures are representative of a unit-scale weight block and move with the weight distribution.

FormatElement bitsMantissaBits / blockCompressionTypical use
MXFP4411367.5×Aggressive weight ROM shrink; coarsest
MXFP6622005.1×Middle ground of size and fidelity
MXFP8 E4M3832643.9×Highest fidelity of the MX set here
MXFP8 E5M2822643.9×Wider element range, coarser mantissa

A standalone FP8 variant (block size 1, no shared exponent) is also in the catalogue for element-wise use. The compression ratios are the library's bits_per_block against a 32-bit baseline — the same arithmetic the demo prints.

What this encoder is, precisely

Honesty about the implementation: this is a block floating-point encoder in the MX family. It stores one 8-bit exponent per block and, for each element, a sign plus a low-bit linear mantissa scaled by that block exponent. The element widths (4/6/8) and the 32-element block match the OCP Microscaling naming and geometry, and the labels E4M3 / E5M2 are carried through — but the per-element value here is a linear mantissa, not a full per-element mini-float with its own exponent field. So it is a faithful block-FP quantiser in the MX family, not a bit-exact reproduction of every OCP per-element datatype.

Deeper: why the shared exponent is what matters
The dynamic range in a block comes almost entirely from the shared exponent, because it is chosen from the block's largest magnitude and rescales every element into $[0,1]$ before quantisation. Within a block the weights are then represented at uniform spacing set by that scale, which is exactly what the demo draws. This is why block floating-point holds up on neural weights specifically: a layer's weights cluster in magnitude, so one exponent per 32 of them wastes very little range, and the bits saved go almost entirely into storage. The formats saturate gracefully — a value larger than the block scale clamps to the top level rather than producing an infinity — and a zero block encodes to all zeros.
Where it fits

Compact weights are a hardware concern: on an FPGA the weight ROM is often the tightest resource, and cutting each weight from 32 bits to 4–8 multiplies how large a network fits on-chip. Microscaling sits in the compiler's analysis layer alongside the other target-side transforms, and it composes with the stochastic and spike encodings the rest of the site describes — those encode activations into streams, this encodes weights into blocks.

Evidence boundary: the demo runs the library's exact block encode/decode arithmetic in your browser on random weights — compression ratios are exact from the bit budget; round-trip errors are for the block on screen and depend on the weight distribution, not a model-wide accuracy claim. Accelerator names (H100 / B100 / MI300) refer to formats those devices consume, not to a shipped vendor integration. No throughput figures are quoted.