90 points · by rbanffy · 3y ago · 80 comments
> Excitingly, we manage to reach the INT4 weight quantization for GLM-130B while existing successes have thus far only come to the INT8 level. Memory-wise, by comparing to INT8, the INT4 version helps additionally save half of the required GPU memory to 70GB, thus allowing GLM130B inference on 4 × RTX 3090 Ti (24G) or 8 × RTX 2080 Ti (11G). Performance-wise, Table 2 left indicates that without post-training at all, the INT4-version GLM-130B experiences almost no performance degradation, thus maintaining the advantages over GPT-3 on common benchmarks.
I guess that's nonsensical. 1-bit in all FP is the sign bit. So I guess the minimum size is 2-bit FP (1-bit sign + 1-bit exponent + 0-bit implicit 1 mantissa)
https://medium.com/ozonetel-ai/compressing-bert-sentence-emb...
FP3 gives you sign, 1x "exponent", 1x mantissa, so still kinda bit packing.
I could see FP4 with sign, 1x exponent, 2x mantissa. Exponent would really just be a 4x multiplier, giving +/-0,1,2,3,4,8,12
Or invert all those, so you are expressing common fractions on 0..1
EEs would recognize these values to be the Preferred Resistors values for projects (though more commonly the E6 series is used in projects, the E3 and E1 values are preferred)
That's 3 values per decade, which is slightly more dispersed than a FP4 that consists of 1 sign + 3 exponent + 0 (implicit mantissa 1 bit).
Or the values -128, -64, -32, -16, -8, -4, -2, -1, 1, 2, ... 128.
Maybe we can take -128 and call that zero instead, cause zero is useful.
--------
Given how even E3 is still useful in real world electrical engineering problems, I'm more inclined to allocate more bits to the exponent than the mantissa.
And exponent seems to be much more important for these small sizes. The first paper that shows up for FP4 almost has negative mantissa bits. Their encoding has 0, 1/64, 1/16, 1/4, 1, 4, 16, 64.
Weight quantization is much easier than weight + activation.
>the mantissa jumps from 32 bits to 52 bits
Rather from 23 (+1 for implicit msb) to 52 (+), I suppose.
https://ai.facebook.com/blog/making-floating-point-math-high...
Which is meta's 8 bit data type originally called (8,1, alpha, beta, gamma). I think they realized that's a terrible name so I think they are calling it Deepfloat or something now.
They need to seek help from a better naming team, please. It would help them, us, and the world, so much.
Once AI models become usable on desktops without esoteric hardware, their datasets will go the way of all large media which people have been distributing for many years.
There was an interesting paper from the Allen Institute a few years ago describing a system with 1 bit weights that worked pretty well! Since I read it I've been musing on trying that, though it seems unlikely I will be able to any time soon.
Never ever heard of inference latency being a bottleneck here…
I have had to deal with this lately, and FP8 / INT8 is very important especially for mobile/on-device inference. AI will start to get embedded in all kind of devices (even low power one), and often backend inference is not desired or feasible. It is actually pretty awesome if the industry moves towards INT8 / FP8 inference as a standard.
"But if FP8 becomes real, and if the popular training tools begin to develop ML models with FP8 as the native format, it could be a huge boon to embedded inference deployments. Eight-bit weights take the same storage space, whether they are INT8 or FP8."
See also http://people.eecs.berkeley.edu/~wkahan/UnumSORN.pdf and https://www.youtube.com/watch?v=LZAeZBVAzVw
Train the main model using FP8 (or other quantized approaches) and have a small calibrating model at FP32 that is trained afterward.
How do you perform differentiation with this datatype?
Nowadays the talk is mostly about optimization of constant factors, so it seems.
Or vice versa, 7 bit exponent, sign and 4 bit mantissa.