Simulate FP8 (E4M3) Quantisation

hard
Unit 27 · Quantization0/0 to milestone

Hopper and Blackwell GPUs train and serve models in FP8. The E4M3 format has 1 sign bit, 4 exponent bits (bias 7) and 3 mantissa bits:

  • subnormals (exponent field 0): m / 8 × 2⁻⁶ for m = 1…7
  • normals (exponent field e = 1…15): (1 + m/8) × 2^(e − 7), except that e = 15 with m = 7 is NaN, so the largest value is 1.75 × 2⁸ = 448
  • there is no infinity
Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Simulate FP8 (E4M3) Quantisation · TechGradify