← All posts

Model development

Post 24 of 26

Evaluating an application: test sets, judges, error bars, feedback and security

Posts in this series · 26

Every earlier post in this track relied on an evaluation set: to choose a model, to check a prompt change, to measure retrieval, to decide whether fine-tuning helped. This post is about building that evaluation well and keeping it honest after the application is in users’ hands. It parallels the post-training evaluation post, seen from the application side.

What to evaluate

Start from the question the evaluation must answer. CS336’s evaluation lecture is blunt that there is no single true evaluation: a company choosing between two models, a researcher measuring capability and a developer looking for failures need different ones (CS336 lecture 12). For an application, the question is usually: does it do the job for our users, at acceptable cost, without causing harm?

A useful test set has four properties:

Measure components as well as the whole: retrieval recall, tool-call correctness, final-answer quality. When the end result fails, component metrics say where.

Models as judges

Many outputs cannot be checked by a program: is this summary faithful, is this reply helpful? Human grading is reliable but slow. A strong model can grade instead. Zheng et al. found that GPT-4 as a judge agreed with human preferences over 80% of the time, the same level at which humans agreed with each other, and documented its biases: position (favouring the answer shown first), verbosity (favouring longer answers) and self-enhancement (favouring its own outputs) (Zheng et al., 2023, abstract).

Each bias has a standard correction:

Validate the judge itself: have people grade a sample, and measure how often the judge agrees with them before trusting it on thousands of items.

How sure are you?

A score on a test set is an estimate. Two systems should be compared on the same items, because what matters is where they disagree.

Try it: is B really worse? Systems A and B answer the same 200 items. A is right on 170 (85%), B on 160 (80%). They agree on 170 items (150 both right, 20 both wrong) and disagree on 30: A alone is right on 20, B alone on 10. Is A better?

Answer. Only the 30 disagreements carry information about which is better. If the systems were equally good, each disagreement would favour A or B like a coin flip; getting 20 or more of 30 one way happens with probability about 0.099 (two-sided exact sign test). A bootstrap interval for the difference in accuracy runs from 0 to about +10.5 points. The evidence leans towards A but is not convincing; a 5-point gap on 200 items is within what chance produces. If the same 2-to-1 pattern held over 90 disagreements, the probability would fall to 0.002. Collect more items, or examine the disagreements to see whether they share a cause.

As a rule of thumb, a 95% interval for a single accuracy near 85% on nn items is about ±20.85×0.15/n\pm 2\sqrt{0.85 \times 0.15/n}: ±5 points at 200 items, ±1.6 at 2,000. Paired comparisons are much more sensitive than comparing two separate intervals.

After release: production feedback

The test set is a snapshot; users keep changing. Production adds information the test set cannot:

Security and privacy

Retrieval and tools connect a model to content and actions outside the prompt, and that connection is an attack surface.

Prompt injection. A model reads instructions and data in the same stream of tokens and cannot reliably tell them apart. Greshake et al. showed indirect prompt injection: an attacker places instructions in content the application will retrieve, a web page, an email, a document, and the model follows them, with consequences ranging from manipulated answers to data theft and unauthorized tool calls. They demonstrated it against real systems and noted that effective mitigations were lacking (Greshake et al., 2023, abstract). There is still no complete fix, so systems limit the damage:

Privacy. Logs, retrieved documents and fine-tuning data may contain personal or confidential information. Minimize what is logged, control who can retrieve what (retrieval should respect the same access rules as the documents themselves), keep personal data out of fine-tuning sets unless there is a clear basis for it, and remember that a model can repeat what was in its context or training data. Evaluation itself must be designed with this in mind: realistic test data is the most valuable, and the most sensitive.

Everyday picture: a new employee on probation. You check their work on real cases, compare them fairly with the previous employee on the same cases, keep reviewing after probation ends, and never give them the keys to everything because a stranger’s letter told them to ask for them.

What to remember

Sources

Further reading