New Tool Radar

Local AI

How to Compare GGUF Q4_K_M and Q8_0 for Quality and Size

Compare the Q4_K_M and Q8_0 quantisations of the same model and pick the level that fits your machine.

Schematic illustration with three step boxes for How to Compare GGUF Q4_K_M and Q8_0 for Quality and Size.

GGUF quantisation shrinks a model’s weights: Q4_K_M stores about 4.9 bits per weight and Q8_0 about 8.5. In llama.cpp’s own Llama 3 8B test, Q4_K_M is 4.58 GiB with a perplexity increase of 0.175, while Q8_0 is 7.96 GiB with an increase of 0.003. This guide compares both files of the same model on your machine, so you can see the trade-off yourself.

Before you start

  • llama.cpp built, or Ollama installed, with a GGUF model available in both quantisations.
  • Enough disk for both files: about 5 GB for Q4_K_M and 8 GB for Q8_0 of an 8B model.
  • A terminal.

Get both files of the same model

Download the Q4_K_M and Q8_0 GGUF files of the same model and the same version from the same publisher. Do not compare different model versions: that tests the version, not the quantisation.

Measure the sizes

List both files and note their sizes. Check the rule of thumb: file size in GB is about parameters in billions times bits per weight divided by 8. For an 8B model, Q4_K_M is about 4.6 GB and Q8_0 about 8.0 GB.

Ask both the same questions

Run both models with the same prompt: one factual question, one maths question and one coding question. Compare the answers for correctness, not for style. Note which questions, if any, the Q4 file gets wrong that Q8 gets right.

Worked example

Sample test, asked to both files:

Question Q4_K_M Q8_0
What is 23 multiplied by 17? Record the answer (expected: 391) Record the answer (expected: 391)
Name the capital of Australia Record the answer (expected: Canberra) Record the answer (expected: Canberra)

If both answer correctly, Q4_K_M is enough for your tasks and saves about 40% of the disk and memory. If Q4 gets a question wrong that Q8 gets right, prefer Q8 for that kind of task.

Expected result

UNTESTED in this guide: no comparison was run while writing it. The expected result is that both files answer 391 and Canberra, Q4_K_M is about 4.6 GB and Q8_0 about 8.0 GB for an 8B model, and you have a note of any question only Q8 answered correctly.

Limitations

Quantisation changes only the stored weights, not the model itself. Larger models survive heavy quantisation better than small ones, because they have more redundancy. Perplexity numbers come from llama.cpp’s own tests on Llama 3 8B: your model and your tasks may differ, so test on your own questions.

Sources

See all