Why and How to Evaluate LLM Apps
Evals are the unit tests of AI engineering; learn what to measure, which graders to use and how evals drive every decision.
Intermediate · about 5 hours · difficulty 3/5
Learn first: Prompt Templates, Versioning and Iteration
LLM outputs are non-deterministic and open-ended, so "it looked fine when I tried it" is not evidence. An eval is a repeatable measurement: a set of inputs, the outputs your system produces, and a way to score them. Teams that ship reliable AI products are almost always the ones with good evals.
What evals let you do
- Compare prompts, models and retrieval settings with numbers rather than vibes.
- Catch regressions when a prompt, dependency or model version changes.
- Decide whether a cheaper or faster model is good enough.
- Know when you are done iterating.
Types of graders
- Code-based checks: exact match, regex, JSON schema validity, "contains the order id", length limits, whether the right tool was called. Fast, cheap and objective; use them wherever possible.
- Model-based graders (LLM-as-judge): another model scores against a rubric. Great for tone, helpfulness and faithfulness, but they need calibration.
- Human review: the gold standard for nuanced quality, used to build and check the other two.
Start small
Begin with 20 to 50 realistic examples, including hard and adversarial ones, before you optimize anything. Read the outputs yourself. Error analysis (grouping failures into categories) tells you what to fix and which metrics to add.
Good enough to move on
You can explain the difference between code, model and human graders, and you have an eval script that runs your app over 30 examples and prints a score per example and overall.
Key concepts
- Why vibe checks fail
- Code-based graders
- Model-based graders
- Human review
- Error analysis and failure categories
- Choosing metrics per use case
Mini project
Write an eval harness for a ticket classification prompt: 40 labelled tickets, exact-match accuracy, a confusion table, and a report comparing two prompt versions.
Check yourself
Your summarizer scores 92% on an LLM judge but users complain. What would you check first?
Free resources
- Anthropic docs: define success criteria and build evaluations (Anthropic)
- OpenAI docs: evals (OpenAI)
- Hamel Husain: Your AI product needs evals (hamel.dev)