Perplexity is the standard way to put a number on quantization damage: it measures how surprised the model is by real text, and a quantized model is always more surprised than the original. The question is how much more. Run the same text through both models with llama-perplexity and compare — the same text matters, because perplexity scores from different texts cannot be compared.
Related guide: How to Measure Model Speed with llama-bench
Run the same text through both models
llama-perplexity -m model-f16.gguf -f wiki.test.raw -c 512 -b 512 -ngl 99
llama-perplexity -m model-q4-k-m.gguf -f wiki.test.raw -c 512 -b 512 -ngl 99
Use text the models were not calibrated on — the wikitext-2 test split is the usual choice, and the model cards quoted here use it. Keep the context (-c) and batch (-b) the same for both runs. Lower perplexity is better; what matters is the gap between the two numbers, not either number alone. A small gap means the quantization cost little; a large gap means it cost a lot.
A stronger check: KL divergence
Perplexity alone can hide differences in what the model actually predicts. The stronger check, used on the model cards quoted here, saves the full-precision model’s logits with --kl-divergence-base and then scores the quantized model against them with --kl-divergence. That measures how far the quantized model’s predictions drifted from the original’s, token by token. It needs far more disk — one card warns the reference file is about 69 GiB for its vocabulary — so only use it when the perplexity gap is borderline and you need a tiebreaker.
Expected result. We checked the llama.cpp repository for llama-perplexity, and the linked guides and model cards for the exact commands and the wikitext-2 test split. We did not run this software ourselves for this guide, so no output here is a recorded result; steps marked UNTESTED were checked against the sources below, not run.
Limits
Perplexity measures prediction on generic text, not quality on your task: a model can have good perplexity and still answer your questions badly. Never compare perplexity numbers measured on different texts, with different context sizes, or from different harnesses. We did not run llama-perplexity, so no score here is a measured result.
Sources
- llama.cpp repository — llama-perplexity is part of the project
- Quantize your own GGUF — measure the damage with llama-perplexity after quantizing several levels; produce Q4_K_M, Q5_K_M and Q6_K, then measure
- Imatrix GGUF model card — evaluation: llama-perplexity –kl-divergence against the f16 model’s saved logits, on the wikitext-2-raw test split; GGUF rows come from a different harness than other rows
Checked 2026-11-28.
