Evaluating Small Models in Context › The evaluation protocol: five questions
Language AI HandbookAll chapters We will structure the protocol as five questions. Each one produces a required measurement or declaration. A small-model evaluation that cannot answer all five is incomplete.
- Task fit: does the model, on a matched task slice, clear the minimum quality bar for the intended use?
- Cost: what are the measured latency, throughput, and energy under the target workload?
- Privacy: what data leaves the device, under what policy, and is that policy enforceable?
- Reliability: how does quality degrade on the tail: hard slices, distribution shift, adversarial inputs, and repeated runs?
- System comparison: how does the full system (tokenizer + weights + runtime + prompt + fallback) compare to alternatives on a cost-aware objective?
The questions are ordered deliberately. Task fit comes first because a system that cannot do the task at all is not worth the cost of measuring. Cost, privacy, and reliability each isolate a dimension that the average-based quality number hides, and each must be stated explicitly because none of them is captured by a single accuracy figure. Only once all four are characterized can the fifth question, the comparison, be answered, because the comparison depends on all of them. We will take these in order, then put them together in a worked comparison.
Question 1: Task fit on matched slices
The first mistake is evaluating on a benchmark that does not resemble the deployment task. A model that wins on a general knowledge benchmark may fail on your specific extraction, classification, or summarization task because the distribution is different: different vocabulary, different output lengths, different error costs. The fix is to construct a task slice: a labeled sample of inputs drawn from (or closely resembling) the deployment distribution, with a defined target and a defined scoring rule.
The word "matched" in "matched task slice" is doing important work. A matched slice is one whose inputs, targets, and error structure resemble the deployment, not merely one whose topic is similar. A slice of clean, well-formed English support tickets that are all short is not matched to a deployment whose users write in a mix of languages and sometimes paste half a page of context. To match the workload, include those input groups in the evaluation and report their results separately when the decision depends on them.
A task slice has five declared components:
- Input distribution: where the examples come from, and how they were sampled. If they are synthetic, say so and validate against real inputs.
- Target definition: what counts as a correct or acceptable output. For generation tasks this is usually a rubric rather than exact match.
- Scoring rule: exact match, F1, ROUGE, an LLM judge, or a human rubric. State it, including tie-breaking.
- Minimum bar: the quality below which the system is unacceptable, derived from the business or user requirement, not from the model's score.
- Slice structure: the subpopulations (length buckets, languages, domains, difficulty levels) on which you will report separately, because averages hide failures.
Each of these declarations exists to close a loophole. Declaring the input distribution prevents the quiet substitution of an easy benchmark for a hard deployment. Declaring the target and the scoring rule prevents the metric from drifting after the results are seen, which is a subtle form of p-hacking. The minimum bar is perhaps the most important and least natural of the five: it must come from the user requirement, set before you see the model's score, because a bar set afterward will inevitably be drawn just below wherever the model landed. And the slice structure is what converts a single aggregate number into a diagnosis, telling you not just whether the system fails but where.
The reason to insist on slices rather than a single number is that small models fail unevenly. A model may match a larger baseline on short inputs and collapse on long ones, or on rare entities, or on inputs containing numbers. Reporting only the mean hides exactly the failures that will hurt in deployment. Consider a concrete illustration that is exact at its stated precision. The first model scores 0.85 on every slice. The second scores 0.95 on nine slices and 0.10 on a tenth, which contains a low-frequency but important input group. With equal slice weights, the second model's average is (9 × 0.95 + 0.10) / 10 = 0.865, about 1.5 points above the first model's 0.85, while the deployment outcomes could hardly be more different. The slice table is what makes this visible. We already saw, in Comparing Architecture Families Fairly, how averaging over mismatched settings produces misleading rankings; the same principle applies here.
If your evaluation inputs overlap the training data, the measured score may overstate generalization to fresh examples. Li et al. observed larger accuracy increases on contaminated C-Eval and HellaSwag examples than on MMLU. Exact matches and near-duplicates can both matter. Hold out a fresh slice, check for near-duplicates against known training corpora where possible, and state the provenance of your evaluation data. This connects to the dataset-transparency concerns in Dataset Lineage and Provenance.
A high score alone cannot tell you whether the test examples were seen during training. Hold out fresh data and document how you obtained and sampled it. If the training data is unavailable, state that overlap could not be ruled out.
Question 2: Cost, measured versus synthetic
Cost for a small model has three components that are often conflated. Each must be measured on the target hardware, not estimated from parameter counts:
- Latency: time to first token and time to completion.
- Throughput: requests or tokens per second under concurrency.
- Energy can be measured in joules per request within a declared system boundary. A change in battery percentage over a fixed session is a separate device-side drain proxy; it depends on the device and session.
These three are distinct and can move in different directions, which is why they must be reported separately. A configuration might have low time-to-first-token (because the prompt processes quickly) but poor tokens-per-second during generation, or high single-request latency but good throughput under batching. Energy is distinct again: sustained high throughput on a phone may be thermally sustainable only briefly, so a system that looks cheap on a single request can be expensive across a session. Collapsing these into a single "cost" number loses the very information a deployment decision needs.
There is a strong temptation to use a synthetic cost model: bytes read, FLOPs, or a theoretical tokens-per-second formula. Synthetic costs are useful for early design (they let you reason about memory bandwidth and compute before you have hardware), but they systematically mislead on real devices for three reasons.
- Memory-bound decode. At low batch sizes, reading weights and the KV cache can dominate autoregressive decoding. A FLOP-only estimate misses that memory traffic.
- Runtime overhead. Kernel launch overhead, tokenization time, sampling, and host-device transfer can dominate for very small models, where the compute is tiny.
- Thermal and power limits. Phones and laptops throttle. A model that meets latency at the start of a session may exceed it after sustained load.
For dense autoregressive decoding at batch size one, the linear layers repeatedly use their weights to produce each new token. If those weights exceed the available cache, reading them can dominate decoding time. The balance changes with batching, model architecture, sequence length, and hardware, which is why the measured workload matters.
So the rule is: measure latency, throughput, and energy on the target device under the target workload, and report the measurement setup. If you must use synthetic costs for extrapolation, label them as such and validate a subset against measured numbers.
A minimal cost measurement must declare:
- Device: chip, RAM, whether the device is plugged in, ambient temperature if thermal throttling is a risk.
- Runtime and quantization: e.g., llama.cpp with Q4_K_M, or ONNX Runtime INT8, or a GPU server with FP16.
- Workload: input and output length distribution, batch size, concurrency.
- Warm-up and steady state: whether numbers include the first request (which pays model load) and whether throttling was reached.
Measure time to first token and the rate of later tokens from the same workload. Start the TTFT clock at request submission and stop at the first emitted token. For a response with at least two tokens and a positive measured interval, divide the number emitted after the first by the elapsed time from the first to the last emission. If a response emits no tokens, report that outcome separately. If timing resolution cannot distinguish the first and last emissions, the per-response decode rate is undefined. Longer prompts can emphasize prefill costs, while longer continuations provide more observations of decode timing. Report cache and warm-up conditions because the first request may include model loading. Sarathi-Serve describes the distinct prefill and decode phases.
Question 3: Privacy and data leaving the device
Privacy is where small models can offer something a hosted model usually cannot: data minimization by construction. If the model runs on the device and no network call is made, the input text does not leave the device. That is a strong, auditable property, if it is implemented and verified.
A hosted model must receive the input it processes. Retention policies and access controls can restrict what happens after the transfer. A system whose inputs stay on the device can satisfy a requirement that forbids the transfer itself.
The evaluation question is: which data leaves the device, under what policy, and can you prove it? The relevant facts are:
- Where inference runs: on-device, edge server, or cloud.
- What is logged: inference inputs, telemetry, crash reports, model output. Logging can quietly turn an on-device model into a data-export channel.
- What is transmitted: feature extraction, fallback routing, prompt caching to a cloud service, analytics.
- Enforceability: is "no network" a code guarantee (network disabled in the sandbox) or a policy promise? Audit the implementation and any organizational controls that the policy depends on.
A privacy claim covers every component that handles user data. On-device inference can still transmit input through telemetry. A hosted system with no retention still receives input for processing; these are distinct data-flow and retention properties. Privacy must be evaluated as an end-to-end property, with the data-flow diagram as evidence. This complements the detection-and-removal techniques in PII Removal: PII redaction is a preprocessing decision, but whether the residual data left the device is a deployment decision.
Audit the actual data flow and the controls that enforce it. A sandbox that denies direct network access limits one route. Check what the host process, loggers, telemetry, and sync services can still send. Revisit the audit when a new feature adds a path.
Question 4: Reliability: the tail rather than the mean
For reliability, record how often the system fails and which kinds of failure occur. Check performance under distribution shift, on difficult inputs, and across stochastic runs where applicable.
-
Distribution shift. A model tuned on one domain (say, standard English customer-support messages) may degrade sharply on a neighboring domain (regional dialect, code-switching, emoji-heavy chat). Measure the matched slice and a separate held-out slice for the shift. The multilingual evaluation concerns in Cultural and Multilingual Evaluation and Code-Switching and Mixed-Language Text apply here: a mismatch between the test slice and the deployment population can bias the reported reliability in either direction. The subtlety is that distribution shift is not a single axis. A model may handle changes in formality while struggling with longer inputs, or do well on one dialect and poorly on another. The shifted slice should therefore sample the kinds of variation you expect to encounter, and the report should name which shift it measured.
-
Input difficulty. Slice by length, by ambiguity, by presence of numbers or rare entities. Report each slice's quality, the lowest slice score, and the micro-average. A system that is excellent on 90% of inputs and catastrophically wrong on the remaining 10% may be worse in deployment than a slightly weaker system with a flat profile, depending on error cost. Whether the flat profile or the peaky one wins is a question the deployment must answer: if errors on the hard 10% are cheap and recoverable, a peaky model that shines on the common case is fine; if those errors are expensive and silent, the flat profile is worth its lower ceiling.
-
Decoding stochasticity. Small models are sensitive to decoding settings: temperature, top-p, and seed. Run the evaluation under a fixed, declared decoding configuration for the headline number, and separately report a stability check: re-run under a small set of seeds or a temperature sweep and report the variance. An accuracy number without a decoding spec is not reproducible. We covered the mechanics in Decoding Temperature and Nucleus Sampling; here they become evaluation controls. The reason both a fixed configuration and a stability check are needed is that they answer different questions. The fixed configuration answers "what does this system do under a declared setting?" The stability check answers "how much would that answer move if I had chosen differently?" A system with a stable answer is one you can reason about; a system whose answer swings widely across seeds is one whose single reported number is partly luck.
Define what counts as a failure before scoring. For example, if a system routes a request to a fallback when its first answer is flagged, record whether the first answer failed, whether a check caught the failure, whether the fallback ran, and whether the final answer passed. Report the initial failure rate over all evaluated requests. Compute detection among failed requests by dividing detected initial failures by all initial failures. Report it as undefined if there were no initial failures, and track fallback recovery separately. Score final answers over all requests so uncaught failures and unsuccessful fallback attempts affect the result.
Question 5: Comparing systems, not parameter counts
The final question is how to compare two candidate systems. A system here means the tuple:
Parameter count helps estimate the storage needed for weights once you know their precision. Quality, latency, energy, and reliability also depend on the model and deployment configuration. Measure those quantities with the tokenizer, runtime, and workload you plan to use.
The tuple framing is the conceptual heart of the chapter. Each element is a lever that changes the behavior of the deployed system, and evaluating any single lever without the others is like measuring one gear and inferring the engine's power. Weights and quantization determine the function and its noise. The tokenizer determines how many units of work each input costs. The runtime determines how efficiently the hardware is used. The prompt policy determines whether the model is asked in a form it can handle. And the fallback determines what happens when it fails, which is a first-class part of the delivered quality. A comparison that varies only the weights holds the rest fixed and attributes all differences to the model, so it cannot isolate the effects of the choices it held fixed.
A principled comparison uses a cost-aware objective. Define, for each candidate system on slice :
- : measured quality on slice (your chosen metric).
- : measured latency (e.g., p50 and p95 completion time).
- : measured energy per request.
- is a declared reliability statistic with larger values preferred. The worked example uses accuracy on the long slice. Another option is one minus the fraction of all evaluated requests with an uncaught failure; pair that with a quality or final failure-rate requirement if detected failures can still reach users. Keep detection among initial failures as a separate diagnostic.
- : privacy posture (categorical: on-device-only, edge, cloud-with-contract, cloud-default).
A simple scalarization that makes tradeoffs explicit is:
Here, is the nonnegative weight for slice , with the weights summing to one in this example. The nonnegative coefficients and convert the selected latency statistic and energy per request to the quality score's scale. Eligibility is subject to hard constraints and . The weights , , , and the constraints encode the deployment's actual requirements. The point is not that this specific formula is correct for your situation (it rarely is exactly), but that writing it down forces you to declare what you are optimizing and what you are not willing to trade.
The structure of the formula is worth reading closely, because it encodes a decision principle. Quality is a reward that accumulates across slices, weighted by how much each slice matters. Latency and energy are penalties subtracted from the reward, with coefficients expressing how much a unit of latency or energy costs you in quality terms. The constraints sit outside the objective entirely and are checked first: a privacy posture outside the allowed set or a reliability score below the minimum disqualifies the system regardless of its objective value. This structure reflects how real deployments work, where some requirements are negotiated as soft tradeoffs and others are inviolable gates. Writing the objective down turns an argument about which model is better into an argument about which weights and constraints are right, which is a far more productive and auditable conversation.
Notice what this does to parameter count: it disappears. Parameter count is a proxy that correlates with quality, latency, and memory, but the objective uses the measured quantities directly. Suppose both systems pass the gates and use equal energy. If the 3B system has higher weighted quality and lower p95 latency, it has higher utility whenever the latency term uses p95 with a nonnegative coefficient. The proxy exists because parameter count is easy to read and available before you have hardware. Those measurements describe the system users will encounter. The whole point of an in-context evaluation is to replace the proxy with the measurement precisely when the two disagree, because that is when the proxy would have misled you.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!