· Abhishek Srivastava

Evaluation is the new testing: build the golden set before the prompt

From Architecting for AI: accuracy belongs to your system, not the model. Why the golden set and the evaluation gate should exist before the first prompt.

  • Architecting for AI
  • Generative AI
  • AI Evaluation

Picture a one-line change. Users say the assistant’s answers are too long, so an engineer adds “be concise” to the system prompt, tries the three example questions everyone always tries, sees shorter answers, and merges. Nobody has done anything wrong. There was no test to fail.

Weeks later, someone notices that dates pulled from agreements have been coming back as bare years, and a downstream job has been quietly rejecting records ever since. The model was asked to be concise, and it was concise about dates. Fixing it takes an hour. Noticing took weeks.

Most teams running a model in production have a story like this. The cause is rarely carelessness: the delivery method we inherited has a place for tests and no place for evaluation. Chapter 7 of Architecting for AI is about that gap. This article is the short version.

The myth: accuracy is the model’s problem

Every vendor has the slide: a bar chart of benchmarks with their model a little taller than the rest. It invites a conclusion: accuracy is a property of the model, you buy it by picking the tallest bar, and if answers are wrong, the fix is a better model.

The benchmark did not use your documents or your users’ questions. Your system has a different prompt, a retrieval step the benchmark never saw, and a context window full of your data. The vendor’s number says something about the model and almost nothing about your system on your task, which is the only accuracy the business will ever ask about.

Accuracy is a property of the system, not the model. That makes it an architecture concern, not a procurement one.

Four places an error comes from

A conventional test asserts an exact result, and a model does not give the same output for the same input. What replaces the test starts with knowing where errors come from, because the fix is different for each.

  • Retrieval. The right passage was not found, or the wrong one was. The model answered faithfully about the wrong text. You can measure this with no model involved: for a known question, does the known source appear near the top?
  • Context. The right passage was found, but the model got too much, too little, the wrong order, a missing glossary, or contradictory instructions.
  • Prompt. The instructions themselves. “Be concise” lives here. A system prompt changes behaviour, gets edited by several people, and has no tests unless someone writes them.
  • Model. Everything else was right and the model still invented a figure or ignored an instruction. This is the only one of the four that is genuinely the model’s problem, and once the other three are measured it is usually the smallest.

A team that cannot tell these apart blames the model for all of them, switches vendors, and gets the same errors back under a different logo. Check them in that order, and make “hallucination” the last diagnosis, not the first. The opening story was not a hallucination. It was a prompt regression.

The golden set comes first

A golden set is a list of inputs with known correct outputs: the answer key. For extraction, a document and the fields it should yield. For retrieval, a question and the page that answers it. For generation, a question, a reference answer, and a rubric for what a good answer must and must not contain.

Three rules make a golden set useful.

  1. The users write it. Not the engineers, and not the model. The people who ask the real questions know which ones matter and what a wrong answer costs.
  2. It includes the hard cases on purpose. The bad scan, the amended agreement, the question the documents cannot answer, the question that looks like a different one. A set of easy questions produces a comfortable number and nothing else.
  3. It is versioned and owned. It lives next to the code, and someone’s name is on it.

A few hundred items is usually enough to start. The book puts the cost at about two afternoons with the people who will use the system. It is the cheapest piece of the architecture and, in most teams, the last one built.

Score every change, and look at every item

With a golden set in place, every change can be scored before it ships: a prompt edit, a new model version, a retrieval tweak, a different chunk size. Had “be concise” been a pull request that ran the set, the date problem would have shown up before the merge, on the screen of the person making the change.

There is no single number, which is where teams get stuck. The metric depends on the task:

  • Extraction: accuracy per field, weighted towards the fields that matter.
  • Retrieval: whether the right passage is in the top few results.
  • Classification: precision and recall, and a business decision on which matters more.
  • Generation: a rubric. Does the answer contain the required facts, cite its source, avoid what it must not say, stay within length?
  • All of them: abstention rate. How often the system said it could not answer, and whether it was right to.

Cost and latency belong in the same report. A prompt change that lifts the rubric score and doubles the cost per call is a trade, not an improvement.

A model can act as judge for rubric scoring, but a judge is also a model. Trust it only as far as it agrees with people on a scored sample, and re-check when the task changes. In the chapter’s words, “A judge nobody has calibrated is the vendor’s slide again, one level up.”

Put the gate in the pipeline

The evaluation run belongs in the same delivery pipeline as the unit tests and the security scan. A change to a prompt, model version, retrieval setting or the golden set itself triggers a run, the run produces a report, a written threshold decides whether the change proceeds, and a person reads whatever got worse.

The threshold that works is not “the score went up”. It is closer to this: no item that was right is now wrong unless a reviewer has written down why that is acceptable. Averages can rise while one class of document quietly collapses. The per-item diff shows it; the average hides it.

In the chapter’s second story, a vendor’s new model beats the old one on every public benchmark. On the team’s golden set it is better on most items and worse on one document class, where it summarises a clause it was asked to quote. The gate catches it before production. A model upgrade goes through the same gate as a prompt change. There is no fast lane for the vendor.

Two habits make the gate meaningful. Prompts are code: they live in the repository, change through reviewed pull requests, and every production call logs the prompt version next to the model version. And the parts that are not the model still get ordinary tests: parsers, validators and context builders are unit-tested, with the model replaced by a recorded response in integration tests.

Production feeds the set

Offline evaluation covers the questions you thought of. Production covers the rest. Score a sample of real traffic every week and track the number, because that is how you see drift. Treat every thumbs-down, corrected field and support ticket as a candidate golden item. Put alarms on abstention rate, cost and latency.

Someone has to own this: on a small platform, about a day a week of the architect’s time; on a large one, a role of its own, and the book argues it is the best-value hire in an AI programme.

Hallucination is a rate, not a bug

A model that generates text will, at some rate, generate text that is not true. You cannot eliminate that. You can measure the rate, drive it down with grounding, abstention and validation against the source, and keep a person in the path where a wrong answer is expensive.

What to do differently

The most common mistake is building evaluation after launch, because the demo worked and evaluation looked like something to do once the real work was done. The book’s last story ends with the first run of a late golden set revealing a document class the system had been getting wrong since launch.

The lesson is about order. Write the golden set before the prompt, and put the gate in the pipeline on the day the first prompt is merged. Or, as the book puts it: “Golden set first. Everything else can wait a fortnight.”

For the wider argument, read Architecting for AI: what changes, and what still holds. The full chapter, with its checklist and an evaluation appendix you can run before every release, is in the book.