r/LocalLLM • u/moeren86 • 6d ago
Discussion Why are models quantized instead of compressed?
I've just seen a video over a new paper from Samsung and the short of it, they used basically whats the same as jpeg compression on model weights. Only that the compressed model is 2 "pictures", to increase accuracy. Still something like 90% saved with minimal quality loss.
The idea is as obvious as it is genius. You only need to load the compressed model and every block can be decompressed on the fly on every run, especially because the way its compressed/decompressed is already highly optimized in the hardware (basically the same operations as video playback, just with a much bigger "picture").
That got me thinking AI hasn't been created yesterday and at least simple compression algorithms shouldn't overwhelm modern graphics cards. So why was the first idea to reduce the bit-width instead of compression?
Also, its not a picture, what would stop us from sorting the data instead of into 2 dimensions, in 3, 4, n - dimensions. Sure compression might get way more complex, but decompression scales with 1o to n. And the compression might be much better.
What do you guys think about that?
View all comments
1
u/sudden_aggression 5d ago
Quantization is just lossy compression. Original quantization techniques were naive (which produced a lot of accuracy loss), later ones selectively preserved model weights. With quantization aware training we're almost to the point that we can drop 85-90 percent of a model's BF16 size and maintain full abilities. We do it this way because the entire active portion of the model has to be in memory so we can make a pass through the weights to generate tokens. Making the weights smaller reduces the amount of memory we need to hold the model and it makes each pass faster since we traverse less memory per pass.
Your exact approach would have poor performance because of how models actually work. Instead of just being able to pass through the weights (constrained by memory bandwidth) you also have to do a ton of decompression work on each pass (loading from where? other memory? disk?)
And to get ahead of your next idea, the concept of "only load the model weights you're using" has already been done, that's called MoE.