Evaluating language models
Model quantization explained: bits, GGUF types, and accuracy
Model quantization explained: storing weights in fewer bits shrinks an 8B model from 14.96 GiB at 16 bits to 4.58 GiB at Q4_K_M, for some accuracy.
Oct 12, 2026 · Updated Nov 9, 20265 min read8 sources
Why it matters
A model must fit the memory of the machine where it runs, and each step down in bits costs accuracy that the file name does not show.
The short version
- 1Quantization stores weights in fewer bits. For Llama-3.1-8B, llama.cpp lists 14.96 GiB at F16 and 4.58 GiB at Q4_K_M, which is 4.8944 bits per weight.
- 2Accuracy loss shrinks with model size. In the GPTQ paper, 4-bit perplexity went from 8.34 to 8.37 for OPT-175B but from 27.65 to 31.12 for OPT-125M.
- 3GGUF is a file format, not a method. A benchmark score belongs to the exact quantized file it was measured on, so test the file you will run.
Model quantization stores a model's weights with fewer bits, for example 4-bit integers instead of 32-bit floats, so the model is smaller and can run faster (llama.cpp quantize README). The price is some accuracy.
For Llama-3.1-8B, llama.cpp lists the 16-bit (F16) file at 14.96 GiB and the 4-bit Q4_K_M file at 4.58 GiB. That is about 70% smaller.
How quantization works
Each weight is stored as a small integer plus shared scale values, and rebuilt from them when the model runs. Weights are grouped in blocks so a few scale values serve many weights.
Take Q4_K, from the Hugging Face GGUF documentation:
- Weights sit in blocks of 32, grouped 8 blocks to a super-block.
- Each weight is stored as a 4-bit integer, q.
- Each block stores a 6-bit scale and a 6-bit minimum.
- The weight is rebuilt as w = q × block scale + block minimum.
- The scales add overhead, so the type costs 4.5 bits per weight, not 4.
Hugging Face Transformers describes the same idea: weights move from 32-bit or 16-bit floats down to integer types like int8 or int4, while trying to keep as much accuracy as possible (Transformers quantization overview).
Quantization types and file sizes
The llama.cpp README measures every type on Llama-3.1-8B. Bits per weight are for the whole file. Speed is the README's text generation rate in tokens per second, measured at 128 tokens (llama.cpp quantize README, Quantization).
| Type | Bits per weight | Size (GiB) | Generation (tokens/s) |
|---|---|---|---|
| F16 | 16.0005 | 14.96 | 29.17 |
| Q8_0 | 8.5008 | 7.95 | 50.93 |
| Q6_K | 6.5633 | 6.14 | 58.67 |
| Q5_K_M | 5.7036 | 5.33 | 67.23 |
| Q4_K_M | 4.8944 | 4.58 | 71.93 |
| Q4_K_S | 4.6672 | 4.36 | 76.71 |
| Q3_K_M | 3.9960 | 3.74 | 71.68 |
| Q2_K | 3.1593 | 2.95 | 79.85 |
Size scales with bits per weight. Check it: 14.96 GiB × 4.8944 ÷ 16.0005 = 4.58 GiB. The table reports size and speed only. It gives no accuracy figure.
The same README notes that memory and disk needs are the same, because models are fully loaded into memory. For Llama 3.1 it lists 32.1 GB for the original 8B and 4.9 GB at Q4_K_M. For 70B, 280.9 GB and 43.1 GB. For memory beyond the weights, see how much memory an LLM needs.
What Q4_K_M means
The GGUF naming convention calls this part of a file name the encoding, the weights encoding scheme applied to the model (GGUF spec, naming convention). In Qwen3-27B-v1.0-Q4_K_M.gguf, the spec's own example, the encoding is Q4_K_M.
- Q4 is the 4-bit family.
- K marks the k-quant types built from super-blocks, like Q4_K above.
- _S or _M are recipe variants that mix tensor types. The README's
--pureoption turns off "k-quant mixtures" and gives every tensor one type.
The mixture is why a whole file costs more than its base type. Q4_K is 4.5 bits per weight. A Q4_K_S file is 4.6672 and a Q4_K_M file is 4.8944.
Does quantization reduce accuracy?
Yes, and the loss is larger for small models and fewer bits. The GPTQ paper, Table 3, reports WikiText2 perplexity for OPT models. Lower is better.
| Model | 16-bit | GPTQ 4-bit | GPTQ 3-bit | Round-to-nearest 4-bit | Round-to-nearest 3-bit |
|---|---|---|---|---|---|
| OPT-125M | 27.65 | 31.12 | 53.85 | 37.28 | 1.3e3 |
| OPT-175B | 8.34 | 8.37 | 8.68 | 10.54 | 7.3e3 |
Three things to take from it:
- At 4 bits, the 175B model barely moved. The 125M model lost noticeably.
- The method matters. Plain round-to-nearest collapsed at 3 bits.
- These are GPTQ and round-to-nearest results on OPT. They are not scores for any GGUF type.
The llama.cpp README says loss is usually measured with perplexity or Kullback-Leibler divergence, and that an importance matrix (imatrix) file can reduce it. See what perplexity measures.
Post-training quantization vs quantization-aware training
| Post-training quantization (PTQ) | Quantization-aware training (QAT) | |
|---|---|---|
| When | After training | During retraining |
| Cost | No retraining | Retraining the model |
| Accuracy | Often lower, especially at low precision | Usually higher |
Source: Gholami et al. survey, section on PTQ. GPTQ is a one-shot PTQ method. The paper reports quantizing 175-billion-parameter models in about 4 GPU hours, to 3 or 4 bits (GPTQ abstract).
GGUF vs GPTQ vs AWQ
| Name | What it is | Notes |
|---|---|---|
| GGUF | A file format | Binary format for GGML-based runtimes such as llama.cpp, built for fast loading (GGUF spec) |
| GPTQ | A PTQ method | One-shot, uses approximate second-order information (GPTQ) |
| AWQ | A PTQ method | Scales the most important weight channels, found from activation statistics collected offline (AWQ) |
| bitsandbytes | A library in Transformers | Quantizes on the fly as the model loads, at 4 or 8 bits (Transformers overview) |
GGUF stores both the tensors and a standard set of metadata, unlike tensor-only formats such as safetensors. The Hugging Face Hub has a viewer that shows each tensor's name, shape, and precision (Hugging Face GGUF docs).
Which quantization should you use?
Start at 4 bits, then measure. Dettmers and Zettlemoyer ran more than 35,000 zero-shot experiments, on models from 19 million to 176 billion parameters, across 5 model families. They found 4-bit precision almost universally optimal for total model bits and zero-shot accuracy (k-bit inference scaling laws).
- Find your memory budget and subtract the KV cache.
- Pick the largest type that fits, starting from Q4_K_M.
- Quantize from a 16-bit or 32-bit file. The README warns that requantizing an already quantized model can severely reduce quality.
- Use an imatrix file if you have one.
- Measure perplexity or task accuracy on your own text, on the exact file.
- If quality drops too far, move up a type: Q5_K_M, Q6_K, or Q8_0.
What to do next
- Check the type and bits per weight of the file you will deploy, in its GGUF metadata viewer.
- Ask whether any accuracy score was measured on that exact file or on the 16-bit original.
- Confirm the file was quantized from 16-bit or 32-bit weights, not requantized.
- Run a perplexity or task test on your own documents before and after quantizing.
- Size your hardware with the file size plus the KV cache, not the file size alone.
Azcuna's BABEL reads, translates, and searches foreign-language documents entirely on-device, with no cloud and no connection, and keeps every claim tied to the passage it came from. The long read on model provenance goes further.
Questions people ask
What is model quantization in simple terms?
Quantization stores a model's weights with fewer bits, for example 4-bit integers instead of 16-bit or 32-bit floats. The model takes less memory and can run faster. The cost is some accuracy. For Llama-3.1-8B, the llama.cpp documentation lists the 16-bit file at 14.96 GiB and the 4-bit Q4_K_M file at 4.58 GiB.
What does Q4_K_M mean?
Q4_K_M is a llama.cpp quantization type, and the GGUF naming convention calls that part of a file name the weight encoding scheme. Q4 is the 4-bit family, and K marks the k-quant formats built from super-blocks with per-block scales. The default recipes mix tensor types, so the whole Q4_K_M file averages 4.8944 bits per weight for Llama-3.1-8B, against 4.6672 for Q4_K_S.
Does quantization reduce accuracy?
Usually somewhat, and more for small models and low bit counts. The GPTQ paper reports WikiText2 perplexity, where lower is better. OPT-175B went from 8.34 at 16 bits to 8.37 at 4 bits. OPT-125M went from 27.65 to 31.12. At 3 bits the small model reached 53.85. Plain round-to-nearest did far worse than GPTQ at 3 bits.
Is 4-bit quantization good enough?
Often, by one large study. Dettmers and Zettlemoyer ran more than 35,000 zero-shot experiments on models from 19 million to 176 billion parameters and found 4-bit precision almost universally optimal for total model bits and zero-shot accuracy. That result covers five model families and zero-shot tasks. Check your own model on your own text before you rely on it.
What is the difference between GGUF, GPTQ, and AWQ?
GGUF is a file format for llama.cpp and other GGML-based runtimes. It stores tensors and metadata and can hold many quantization types. GPTQ is a one-shot post-training method that uses approximate second-order information. AWQ, activation-aware weight quantization, protects the most important weights by scaling them, using activation statistics collected offline. GPTQ and AWQ are methods; GGUF is a container.
What is post-training quantization vs quantization-aware training?
Post-training quantization converts a model that is already trained, with no retraining. Quantization-aware training retrains the model with quantization in the loop. The Gholami survey notes that post-training quantization avoids the retraining but often comes at the cost of lower accuracy than quantization-aware training, especially at low precision. GPTQ is a post-training method.
Sources
- 1llama-quantize (llama.cpp quantize tool README) · ggml-org (llama.cpp project)
- 2GGUF (GGML file format specification) · ggml-org (ggml project)
- 3GGUF (Hugging Face Hub documentation) · Hugging Face
- 4Quantization overview · Hugging Face Transformers documentation
- 5A Survey of Quantization Methods for Efficient Neural Network Inference · arXiv (Gholami et al.)
- 6GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers · arXiv (Frantar et al.; ICLR 2023)
- 7AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration · arXiv (Lin et al.; MLSys 2024)
- 8The case for 4-bit precision: k-bit Inference Scaling Laws · arXiv (Dettmers and Zettlemoyer)
Where this shows up in our work
- CALIBER, the market testbed for AI agents measures from an AI agent's trades whether it is gullible, herds, overpays, or can be steered.
- ELLMENT, the offline LLM for E-2D crews answers a crew's question from the aircraft's own manuals and cites the page, with no network.
