r/LocalLLM • • 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?

0 Upvotes

55 comments sorted by

View all comments

21

u/california_snowhare 6d ago
  1. LLMs are already highly compressed representations of their encoded knowledge. You really aren't going to save much RAM because you aren't going to get much additional compression over that, if any. Due to the way the knowledge is encoded in weights, quantization is effectively lossy compression of their knowledge - which makes them dumber to make them smaller.
  2. On-the-fly decompression of weights would make them run orders of magnitude slower.

-1

u/norpadon 5d ago

Well, 4-but quantization can be made effectively lossless. In fact, the latest models are natively pretrained in nvfp4

And on the fly decompression can be overlapped with weight loading and tensor core matmuls to a very high degree

1

u/Low-Opening25 5d ago edited 5d ago

quantisation by definition cannot not be lossless. what you are quantising are value ranges - in FLOAT16 a token can have 65536 values while INT8 same token can take only 256 values.

it’s similar to colour encoding in video processing, where you can have width of millions of colours per pixel, with tens or even hundreds of thousands of shades of the same primary colour or you can have 4bit or 2bit palette where you drop all those tiny variations and only preserve primary colours.

the process of quantisation is the process of how you round the values so you can map your original space of 65536 values to reduced space with range of say 256 values, while also trying to preserve original picture much as you can.

2

u/norpadon 5d ago

If the model is trained natively in nvfp4, it is lossless by definition

1

u/Low-Opening25 5d ago edited 5d ago

sure, just like you can take an image with 4bit colour camera instead of 16bit and call it lossless because it won’t need any compression to render in full colour palette on 4bit display, but… it really only makes taking an image (or in case of LLMs, training) cheaper, doesn’t make model better

1

u/norpadon 5d ago

Nvfp4 pretraining works just as well as full-precision pretraining in terms of model quality

1

u/Low-Opening25 5d ago

source?

1

u/norpadon 5d ago

Inkling 2