New Tool Radar

AI Concepts

How to Check Quantization Quality Loss with Perplexity and a Task

Measure what quantization costs you with perplexity and one real task, instead of trusting a file size alone.

Schematic illustration with three step boxes: measure the original, measure the quantized model, and compare both numbers.

Quantization stores weights in fewer bits, and quality falls far less than size does: 8 bits is close to free and 4 bits costs a little, by the publishers’ own measurements. The honest check uses two numbers, not one: perplexity on a fixed text, and a task benchmark your readers care about. Perplexity alone can hide a task-specific loss, and a task score alone can hide a general one.

Before you start

The original model and its quantized version, a fixed text for perplexity, and one task test with a scoring rule.

Measure the original model first

Run perplexity on a fixed text and run your task test on the original 16-bit model. Write both numbers down: they are the baseline every quantized version is judged against.

Use the same text and the same task for every version. A different test set makes the comparison meaningless.

Measure the quantized model the same way

Run the same perplexity text and the same task test on the quantized model, at the same sampling settings. Record both numbers next to the baseline.

Published examples show the scale of loss: llama.cpp reports Q8_0 raising perplexity by 0.0026, Q4_K_M by 0.1754 and Q2_K by 3.5199 on Llama 3 8B. Your model will differ, but the shape, small loss at 8 bits and a jump at 2 bits, is typical.

Compare both numbers before you accept

Accept the quantized model only if both numbers are close enough for your use: perplexity near the baseline and the task score within the margin your readers will accept.

If perplexity is fine but the task score falls, the loss is task-specific: test a higher bit-width or a different format before you ship.

Practice check: fictional Maple Corner 8B model, 3 quantization levels

The table below is fictional practice material, worked out by hand from the stated measurement method. It is the expected result for the practice model, not a run of any benchmark.

Version Perplexity rise Task score Verdict
FP16 baseline 0 82 of 100 Baseline
Q8_0 +0.01 82 of 100 Pass – no loss
Q4_K_M +0.18 80 of 100 Pass – small loss
Q2_K +3.50 61 of 100 Fail – large loss

Q8_0 loses nothing measurable and Q4_K_M loses 2 points on the task, which this team accepts. Q2_K loses 21 points and is rejected, matching the published pattern of a sharp fall below 4 bits.

Expected result. UNTESTED: the scores in the practice table are worked out by hand, not measured by running any model. Measure perplexity and one task score on your own original and quantized models, and compare both numbers.

Limits

  • Perplexity and task scores measure different things: a good perplexity does not guarantee a good task score.
  • Small models lose more quality to quantization than large ones, so a result on an 8B model does not predict a 70B result.

Sources

See all