t27.aiРусский

One scale for a block of weights

You will learn

Why AI formats share one scale across a block of weights, and how the scale byte of OCP MX is read.

A language model has millions of weights, and a full float for each is expensive to store and to move. The Microscaling (MX) formats of the Open Compute Project keep each weight in 4, 6 or 8 bits and give every block of 32 weights one shared scale. That scale is a single byte called E8M0: no sign and no mantissa, only an exponent, so code e means 2 to the power e minus 127, and code 255 means NaN. The player compiles e8m0.t27, the spec of that byte, in your browser and runs its tests. Where the browser cannot run a check, it skips it and says why.

Try it

Run the tests and count the skips; then open the Verilog and find the function that checks for code 255.

Open the interactive lesson →

e8m0.t27, the OCP MX scale byte, compiled inside the post
e8m0.t27, the OCP MX scale byte, compiled inside the post ↗

The OCP MX shared scale as a t27 spec, compiled by t27c as WebAssembly in your browser: one byte, 2^(e-127), code 255 is NaN. Seven backends, the spec's own tests and its Verilog.

All lessons