Status: settled, written before any quality code or results. Version 0.1.
This note fixes how frugal-llm will measure what a model loses when it is made cheaper (quantised). It is written before any results exist, so the method can’t be bent to fit them. Anything that changes after a quality result has been produced must be listed under “Changes since first result”.
How much does a model’s output change, and how much worse does it get on checkable tasks, when it is served in a cheaper format instead of FP16?
This is a relative question. It does not ask how good the model is. Every quality number is a comparison against an FP16 baseline of the same model, measured with:
The baseline is always measured, never taken from a model card or paper.
“FP16” in this note means the unquantised 16-bit weights exactly as the model’s authors publish them, whether FP16 or BF16. Converting between the two would add a step of our own to the reference, so the baseline is served in its published precision, which is recorded with every result.
Two methods, from the scope document’s three. The third, an LLM judge on open-ended prompts, is deferred: it is the weakest evidence and the first thing to drop.
Tasks whose answers can be checked mechanically, so no human or judge model is involved.
| Set | Source | Licence | Items | Scored by |
|---|---|---|---|---|
| Arithmetic reasoning | GSM8K test split | MIT | all 1,319 | exact numeric match of the final answer |
| Multiple-choice knowledge | MMLU test split, fixed stratified subset | MIT | 1,000 (target; see §6) | exact match of the chosen letter A–D |
Why these two:
What this does not measure, stated plainly: general capability, long-context behaviour, instruction following, safety, multilingual quality and creative writing. A format that keeps GSM8K and MMLU scores intact may still have degraded on any of these.
The same prompts with greedy decoding: how often, and how much, does the cheaper format’s output differ from FP16’s? This needs no ground truth and answers “what do you lose” most directly. Measured on the same items as Method 1 (no separate prompt set):
| Metric | Definition |
|---|---|
| Answer agreement | Share of items where the extracted final answer equals FP16’s, right or wrong |
| Exact output match | Share of items where the whole output text is identical to FP16’s |
| First divergence | Median word position where the output first differs from FP16’s |
| Word edit distance | Word-level edit distance to FP16’s output, divided by FP16’s length |
All four work on text, split on whitespace. Token IDs are not used, because the OpenAI-compatible API does not reliably return them and tokenisers differ between models.
Different is not the same as worse. A quantised model can diverge from FP16 and still be correct, or diverge and be more correct. Divergence is reported next to accuracy and never as a quality score by itself.
Quality runs are a separate run type from latency runs, with their own command and result file. Latency runs cap output length to keep throughput comparable; that cap would cut answers off and corrupt the scores.
Request settings, identical for every model and format:
| Setting | Value | Why |
|---|---|---|
temperature |
0 | Greedy decoding; sampling noise would swamp the quantisation effect |
top_p |
1 | No truncation of the distribution |
seed |
0 | Sent for servers that honour it; ignored harmlessly by those that don’t |
max_tokens |
1,024 for both | Long enough for real reasoning to finish (see the truncation rule below) |
| System prompt | none | The model’s own chat template only |
| Shots | zero-shot | No examples in the prompt, so the prompt set is all there is |
Prompt templates, fixed and versioned with the task set:
Answer: <number>.”Answer extraction, fixed in advance:
Answer: (case-insensitive, and also
with a fullwidth colon); else the number in the last oxed{...}; else the last number in
the output. Commas, currency signs and trailing .0 are removed and values compared as exact
decimals.C, C., (C), **C**); else the letter in the last oxed{...}; else the
letter in the last phrase like “the correct answer is C” or “the correct option is C” (LaTeX
wrapping allowed); else, only for replies of 20 words or fewer, the first standalone
letter A–D. In a longer reply a bare letter is usually part of the working, so it is not
guessed at: the item scores no answer.max_tokens is never graded from its unfinished text: it scores no
answer, with rule truncated.Truncation rule: if more than 1% of FP16 baseline outputs hit max_tokens, the limit is
doubled once and every format is rerun at the new limit. Outputs that still hit the doubled
limit are runaway generations (repetition loops or endless enumeration, which no limit fixes):
they score no answer and their rate is reported for every format. A format that runs away more
often than FP16 has degraded, and the reader should be able to see that this is how.
Everything is recorded per item: the full output text, the extracted answer, which extraction
rule applied, finish_reason, and token counts. The task set’s file is identified by its
SHA-256 hash in every result, so a reader can confirm exactly which items were run.
Noise floor. Greedy decoding is not perfectly deterministic: GPU kernels and request
batching can change the numerics between runs. So the FP16 baseline is run twice, and the
divergence between the two FP16 runs is reported as the noise floor. Divergence of a cheaper
format is only meaningful above that floor. Both FP16 runs and every quantised run use the same
concurrency, because batching is one of the noise sources. The study runs quality at
concurrency 16: batched greedy decoding is less deterministic than one request at a time,
but that extra noise is measured by the noise floor rather than hidden, and concurrency 1
would cost about six times as much GPU time. compare warns if runs used different
concurrency.
Prompt caching. Quality runs deliberately reuse identical prompts across formats, so server prompt caches will hit. Caching should change speed, not output; any effect it does have on the numbers shows up in the noise floor. Cache use is recorded per request, as in latency runs. No timing from a quality run is ever reported as a latency result.
Contamination. GSM8K and MMLU are public and probably appear in the training data of current models, which inflates absolute scores. The comparison is still fair, because FP16 and the cheaper formats are the same weights and saw the same data, but absolute accuracies are not evidence of general ability, and the write-up must say so.
Comparisons are paired: both formats answer the same items, so they are compared item by item, not as two separate accuracies.
What the study can and cannot detect. These sample sizes give 80% power at 5% significance:
| Accuracy drop to detect | If the formats disagree on 5% of items | 10% | 20% |
|---|---|---|---|
| 2 points | 979 items | 1,960 | 3,923 |
| 3 points | 434 | 870 | 1,742 |
| 5 points | — | 312 | 626 |
| 10 points | — | — | 155 |
With GSM8K’s 1,319 items, a drop of about 3 points is detectable if the formats disagree on 10% of items or fewer. Drops of 1–2 points cannot be told apart from noise at these sizes. The report will say “no difference detected; differences under about 3 points are below this study’s resolution”, never “no quality loss”.
Settled on 2026-10-15, before any quality code or results:
The design rule still holds: only the OpenAI-compatible API, no engine-specific code. A quality run is a chat-completions request without streaming timing, and the baseline is just another run against a different endpoint or model name. The interface, as built:
frugal-llm quality --url URL --model MODEL --task gsm8k --label fp16-run1
frugal-llm compare results/fp16-run1.json results/q4_k_m.json --noise-floor results/fp16-run2.json
compare works only on saved results, so the analysis can be redone without re-running any
model, which matters once runs cost money.
max_tokens raised from 32 to 512 (2026-10-15), after the first development run
(Qwen2.5-0.5B-Instruct FP16, llama.cpp, 100 items). Despite the “letter only” instruction,
the model began reasoning on 17 of 100 items and was cut off at 32 tokens, leaving 13 with
no extractable answer and one scored from a stray letter in unfinished reasoning. The
truncation rule in section 3 applied as written: the limit was raised and every run repeated.
No results from the 32-token runs are used.oxed{X} or “the correct answer is: oxed{X}”, and the old rules missed that form and
fell back to the first standalone letter in the working. 4 of 11 such items were scored
A when the model’s stated answer was C or D. Rules now take the last oxed{} or answer
phrase, and only short replies may fall back to a bare letter.