gpt-oss ships its expert weights in MXFP4: 4-bit floats in blocks of 32 that share one 8-bit power-of-two scale. The checkpoint stores each weight matrix as two uint8 tensors, blocks and scales. Decode them back to float32 exactly as OpenAI's loader does.
mxfp4_decode(blocks, scales):
blocks has shape (..., G, 16): each of the blocks is 16 bytes, and each byte packs two 4-bit codes. The low nibble (byte & 0x0F) is the first of the two values and the high nibble (byte >> 4) the second, so byte of a block holds elements and .FP4[c] with
FP4 = [0, 0.5, 1, 1.5, 2, 3, 4, 6, -0, -0.5, -1, -1.5, -2, -3, -4, -6]
(the top bit is the sign; codes 8-15 are the negatives of codes 0-7).scales has shape (..., G) with one byte per block, an E8M0 exponent with bias 127: every value in the block is multiplied by .(..., G * 32): the blocks of each row laid out one after the other.