Inference Engineering · Lesson 22 · Quality Evaluation for Inference ChangesHome · Glossary · Your Lab

Quality Evaluation for Inference Changes

Faster is only better if the output remains acceptable.

Commit a prediction before revealing the model.
Today's win: build a quality gate for quantization, compilation, sampling, speculative decoding, and engine upgrades before accepting a speedup.

The setup

A faster kitchen fails if dishes leave raw. Keep a tasting panel and fixed orders beside the stopwatch; performance and quality are two separate acceptance gates.

1 · Define quality for the task

Use representative prompts and task metrics: exact match, pass@k, retrieval quality, factuality review, schema validity, preference judgments, or domain-specific checks. Perplexity (perplexity = a generic score of how well a model predicts held-out text; lower is better) alone is rarely the product metric.

2 · Control randomness

For deterministic comparisons use greedy decoding or fixed settings and seeds where supported. For sampling products compare distributions or repeated trials; one anecdotal output proves little.

3 · Separate lossless and lossy changes

Caching and mathematically exact speculative decoding should preserve the target distribution (the distribution = the model's probability spread over the next token; see Lesson 8) when implemented correctly. Quantization, changed kernels, altered sampling, or changed chat templates may move quality and require evaluation.

4 · Use paired gates

First require quality within an agreed tolerance, then compare SLO-valid performance on the same workload. Record model/engine revisions and investigate slice regressions, not only the aggregate.

5 · Canaries need semantic checks

Latency and error metrics cannot detect a fluent but worse model. Production rollout needs offline gates plus sampled online quality signals and a rollback threshold.

On YOUR cluster live-tested · course lab

Your cluster serves FP8 weights and FP8 KV cache, and the DFlash experiment compared speculative and baseline serving. Those are performance results; shipping either change still requires a workload-specific quality gate.

Study next: sources & lab companionLM Evaluation Harness · MLPerf Inference

Final check

← Lesson 21Lesson 23 →
References

LM Evaluation Harness · MLPerf Inference

Quality Evaluation for Inference Changes

Faster is only better if the output remains acceptable.

Today's win: build a quality gate for quantization, compilation, sampling, speculative decoding, and engine upgrades before accepting a speedup.

The picture

A faster kitchen fails if dishes leave raw. Keep a tasting panel and fixed orders beside the stopwatch; performance and quality are two separate acceptance gates.

Define quality for the taskUse representative prompts and task metrics: exact match, pass@k, retrieval quality, factuality review, schema validity, preference judgments, or domain-specific checks
Control randomnessFor deterministic comparisons use greedy decoding or fixed settings and seeds where supported
Separate lossless and lossy changesCaching and mathematically exact speculative decoding should preserve the target distribution (the distribution = the model's probability spread over the next token; see Lesson 8) when implemented correctly
Use paired gatesFirst require quality within an agreed tolerance, then compare SLO-valid performance on the same workload

1 · Define quality for the task

Use representative prompts and task metrics: exact match, pass@k, retrieval quality, factuality review, schema validity, preference judgments, or domain-specific checks. Perplexity (perplexity = a generic score of how well a model predicts held-out text; lower is better) alone is rarely the product metric.

TWO GATES · a speedup ships only if quality holds a change quant · spec · kernel QUALITY GATE eval set → metric vs baseline ± tolerance PERFORMANCE GATE SLO-valid speed vs baseline · same workload quality fail → reject (even if faster) SHIP both pass lossless · caching, exact speculative decode → distribution preserved by design lossy · quantization, changed kernels, sampling, chat template → must be evaluated
Notice the two gates are independent: a change must hold quality within tolerance on a representative eval set AND meet the SLO on the same workload. A faster configuration that fails the quality gate is rejected; latency dashboards cannot see a fluent-but-worse model. Lossless changes are preserved by construction; lossy ones must be measured.

2 · Control randomness

For deterministic comparisons use greedy decoding or fixed settings and seeds where supported. For sampling products compare distributions or repeated trials; one anecdotal output proves little.

DEFINE QUALITY FOR THE TASK · the metric must match what users need codepass@kunit tests run extractionexact matchschema validity retrieval / RAGretrieval qualitygroundedness open-endedpreference / win-ratefactuality review representative prompts drawn from real traffic slices, not a toy set fixed and versioned so runs are comparable perplexity alone rarely the product metric can move opposite to task score
Notice each task type has its own acceptance metric, anchored to a fixed set of representative prompts. This matters because a single generic score (especially perplexity) can stay flat or even improve while the metric users actually care about (tests passing, fields correct, and answers grounded) regresses.

3 · Separate lossless and lossy changes

Caching and mathematically exact speculative decoding should preserve the target distribution when implemented correctly. Quantization, changed kernels, altered sampling, or changed chat templates may move quality and require evaluation.

KNOW WHICH CHANGES CAN MOVE QUALITY: only evaluate those lossless · preserved by design • prefix / KV caching • exact speculative decoding • batching, paging same distribution → spot-check only (if implemented correctly) lossy · must be evaluated • quantization (weights / KV) • changed kernels / attention backend • altered sampling / chat template distribution can shift → run the gate size the eval to the risk
Notice the triage step before testing: lossless changes preserve the target distribution by construction, so they need only a correctness spot-check, while lossy changes can shift outputs and demand a real quality gate. This matters because it focuses scarce evaluation effort exactly where quality can actually move.

4 · Use paired gates

First require quality within an agreed tolerance, then compare SLO-valid performance on the same workload. Record model/engine revisions and investigate slice regressions, not only the aggregate.

ROLL OUT WITH SEMANTIC CHECKS · dashboards can't see fluent-but-wrong offline gate eval set passes before any traffic canary · 5% of traffic sampled online quality signal (judge / human / proxy metric) healthy → ramp to 100% past threshold → roll back latency ✓ · error rate ✓ · and the model is still quietly wrong only a semantic signal catches a regression the ops dashboards call "green"
Notice the rollback decision relies on a sampled quality signal, not the latency and error panels. This matters because a regressed model is usually fast and returns 200s but answers worse, so a rollout without an online semantic check ships a silent quality regression that every infrastructure dashboard reports as healthy.

5 · Canaries need semantic checks

Latency and error metrics cannot detect a fluent but worse model. Production rollout needs offline gates plus sampled online quality signals and a rollback threshold.

On YOUR cluster live-tested · course lab

Your cluster serves FP8 weights and FP8 KV cache, and the DFlash experiment compared speculative and baseline serving. Those are performance results; shipping either change still requires a workload-specific quality gate.

Check yourself

← Lesson 21Lesson 23 →
References

LM Evaluation Harness · MLPerf Inference