All posts

"Evals: the missing test suite for AI features"

Most teams would never merge code without tests, yet ship prompt changes with no safety net at all. A practical guide to building an eval suite: golden sets from real traffic, field-level precision and recall, and a CI gate that fails the build on regression.

AI engineering4 min read10 July 2026by Ahmed
"Evals: the missing test suite for AI features"

Somewhere on your team, someone changed a prompt last week. Maybe they added a clarifying sentence, tightened the output format, or swapped the model version to save money. How do you know it didn't make something worse? If the honest answer is "we ran it a few times and it looked fine", you are shipping blind, the exact thing your team would never tolerate from ordinary code.

That asymmetry is worth sitting with. The same engineering organisation that demands review and a green CI run to rename a variable will let a prompt edit, which changes the behaviour of a production feature in ways nobody fully predicts, go out on vibes. It is not carelessness. Model outputs feel unquantifiable, so teams quietly conclude that testing them is impossible and stop trying.

It is not impossible. The discipline is called evals, and for most business AI features it is more tractable than people expect, because most business AI features produce structured output. If your feature extracts fields from a document, classifies a ticket, or routes an email, the output is a JSON object, and JSON objects can be checked exactly. You do not need a philosophy of machine intelligence to assert that the invoice total should be 1,842.50 and the currency should be GBP.

"Evals: the missing test suite for AI features"

The starting point is a golden set: real inputs from production traffic, paired with the outputs a competent human agrees are correct. Do not wait until you can build a beautiful thousand-example benchmark, you never will. Start with 20 to 50 examples covering your common cases and your known ugly ones, version the set alongside your code, and commit to one rule: every production failure becomes a new golden example. That rule quietly turns your incident history into your test suite. Six months in, your eval set is a concentrated archive of every way your system has ever embarrassed you, and nothing that once broke can silently break again.

Scoring should be as exact as the output allows. For structured extraction, compare field by field and compute precision and recall per field, not one blended score for the whole document. A blended score hides exactly what you need to see: that your prompt change improved date parsing but broke amount extraction on one supplier's layout. Field-level numbers turn "the eval went down a bit" into "line-item VAT regressed on scanned documents", which is something an engineer can actually act on.

Then make it a gate, not a dashboard. Pick a threshold, wire the eval run into CI so it triggers on every pull request that touches a prompt, a model setting, or the extraction schema, and fail the build when the score drops. This is the step most teams skip, and it is the one that changes behaviour. A dashboard gets glanced at after the incident; a failing build stops the regression before it ships. My public repo, github.com/afareed007/docextract, is a small working example: a document extraction agent built with LangGraph, FastAPI and Pydantic, whose golden-document evals compute per-field precision and recall and fail CI below threshold, exactly as a broken unit test would.

Once the gate exists, run it on every change to the model boundary: prompt edits, model version bumps, temperature changes, provider swaps. Model migrations stop being leaps of faith, when a provider deprecates the model you depend on, and every provider eventually does, "can we move?" becomes an afternoon of running the suite against the candidate rather than a month of anxiety. The gate changes who can work on the system, too. On teams I have led, it is what lets a developer new to AI features edit a production prompt with the same confidence as a senior, because the suite catches what their intuition cannot yet.

Two honest caveats. First, not everything is structured, and for free-text outputs teams reach for LLM-as-judge, using a model to grade another model's answers. It is useful, and I use it, but treat it as an instrument that needs calibrating, not an oracle. Its failure modes are well documented in the research: judges tend to favour whichever answer they see first, prefer longer answers regardless of quality, and rate outputs from their own model family more generously. Randomise answer order, spot-check the judge against a sample of human labels, and prefer exact and structural checks wherever you can get them.

Second, an eval suite is a floor, not a proof. Passing 50 golden examples means you have not regressed on the cases you know about; it says nothing about the input distribution shifting under you next quarter. You still need production monitoring and a human regularly sampling real outputs. Evals do not replace that, they make sure that what you have already fixed stays fixed, which in practice is where most of the pain was coming from anyway.

If your team is shipping prompt changes with fingers crossed, building the eval harness, golden set, field-level scoring, CI gate, is exactly the work I do. Get in touch via the contact form.

Senior engineering roles — or production AI consulting?

I'm open to senior AI and software engineering roles and to selective consulting on agents, RAG, and LLM automation in production. If this post resonates — as a hiring manager or as someone shipping similar work — get in touch.

Get in touch

© 2026 Ahmed Fareed. All rights reserved.

LOADING