Evaluation Harness

Evals · LLM como juez

Escrito por Darjus Kazakevic · revisado el

Without fixed test cases, you are not improving a prompt — only changing it.

Change a function and the tests go red within seconds. Change a prompt and nothing tells you anything. You read three outputs, they look fine, and you ship. The bug appears a week later, in a kind of input you never tried.

An evaluation harness, or eval suite, fixes this. It is a set of cases with known-good behaviour, rerun after every change to a prompt, model, tool description or retrieval setting. Much of it is checkable in code: the right tool, valid JSON, a correct amount, a refusal. Use a judging model only for what code cannot check.

En esencia — A model has no compiler, so you must build its regression suite yourself. Until you do, every change is an unmeasured trade.

Cuándo recurrir a él

Recurre a él cuando

  • A model-backed feature goes to production and will keep changing
  • Several people edit prompts, and nobody can track all the behaviour
  • Your provider updates the models you depend on

Reconsidéralo cuando

  • A true one-off with no changes ahead
  • The task itself still changes every week
  • Nobody can state any criteria for a good result, even loosely

The parts

The case set (The golden set)
Inputs paired with what should happen. The best ones come from real failures. Twenty real cases where the system was wrong are worth more than five hundred invented ones that look like the easy path.
The scorer
How a case is judged. In order of preference: an assertion in code, a model judging against a rubric, a person. Move every case you can up that list.
The baseline
The scores of the version you ship today. Without it, a number means nothing: 82% is neither good nor bad until you know the old version scored 79%, and which cases moved.
The gate
What the suite blocks: a prompt change that breaks a passing case, or a model upgrade that quietly changes behaviour. This turns numbers into a real control on what ships.

Reglas de diseño

Start with twenty real failures
Take the last twenty things the system got wrong and write down what should have happened. Add a case the day you find each new bug. Invented sets made up front mostly test the easy path.
Assert before you judge
Tool chosen, schema valid, refusal present, citation retrieved, number correct: all checkable in code, in milliseconds and at no cost. Move every case you can from a judging model to an assertion.
Give the judge a rubric, then check the judge
“Rate this 1–10” gives noise around 7. Give clear levels with an example of each. Then compare the judge with a few dozen human labels: judges favour long answers and their own wording.
Compare each case against a baseline
An average can rise while an important case breaks. Report which cases newly fail, plus cost and latency. Run the suite on every prompt change and on every model upgrade.

Errores habituales

  • Only average scores, which hide a regression under a better mean.
  • A judging model never checked against human labels.
  • A suite too slow or costly to run on every change, so nobody runs it.
  • Judging with the same model and prompt that wrote the answer.