To fit a big model on a small chip, each weight is stored as one byte: a whole number from −127 to 127, times a scale shared by a group of group_size neighbouring weights. A weight is stored as round(weight / scale) and comes back as stored × scale. Write quantize(weights, group_size): the weights as they come back out of storage.
Each weight is stored as a whole number from −127 to 127 times one step shared by its group, so the group’s ruler is marked every step and every weight snaps to the nearest mark. Fine, until one huge weight sets the step and the small ones snap to 0.
quantize(weights, group_size)| weights | the numbers to store | e.g. [0.314, −0.771, 0.12, 0.586, 1.904, −0.442… |
| group_size | how many neighbouring weights share one scale a weight is stored as round(weight / scale), a whole number from -127 to 127 | e.g. 4 |
| returns | the weights rebuilt from storage (stored number * scale) | |