Skip to chapter content
navan✳THE BUILD LABAI ENGINEERING / GUIDE
0/21 read
CHAPTER 06 / 21 · EVIDENCE AND EVALUATION

Build evidence from representative cases.

Learn how evaluation sets, labels, rubrics, slices, and holdouts reveal real application quality.

BY NAVAN SAMILONG READTHEORY FIRST
01 / FROM THE BEGINNING

Start with the meaning.

Evaluation is the process of comparing system behavior with what the task requires. An evaluation set contains representative inputs and some way to judge the outputs. It can include reference answers, expected source documents, allowed categories, or a rubric for human reviewers. The set should include ordinary cases, difficult cases, and cases the system must decline.

A small set can be useful if its cases are chosen deliberately. A hundred near-duplicate easy questions may hide a serious failure on multilingual requests or outdated policy. Group cases into slices such as short questions, ambiguous questions, missing evidence, and sensitive content. Reporting one average score can conceal a weak slice that matters most to users.

02 / THE SYSTEM

How the idea works.

Evaluation data must be separate from the material used to tune prompts or choose a model. If you repeatedly inspect the same examples and adjust the system to pass them, the score becomes optimistic. Keep a holdout set for a later decision. When the task changes, update the set and record why. A test set is a record of the intended behavior, not a permanent monument.

Some outputs have an exact answer. A router's category can be compared directly with a label. Many generated answers allow several valid wordings, so exact string matching is too strict. A rubric can ask whether the answer is supported by evidence, covers required points, avoids unsupported claims, and follows the requested format. Reviewers need examples of pass and fail to apply the rubric consistently.

Human labels can disagree. That disagreement is information: the task may be ambiguous or the rubric unclear. Resolve important disagreements by clarifying the requirement rather than forcing a single label without discussion. Save the input, expected behavior, source version, reviewer decision, and model output. This makes failures inspectable.

A holdout set is valuable because it resists accidental coaching. Developers naturally inspect failed cases and edit the prompt until those examples pass. Those edited cases become regression examples: they verify a known fix. They no longer provide an unbiased estimate of performance on unseen cases. Keep another set for the final comparison, and refresh it when the real task changes. This is the same basic idea as separating training and test data in machine learning.

Slices should represent meaningful user situations, not arbitrary labels added for decoration. A support assistant might separate common questions, policy conflicts, multilingual input, missing documents, and requests that require a human decision. Report both the score and the number of examples per slice. A perfect score on two rare cases is weak evidence; a serious failure in those cases may still deserve attention if the harm is high.

01ContractExpected behavior02CasesRoutine and hard03ChecksDistinct properties04DiagnosisFind weak slices
Measure behavior on representative cases and inspect failures by slice.
03 / PYTHON, EXPLAINED

Follow the code.

evaluation-data.py
cases = [
    {"question": "How do I reset access?", "expected_source": "access-04", "slice": "routine"},
    {"question": "What is the unpublished policy?", "expected_source": None, "slice": "decline"},
]

def citation_pass(case, result):
    expected = case["expected_source"]
    if expected is None:
        return result["status"] == "declined"
    return expected in result.get("sources", [])

Each case carries both an expected source and a slice. The first should cite a known approved document; the second should decline because no permitted evidence exists. The function checks one narrow property. It does not judge whether the answer accurately describes the cited document, so it must be combined with content review.

The named slice lets a report show separate pass rates for routine and decline cases. This matters because a system can improve its overall score by answering more often while becoming worse at refusing unsupported requests.

04 / THE BOUNDARY

What the result does not say.

Do not place real private customer data in a shared evaluation set without a data handling plan. Redacted or synthetic cases can test many behaviors, while tightly controlled real cases may be necessary to understand the actual distribution.

An evaluation set is useful only when someone acts on it. Connect failures to a fix: better evidence, a narrower workflow, a different model, clearer instructions, or a product-level fallback.

05 / KEEP THIS

One clear idea.

Representative, versioned cases make quality visible beyond a polished demo.

THE CODE IN CONTEXT

The AI cookbook

Complete, explained local workflows sit alongside this reading course.

Browse the cookbook
Finished reading?
Built with curiosity. By Navan Sami. ↗AI engineering · From model calls to reliable systems.