About

What Is Quantization? Shrinking Models with Lower-Precision Weights

Whether 4-bit survives depends less on the bits and more on how you split the scale

Short version: a 70B model in FP16 is 140GB of weights alone. Squeeze it to 4-bit and it drops to around 36GB. But if you do "convert to 4-bit" carelessly, the model just breaks. After reading this you'll know why quantization breaks models, how to make it break less, and which of GGUF, GPTQ or AWQ fits your setup.

In one line

Quantization means rewriting the weights in fewer bits. INT4 is -8 to 7, just 16 integers. So you also store a scale, "how much real value one integer step is worth", and at compute time you turn it back with integer × scale.

Converting a finished model without training is PTQ (Post-Training Quantization). Accounting for it during training is QAT (Quantization-Aware Training). Almost every quantized model you download to run locally is PTQ.

I tried it — this is what careless 4-bit looks like

I quantized the 37 Linear layers of DistilBERT (66M, a fill-in-the-blank model), 43,057,152 weights, by hand with torch 2.8.0. Then I fed it 8 masked sentences like "The capital of France is [MASK]." and counted how often it picked the same word as the original FP32 model.

method                     weight error  same answer
INT8, one scale per tensor     6.0%         8/8
INT4, one scale per tensor    53.7%         0/8
INT4, per output channel      16.8%         5/8
INT4, per group of 128        12.6%         6/8
INT3, per group of 128        29.3%         3/8

Same 4 bits, 0/8 versus 6/8. The one-scale-per-tensor model put a comma in all eight blanks. I assumed 4-bit would be roughly equally bad however you did it. The difference didn't come from the bit count. It came from how many pieces you split the scale into.

The culprit is one outlier

With one scale per tensor, the largest value in the tensor sets the step size. In the FFN lin2 of layer 3, the standard deviation was 0.045 but the maximum was 9.96. That's 222 times the standard deviation.

Map that to 7 (the INT4 max) and one step becomes 1.42. Nearly all the other weights, bunched near zero, round to 0. That's why the model only spat out commas.

One outlier sets the step sizeOne scale per tensor (INT4)step = 9.96 / 7 = 1.42outlier 9.96almost every weight (std 0.045) → 0DistilBERT, 8 masked sentences: 0/8 same answer as FP32One scale per group of 128 (INT4)each group gets its own stepnormal group: fine steps, weights keep their valuesoutlier group: only these 128 get coarseSame model, same 8 sentences: 6/8 same answer. Cost: one FP16 scale per 128 weights = +0.125 bit.

Split the weights into groups of 128 with a scale per group, and an outlier only ruins its own group. That's why GPTQ, AWQ and GGUF all use group (or block) scales. It isn't free: one FP16 scale per 128 weights adds 16 ÷ 128 = 0.125 bits per weight, so 4-bit becomes 4.125.

How to count memory

Number of weights × bits ÷ 8 gives bytes. Rough numbers for 70B (KV cache and activations left out):

FP16              70B × 2 bytes      ≈ 140GB
INT8              70B × 1 byte       ≈ 70GB
INT4 (groups)     70B × 4.125 ÷ 8    ≈ 36GB

This post used to say "at 4-bit it runs on consumer GPUs." 36GB doesn't fit on a single 24GB RTX 4090. For 70B at 4-bit, two GPUs or a Mac with lots of unified memory is realistic. With one GPU, 7B to 30B is the right size. Long conversations also eat extra memory for the KV cache.

GGUF, GPTQ, AWQ — when to use which

Lots of names, but where you run it mostly decides it.

Laptop, Mac, CPU (llama.cpp, Ollama, LM Studio): GGUF. It's llama.cpp's file format, and it's what you get when you pull a model in Ollama.

Serving from a GPU server (vLLM and friends): AWQ or GPTQ. Both are 4-bit PTQ for GPUs. GPTQ uses calibration data to patch up the error layer by layer as it rounds. AWQ protects the weights in channels with large activations so they get rounded less.

Training on top of 4-bit (QLoRA): bitsandbytes NF4. That's covered in the QLoRA part of the LoRA post.

GPTQ, AWQ and GGUF all have plenty of pre-converted models on Hugging Face. Look there before making your own.

At the end, compare answers on your own data

Don't trust the average error number alone. In the experiment above, the INT4 group version put "paris" where the original model said "marseille." Arguably a better answer, but other sentences went the other way. That's why "4-bit loses X%" is hard to state as a single number. Running a few dozen sentences close to your real use side by side with the original model is the fastest check.

If you want to run an LLM on your own server or PCs and aren't sure what size and what quantization will hold up, you can ask negabaro. We can start from the GPUs you have and the job you need done.

Key Concepts

1

Rewrite weights as low-bit integers (INT4 is the 16 values from -8 to 7)

2

Store a scale, the real size of one integer step (scale = max ÷ 7)

3

With one scale per tensor, a single outlier widens the step and the rest round to 0 (0/8 on DistilBERT)

4

A scale per group of 128 keeps an outlier inside its own group (6/8, for +0.125 bits)

5

At inference, turn it back with integer × scale and compute

6

Finally, compare answers side by side with the original model on inputs close to your real use

Pros

  • ✓ Memory shrinks with the bit count (70B: 140GB in FP16 → about 36GB in INT4)
  • ✓ No retraining needed (PTQ)
  • ✓ Plenty of pre-converted models already on Hugging Face

Cons

  • ✗ One outlier can wreck it — INT4 with one scale per tensor got 0 of 8 sentences
  • ✗ At 3 bits and below, even group scales drift a lot (INT3: 3/8)
  • ✗ Each format needs its own runtime (GGUF for llama.cpp, AWQ and GPTQ for GPU runtimes)

Use Cases

llama.cpp, Ollama, LM Studio — running GGUF on a laptop or Mac GPU serving with vLLM and friends — AWQ or GPTQ 4-bit models QLoRA — LoRA training on top of bitsandbytes NF4 Edge AI / mobile device deployment
← What Is Function Calling? How LLMs Call Tools with JSON What Is Knowledge Distillation? Teaching a Small Model with a Big Model's Probabilities →