Sixteen Bits, Split Two Ways

Deep Learning in the Real WorldMedium+20 XP+20

Sixteen Bits, Split Two Ways

A team wants to halve a model's memory by storing its numbers in 16 bits instead of 32. Two 16-bit formats are on the table, and they split their bits differently.

Every format below stores a number as

± (1+f)×2e\pm\,(1 + f) \times 2^{e}±(1+f)×2e
  • eee is a whole-number exponent, held in the exponent bits. Each format allows only a fixed range of eee.
  • fff is a fraction held in the MMM mantissa bits, so it can only be one of 0, 12M, 22M, …, 2M−12M0,\ \tfrac{1}{2^M},\ \tfrac{2}{2^M},\ \dots,\ \tfrac{2^M-1}{2^M}0, 2M1​, 2M2​, …, 2M2M−1​.

A value that falls between two storable numbers is rounded to the nearer one. A value bigger than the largest storable number becomes infinity, which is called an overflow.

formattotal bitsexponent bitsallowed eeemantissa bits MMM
FP32328−126-126−126 to 12712712723
FP16165−14-14−14 to 15151510
BF16168−126-126−126 to 1271271277
FP8 (E5M2)85−14-14−14 to 1515152

Two values from a training run have to be stored:

  1. An activation of 90,00090{,}00090,000, produced by one unusually loud layer.
  2. A weight that was exactly 3.03.03.0, just after the optimizer adds 0.0050.0050.005 to it. Its true new value is 3.0053.0053.005.

What does each 16-bit format actually store for these two values?

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.

Select all that apply.