Course map
Stage 1: Foundations
Stage 2: Machine Learning
Stage 3: Deep Learning
Stage 4: LLMs & Generative AI
Stage 5: Production & Specialization

Part 15 / Topic 6 of 6

Evals

The only reliable answer to "did my prompt change help?" is a labelled test set and a score:

# examples/02_an_eval_harness_score_any_classifier.py (abridged)
def evaluate(classify, cases):
    results = [(text, want, classify(text)) for text, want in cases]
    for text, want, got in results:
        if got != want:
            print(f"MISS: {text!r} expected={want} got={got}")
    return sum(w == g for _, w, g in results) / len(results)

# MISS: 'Do you sell gift cards?' expected=other got=payment
# accuracy: 0.833

The harness is model-agnostic — it scores any function from text to label (here a keyword stand-in, so the example runs offline; swap in a messages.parse call and nothing else changes). The workflow: collect real cases, label them, score prompt A, score prompt B, keep the winner, and keep the misses visible — the MISS lines are where the next improvement comes from. That workflow is this part's mini-project, and in Track A it becomes a CI gate.

🧪 Quick quiz

  1. What is the most reliable way to know whether a prompt change helped?
Show the answer

Run it on a labelled eval set and compare scores — the harness scored the stand-in classifier at 0.833 and printed the one miss.

Done here? The practice set for Part 15 — 4 exercises with solutions — is on the part page.

Search the guide