AI Evals: Test and Improve Your LLM App

A small support assistant for a made-up bike shop is handed to you finished. You build what tells you whether its answers are good: you read real answers and name what goes wrong, turn that into a test set, write graders in code, add a model as a grader and check it against human labels, compare two prompt versions, and end with a gate that blocks a change that makes the answers worse. Plain Python, no eval library. Every check runs on recorded answers, so you need no key.

What this course covers

  1. Read the Answers Before You Measure: Explain why an ordinary exact-match test cannot judge an LLM app, say what an eval consists of, and review a sample of real outputs with a pass or fail judgment and a note on each.
  2. Name the Failure Modes and Count Them: Turn free review notes into a small set of defined failure modes, count them, and decide which failures deserve an automated check first.
  3. Build a Test Set: Write test cases that state the expected behaviour of an LLM app, cover each failure mode with several cases, and keep the set under version control.
  4. Write Graders in Code: Write code graders that each check one criterion, run them over the answers to a test set, read the pass rate of each, and say what code cannot judge.
  5. Use a Model as a Grader: Write a model grader for one criterion that returns a reason and a pass or fail verdict, and name the ways such a grader can be wrong.
  6. Check the Judge Against Human Labels: Measure how well a model grader agrees with human labels, improve it by reading its disagreements, and confirm the result on labels it was not tuned on.
  7. Compare Two Versions: Compare two versions of an LLM app on the same test set, read the cases that changed in each direction, and decide whether a difference is larger than run-to-run variation.
  8. Block Regressions with a Gate: Build a gate that compares a new run with the saved scores of the accepted version, fails on a real drop but not on run-to-run variation, and say what a gate should run and when its baseline moves.