Data selection
Evaluation begins before measurement. If the task, environment, and stopping rule are not pinned down, the number you report describes nothing in particular.
9.1Selection as experimental design
Every dataset is a sample, and the sample determines what you can learn. The consequence people miss is that the best sample differs by goal. To estimate how well a system performs, random sampling from the deployment distribution is correct and hard to improve on. To improve the system, random sampling is close to the worst use of a labelling budget.
The reason is arithmetic. If your agent already succeeds on eighty-five per cent of traffic, two hundred random labels yield about thirty failures — a hundred and seventy labels spent confirming things that already work. Selecting where behaviour is uncertain or failure is likely can put a hundred and twenty failures in the same budget. Same money, four times the signal about what is broken.
The catch is that the second sample is biased and cannot estimate performance. So keep two datasets with different rules. The estimation set is drawn randomly, never used for tuning, and refreshed as traffic moves. The improvement set is selected aggressively for informativeness and may be arbitrarily unrepresentative. Confusing them produces the most common measurement error in applied work: a system that improves on every internal metric while production quality stays flat.
Three axes carry value, and they are independent enough to separate. Uncertainty asks how unsure the current system is — uncertain examples sit near a decision boundary, so labelling them moves it. Representativeness asks how much of the input distribution the example stands for. Consequence asks what it costs when this case is handled wrong, an axis classical active learning omits because it assumes uniform loss. Agent systems do not: a mis-formatted summary and a deleted record are both single failures, and treating them alike is a modelling error.
| DATASET | SAMPLING RULE | USED FOR | NEVER USED FOR |
|---|---|---|---|
| Estimation set | Random from deployment | Reporting performance | Training, prompt iteration |
| Improvement set | Uncertainty × representativeness × consequence | Training and prompts | Any performance claim |
| Regression set | Every historical failure, kept | Catching reintroduced bugs | Estimating overall quality |
9.2Agreement, and what disagreement measures
Labels come from people, and people disagree. How much they disagree is the most informative number you will collect about your task, and most teams never compute it. Raw agreement is not that number, because it is inflated by chance: if ninety per cent of traffic is one class and both annotators guess it, they agree eighty-two per cent of the time while learning nothing.
Chance-corrected statistics remove that floor. Cohen's kappa compares observed agreement against the agreement expected if both annotators labelled independently according to their own marginal frequencies. A value of one is perfect, zero is chance-level, and negative values mean systematic disagreement. Krippendorff's alpha generalises this to any number of annotators, tolerates missing labels, and supports ordinal scales — which matters when your labels are quality ratings, since a four-against-five disagreement should not count the same as one-against-five.
Now the part that separates useful practice from ritual. When two annotators disagree, the standard move is a majority vote with a third. This is the wrong default. Disagreement usually measures an ambiguity in your guidelines, not a mistake by one annotator, and a vote discards that measurement. You resolve the item and learn nothing, and the same ambiguity produces disagreement on the next fifty items.
Adjudication by guideline rewrite inverts this. The annotators identify the sentence that failed to determine the answer, rewrite it so that it does, and relabel the affected items under the new rule. The procedure is slower per item and considerably faster per project, because agreement rises monotonically. It also produces a guideline precise enough to resolve real cases, which can later serve as the rubric given to a model judge. Majority voting produces no comparable artefact.
Label noise sets a ceiling that is lower than people expect. If a tenth of your labels are wrong in ways uncorrelated with the input, a perfect model measures at most ninety per cent on that set. Teams routinely spend months chasing points beneath a ceiling they never measured, when measuring it costs one careful re-annotation of a hundred items.
| AGREEMENT | INTERPRETATION | ACTION |
|---|---|---|
| Below 0.40 | The task is not well defined | Rewrite guidelines before labelling more |
| 0.40 – 0.67 | Substantial ambiguity | Adjudicate and rewrite; do not ship claims |
| 0.67 – 0.80 | Tentative conclusions only | Usable for direction, not for thresholds |
| Above 0.80 | Reliable | Usable as ground truth |
9.3Synthetic data and its failure mode
Generating examples with a model is cheap and effective within a definable boundary. It works when the generator holds a capability the target lacks, or when the output can be verified. Distillation from a stronger model is the first case; generating code accompanied by tests is the second, since the tests filter against ground truth external to the model. It works poorly when a model generates data to train itself with no external check, because the resulting set contains no information the model did not already hold.
The failure mode has a measured shape. Models trained recursively on their own outputs drift first, as low-probability events become rarer than they should be, and then collapse, as the tails vanish entirely and the distribution narrows around the model's own high-probability modes. The mechanism is sampling statistics: each generation samples finitely from the previous model, finite samples underrepresent tails, and iteration compounds the underrepresentation. Fresh real data must be injected periodically; pure recursive loops do not survive.
In an agent pipeline this looks different and is easier to miss. You generate synthetic queries to test your agent, and the generator produces queries resembling its own idea of a user query — well-formed, unambiguous, complete, phrased in the register the model itself writes in. Real users send fragments, misspell entity names, ask two questions at once, and omit the critical detail. Your test set contains none of these, so the agent is never tested against them. Evaluation looks strong and production stays broken.
The check is cheap: embed synthetic and real examples in the same space and compare the spread. If synthetic variance is materially lower, you have measured the collapse directly. Three practices keep synthetic data useful — seed from real examples rather than generating from scratch, verify externally with a check the generator did not perform, and track the real-data fraction as a first-class metric.
| SETTING | INFORMATION SOURCE | COLLAPSE RISK | REQUIRED CHECK |
|---|---|---|---|
| Distil from a stronger model | Teacher capability | Low | Teacher quality on your distribution |
| Generate code, run tests | External verifier | Low | Test coverage, not just pass rate |
| Paraphrase real examples | The real seed | Medium | Semantic drift from the seed |
| Model generates its own data | Nothing new | High | Real-data mixing ratio |
| Synthetic evaluation queries | The model's query prior | High | Embedding spread against real traffic |
9.4Documenting a dataset
A dataset without documentation is a set of numbers whose meaning decays. Six months on, nobody remembers whether labels came from contractors or engineers, which guideline version applied, or why three hundred and forty examples were dropped. The dataset keeps getting used, and every decision made from it inherits assumptions no one can check.
The questions that recur, in rough order of how often their absence causes a problem: where the examples came from, over what date range, and through what filter — “production traffic” is not an answer. What the sampling rule was, and if selected, on what criterion, since this is what tells a future reader whether the set can support a performance claim. What was excluded and why, because exclusion criteria are where selection bias hides most reliably. Who labelled, under which guideline version, with what agreement and estimated noise rate.
Two practices make documentation survive contact with a project. Version the dataset and the guidelines together, in the same commit, because a label file means something different under version one than version three. And write the sheet before collecting the data, since filling in the sampling rule and exclusion criteria in advance forces the design decisions into the open while they are still cheap to change. Written afterward, it becomes an exercise in reconstructing intentions, and reconstructed intentions are always tidier than the real ones.
This is the least glamorous material in the chapter and the highest-leverage. The most expensive failures in applied work are not modelling errors. They are decisions made confidently from a dataset that measured something other than what everyone assumed, discovered months later when the assumption finally broke.
| FIELD | BAD ANSWER | GOOD ANSWER |
|---|---|---|
| Provenance | Production logs | Chat successes, web client, a stated fortnight, no internal accounts |
| Sampling | Representative | Uniform random over 41,882 sessions, seed 7 |
| Exclusions | Cleaned | Dropped 340 under five tokens and 88 flagged; 2.3% of the pool |
| Labellers | Annotators | Three support leads, guideline v3, κ = 0.84 on 100 overlap items |
| Not for | — | Not for latency claims; excludes timeout sessions |
Build a small but diagnostic benchmark
Construct twenty tasks that separate retrieval failure from generation failure. For each task, state the four-tuple explicitly. Then attempt to game your own scorer, and report which of your tasks a lazy system could pass without doing the work.