by MacsHeadroom · 3y ago · 0 comments
No, 4bit quantization is the typical case.
At 4bit you can fit twice the parameters of 8bit in the same space for far better performance/perplexity/quality.
Running LLMs higher than 4bit is atypical and almost always sub-optimal (compared to running a model half the size in 8bit).
Even pretraining and finetuning in 4bit is likely to become the norm soon as fp4 becomes more well understood.
https://github.com/ggerganov/llama.cpp#quantization
4 bit has a perplexity score 0.13 or so higher.
If you are limited to X RAM and have two 16bit models of size 4X and 2X then the 4X model in 4bit will always be far superior to the 2X model in 8bit, with far lower perplexity.
Compare 13B's 4bit perplexity of 5.3607 to 7B's 8bit perplexity of 5.9069. That is over 0.54 lower perplexity for the same RAM amount by using 4bit! That is MASSIVE!
You have to wonder if running a huge model, say, 300B parameters at 2-bit quantization might be "optimal" in that it would fit into a single A100 or H100 GPU and likely outperform an 80B parameter 8-bit model...
And some other models have more crazy numbers with even more crazier outliers within them, like you might have a weight of 12.00 between long array of typical small numbers around 0.00
I've read story about attempt to quantize RWKV model into the 4/5 bits which failed short due to the presence of outlier weights.
The author told somewhere that bigger models had worse perplexity because of this.
https://github.com/saharNooby/rwkv.cpp/issues/12
For LLaMA models - yeah, different story.
You can see it in real time when you take most LLMs and compare them at different quantization levels. I can see the degradation even in the largest llama quite badly even at 8 bits.
If you have X amount of VRAM and can fit a 16bit model of size 2X in 8bit or a model of size 4X in 4bit then the 4X model in 4bit is ALWAYS superior with lower perplexity and better performance.
You LOSE performance by using a smaller model in 8bit vs a larger model in 4bit.
More detail than you probably wanted: https://huggingface.co/blog/hf-bitsandbytes-integration
Also note that for a fixed memory (RAM) size, 4bit (even int4) is always superior, resulting in lower perplexity than 8bit.
E.g. LLaMA-13B int4 is far better/lower perplexity than LLaMA-7B fp8 while using the same amount of RAM.
So in this case one would load a byte which would have 2 4b data, and then you would have a 4b ADD or MAC which would operate on them.
If you don't have them then you need to sign/zero extend or convert the smaller bit-widths to 8/16/32b whichever is available.
https://github.com/ggerganov/llama.cpp/blob/master/examples/...
There's too many schemes right now with 4_0 and 5_1 really popular between LLM geeks.
I think that's a typo there too, the 13B model needs like 10G of memory for 4 bits, it's the 7B one that fits into 6G. Well unless you do the split thing with some layers on the CPU I guess.