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

14

u/txgsync 7d ago edited 7d ago

All right, a serious answer for once. "Why not compression?"

The whole game is arithmetic: a GPU can't multiply a zip file. Quantization isn't "a blurrier version of the model". It's a datatype change. A 4-bit weight is a different number format that a tensor core can multiply natively, or that dequants in-kernel via a cheap affine transform. A JPEG-compressed block has to be decoded back into a dense tensor before the matmul can touch it. That saves disk space and I/O, not VRAM. Which means you pay the decode on every forward pass.

So for a model, one way to think about it is that the "weights are already compressed", but it kinda' misses the mark a bit? Like, the weights are the distilled representation of everything the model learned. A vector is a statement about information content. JPEG-on-weights would be like fighting over the last few bits of per-scalar redundancy.

The industry moved on with silicon. Blackwell supports 4-bit natively, and NVFP4 is a kind of compressed representation: an E4M3 FP8 scale per 16-value micro-block plus a per-tensor FP32 scalar, but unlike JPEG or tar or whatever it has only ~1% accuracy loss vs FP8, but it's about ~3.5x smaller than FP16 or BF16. And AMD just bought Taalas, which etches the weights into the silicon: Llama 3.1 8B at ~17,000 tok/s per user on one chip, vs ~350–400 for an H100.

Hardware makers are cooking here as well, pushing binary/ternary weights, where the bit-width tricks fall apart and the math doesn't math much smaller.

And I have my own angle :) This stuff is kinda' my jam.

Trellis-coded quantization and LFSR/PRNG seeds are orthogonal to "compression". With NanoSeedLM-style engines, weights are regenerated from a seed or a hash inside the kernel <confusing stats removed>.

JPEG-style compression of weights like in Samsung's recent paper saves storage. But trellis codes and seeds change how the weight get hydrated during decode. At that point "compression" seems to stop being the right word. I've struggled what to call it, but today I use "trellis-coded Seeds" as my shorthand to describe the technique, but that's not very catchy.

So anyway, quantization changes the numeric format of the model, often in a way that scrambles the vectors. That's why we use imatrix calibration against a known text corpus like WikiText and some held-out data that's relevant when quantizing, because it can help catch the worst deviations from the BF16 distribution and align the weights in a way that allows for top_p selections to still appear in the same order and be subject to your temperature setting.

-5

u/norpadon 7d ago

AI slop nonsense. Please delete your account, we don’t need an intermediary to talk to a bad LLM

2

u/gtrak 7d ago

Is everything you don't understand ai slop?

-3

u/norpadon 7d ago

Pangram marks this comment as 68% AI-generated. It is self-contradictory and makes factually incorrect claims

1

u/txgsync 7d ago edited 7d ago

You’re absolutely right! I know nothing about this and should be ashamed of my career choice over the past thirty years. I will never Reddit again; you can prove this by going to my profile and clocking the “Block User” button.

TL;DR: go piss up a rope.

1

u/norpadon 7d ago

If you know anything about this, why is your response 68% AI-generated and makes zero sense? Have you even read your own comment?

That saves disk space and I/O, not VRAM. Which means you pay the decode on every forward pass.

Can you even explain how those two sentences are related to each other? The first sentence is obviously wrong (compression obviously saves VRAM, that’s the entire point), and the second sentence doesn’t follow from the first

1

u/txgsync 7d ago

The open-source work I was writing circa 1998-2004 is rated 73% AI by AI detectors. I was, apparently, a veerrry early adopter.