ELLMEngineering Large
Language Models
Download PDF

Chapter 07

Evaluating a Change to the System

On this page

Evaluation tests a design claim using defined tasks, controlled comparisons, and estimates of uncertainty. Its methods apply across systems; the meaning of success comes from the task.

Make a claim that can be tested

Name the change and its expected effect. A larger batch may improve throughput while increasing waiting; a longer input may supply needed information while consuming more state. Measure both the intended benefit and the costs predicted by the mechanism.

Consider a report summarizer whose baseline accepts the first 4,000 tokens of each report. A proposed version accepts up to 8,000, using the same model with room for instructions and output. We expect better coverage of facts appearing late in a report. Chapters 5 and 6 predict the cost: more prompt processing and, for the same full-attention decoder, more retained state.

Keep the reports, instructions, output budget, model, tokenizer, decoding settings, and server configuration fixed. Only the input limit should differ. For stochastic generation, use repetitions to assess sampling variation. This is a hypothetical experiment, not a reported benchmark.

Define success at the task boundary

Success depends on the task: a summary must preserve required facts, extracted values must agree with their source, and code must implement the specification. Fluency alone establishes none of these.

Task Outcome checks Diagnostic checks
Summarization Required facts preserved; claims faithful to the report Was the missing fact present in the supplied input?
Structured extraction Required fields and values correct Did parsing fail, or did interpretation fail?
Code generation Required behavior demonstrated by tests and review Did the result parse, build, and pass each relevant test?
Document question answering Answer correct and supported by permitted sources Was the evidence retrieved, and does the citation support the claim?

Diagnostic checks do not substitute for outcomes. A citation can exist without supporting its claim, as Part VI's documentation-assistant case study demonstrates. A program can pass weak tests without satisfying its specification. Keep intermediate checks separate from task success.

For summarization, define required facts and acceptable omissions before inspecting outputs. Record unsupported claims separately from missing facts. Also measure completion time, memory, cost, rejections, and failed attempts. Extra speed cannot compensate for an output the task forbids.

Choose examples that can change the decision

Short reports give the longer limit little opportunity to help. Testing only long reports would exaggerate its benefit for a service that usually receives short ones. Include a representative workload and enough cases to examine the proposed mechanism.

Report the overall result and the relevant subsets, often called slices. Here, report length and the position of required facts are useful slices. In code generation, language and task type may matter instead. Preserve withheld cases for confirmation after choosing a configuration; repeatedly tuning on the same set turns it into development data.

Adversarial and boundary tests serve a different purpose from representative traffic. A report containing contradictory dates, for example, can reveal an interpretation failure. Such cases are deliberately selected to expose a weakness. Report them separately rather than treating their frequency in a manufactured test set as their frequency in production.

Compare paired outcomes

Run both configurations on the same tasks. For each report, record whether both summaries succeed, only the candidate succeeds, only the baseline succeeds, or neither succeeds under the defined rubric. The disagreements show what changed, while shared failures may reveal a limitation neither configuration addresses.

Suppose an illustrative set contains 100 independent tasks. The candidate alone succeeds on 15, the baseline alone on five, and their outcomes agree on the other 80. These are invented outcomes to demonstrate the calculation. Assign paired differences of +1, -1, and 0 respectively. The mean improvement is ten percentage points.

That estimate still has uncertainty. The sample standard deviation of those differences is sqrt((20 - 100*0.10²)/99), approximately 0.438. Dividing by sqrt(100) gives a standard error of about 0.0438. A rough normal 95% interval is therefore 0.10 ± 1.96*0.0438, or approximately 1.4 to 18.6 percentage points. It supports a possible gain but does not yet establish that the gain exceeds five points.

This calculation assumes independent tasks and uses an approximation that can be poor for small or highly unbalanced samples. Several versions of one report are not necessarily independent tasks. If cases share a user, repository, or document family, use an analysis or resampling unit that reflects that dependence. Repeating the same ten cases 100 times can measure timing or generation variation, but it does not create 1,000 independent task examples.

Zero observed failures also needs a denominator. With independent trials and a fixed failure probability p, the probability of zero failures in n trials is (1-p)^n. Setting this to 0.05 yields the one-sided 95% upper confidence limit 1-0.05^(1/n), approximately 3/n for large n. Three hundred clean trials therefore leave an upper limit of about 1%, not zero. The NIST exact binomial reference gives the formal definition. This bound says nothing about an untested population or a detector that misses failures.

Measure the complete execution path

Model time alone is insufficient for a system claim. Input preparation, admission, generation, output checks, and any tool execution contribute to completion. For an interactive interface, measure time to first token, gaps between streamed tokens, and time to the usable result from a stated client boundary. For an offline job, measure collection completion time and useful throughput as well as individual task times.

Replay under load as well as in isolation. A closed-loop client waits for a response before sending its next request. When the service slows, such a client offers less work. That can represent sequential human clients, but it can hide a queue that would form under externally scheduled arrivals. An open-loop generator schedules arrivals independently of completions and must record rejections and failures too. Choose the arrival model that matches the claim.

In the summarization example, extra context may add modest compute time to an isolated request yet reduce concurrent capacity enough to increase waiting under load. That is the connection between the cache ledger and service latency. Results broken down by input length and load help separate a configuration change from a change in the request mix.

Inspect the evaluator

Some properties can be checked mechanically: a record parses, a cited source exists, or generated code passes a test. More open-ended properties require judgment. In summarization, exact wording need not match a reference summary, and a faithful sentence can still omit the most important fact. A rubric should distinguish factual support, coverage, and any required format. Preserve disagreements so the rubric can be examined.

An LLM judge does not make this measurement problem disappear. The MT-Bench judge study documents position, verbosity, and self-enhancement biases in its evaluated setting. A summary judge needs the source report, task requirements, and candidate summary. Hide system identity, vary comparison order, and calibrate against held-out expert judgments, including polished but wrong outputs. A convincing explanation of a verdict is not independent evidence that the verdict is correct.

Decide what the result warrants

Before running the comparison, state the minimum useful quality gain, the tolerated latency and cost, and the failures that block deployment. There is no universal choice for those thresholds. A draft suggestion that a person reviews and a record written automatically into another system need different acceptance conditions.

If longer inputs improve summaries of long reports but violate the interactive latency requirement, the evidence supports a narrower decision than “increase the limit everywhere.” We might test routing long reports to a separate queue or processing them offline. If required facts were already present and still omitted, the result does not support another input-length increase. Inspect the instructions, model behavior, and evaluation rubric instead.

Two configurations sharing a queue or cache can affect one another, so a production comparison also needs an assignment strategy that accounts for that interference. Parts III and VII develop those experiments. Evidence for a mechanism is only one part of a deployment decision.

Exercises and worked answers

  1. An 8,000-token input includes a required fact, but the summary still omits it. What should you examine next? The model's use of the supplied text, the instructions, and the evaluation rubric. Increasing the input limit again does not address a fact that is already present.
  2. Why can a faster kernel leave first-token latency unchanged? It may occupy little of the critical path, or its saving may be offset by input preparation, waiting, transfers, or other execution costs. Measure those intervals separately.
  3. Do 300 repetitions of one successful task demonstrate a failure rate below 1%? No. They do not supply 300 independent representative tasks, and behavior on other inputs is untested.
  4. What would justify publishing a throughput gain? Matched workload and behavior, stated timing and quality requirements, accounting for failed and rejected work, repeated measurements, and a result large enough to matter under those conditions.

From foundations to a training recipe

We can now describe model computation, estimate its resources, and test whether a change helps. Part II uses that foundation to design a training program: choose the examples, objectives, and update schedule that can produce useful weights within a budget.