Skip to content
Engineering Bible
AI Engineering

AI Engineering on evals

Evals are the tests of AI apps

  • An eval is a set of inputs plus a way to judge the answers.
  • Run it on every prompt, model or data change to see what broke.
  • Without evals, every change is a guess.
  1. Changeprompt, model or data
  2. Run the eval setreal examples
  3. Scorecode checks + judge
  4. Better than last version?
Yes: ship. No: fix, then run it again.

Build the set from real failures

  • Start with a few dozen real examples, not thousands of invented ones.
  • Add every failure you see in production, so it can't quietly return.
  • Cover the edge cases: empty input, other languages, tricky requests.

Score with code when you can

  • Code checks are cheap and exact: valid JSON, the right number, tests pass.
  • Use them first, for everything they can cover.
  • Example: does the reply parse, and does every citation point to a real source?

Use a model as judge for the rest

  • For open-ended answers, a second model grades them against a rubric.
  • Judges are often steadier at picking the better of two answers than scoring one.
  • Check them against human grades. They have biases, like favoring long answers.

Grade RAG in two parts

  • Retrieval: did the right chunks come back?
  • Generation: does the answer stick to those chunks and answer the question?

Keep evaluating in production

  • Log every call: input, output, cost and latency.
  • Watch cost and speed per request, not just quality.
  • Collect user signals like thumbs up or down, edits and retries.
  • Guardrails check inputs and outputs live, and block or retry on failure.
AI Engineering in five pages4 / 5