LLM Evals in Plain Python: How to Know if a Prompt Change Actually Helped

Short answerWrite the task down as a contract, agree on which errors would block a release before you run anything, build a test set you keep closed, grade everything code can grade, use an LLM judge only where you must (and check it against people), compare versions on the same items with intervals, and report the answer with its limits. None of it needs a framework.

On Hacker News this year one comment put the whole problem in a sentence: the vibes are not enough; define what correct means, then measure. Hamel Husain's widely shared evals FAQ is blunter about the industry habit of reaching for generic scores: generic evaluations waste time and create false confidence.

Here is the shape of an evaluation that answers the only question your manager or client actually asks: did this change help enough to ship?

1. Write the task down as a contract

What goes in, what must come out, in what format. If the output is structured, say exactly which fields and which values are allowed. A model that writes a friendly sentence before the JSON has failed the contract, even if the JSON is right.

2. Decide what each mistake costs, before you look

Missing an emergency is not the same as mislabeling a routine request. Write the gates first: for example, zero missed emergencies, and overall accuracy at least as good as the current version. Writing them after you see the results is how teams talk themselves into shipping.

3. Build a test set and keep it closed

Write realistic inputs, including borderline cases on purpose. Split them: a development set you may look at while writing prompts, and a test set you only run at the end. Version the file like code.

4. Grade with code first

Structure, allowed values, exact fields: code can grade these, cheaply and identically every time. Keep the expensive, wobbly judgment calls for what code cannot check.

5. Compare versions fairly

Run both versions on the same items. A raw score difference on a small set is often noise. Look at the interval around each score, and when the items are paired, use a paired test on the items that changed. Try it with your own numbers:

Did-It-Help Calculator

From Did the Change Actually Help? · 95% Wilson intervals and an exact McNemar test

6. Read the regression, not just the total

A new version can score higher overall and still fail a release gate, because it fixed many easy items and broke one expensive one. That is why the gates come first.

7. Report it so a non-engineer can decide

Answer first, in one sentence. Then the evidence, the cost and latency, and the limits: what a test set this size can and cannot prove.

All of this fits in a small amount of standard-library Python. You do not need a platform to start; you need a contract, a closed set and the discipline to set gates before you look.

Sources: Hacker News comment, March 2026 (news.ycombinator.com/item?id=47286049); Hamel Husain and Shreya Shankar, “Evals FAQ”, September 2026 (hamel.dev).

The Operator Library · 5 field manuals · $29.99 eachFind your book →