Lesson · ⏱ 8 min read

πŸ§ͺ Evaluating AI: how to know it actually works

EnglishHinglish

🏠 Real-life example

A restaurant doesn't judge a new dish by the chef's opinion alone. They run tasting sessions with a fixed checklist (taste, temperature, presentation) across many plates. Evals are tasting sessions for AI: a fixed set of real questions with clear scoring, run every time you change the prompt or model.

πŸ’‘ In simple words

LLM outputs vary, so 'it looked good in a demo' isn't evidence. Build an eval set: 30 to a few hundred real inputs with expected answers or grading rules. Score them automatically where you can (exact match, contains the right citation, valid JSON), use an LLM-as-judge with a clear rubric for open-ended quality, and spot-check by hand. Track the score on every change, like unit tests for AI. For agents, measure task success rate, steps and cost. Evals are what separate production AI engineers from demo builders.

πŸͺœ Step by step

  1. Write down what good means for your feature, with examples of good and bad outputs.
  2. Collect 50 to 200 real inputs: common cases, edge cases and past failures.
  3. Choose how to score each: code checks where possible (valid JSON, right category), a rubric for open answers.
  4. Use an LLM judge for the rubric only after checking it agrees with human ratings on a sample.
  5. Run the eval on every prompt or model change, track the score over time, and add every new production failure to the set.

πŸ”‘ Key terms

Eval set
A fixed collection of test inputs with expected results.
LLM-as-judge
Using an LLM with a rubric to grade another model's answers.
Regression
Here: a change that makes previously good answers worse.

πŸ‘€ See it in action

text
Eval set: 50 real HR questions
Check 1: answer cites a source            β†’ 47/50 βœ…
Check 2: judge rubric 'correct & complete' β†’ 42/50
Check 3: says 'not found' when it should   β†’ 5/6
Prompt v2 β†’ v3: 42 β†’ 46 correct. Ship v3 πŸš€

Numbers, not vibes, decide whether a change ships.

⚠️ Common mistakes to avoid

  • Testing by trying a few prompts by hand ('vibe checks'). It misses regressions you didn't think to try.
  • An eval set made only of easy examples. Include the tricky and adversarial ones.

βœ… Quick check

You changed the prompt and a few answers you tried look better. What next?

  1. Ship it immediately
  2. Ask the model whether it improved
  3. Run the full eval set and compare scores
Show answer

C. Run the full eval set and compare scores: A few examples can hide regressions elsewhere. The eval set shows the real effect.

πŸ™‹ Questions learners ask

How many examples do I need?

Start with 50 good ones; that already catches most regressions. Grow towards hundreds per important category over time.

What are online evals?

Signals from real usage after launch: thumbs up or down, edits to AI output, escalations to humans, task completion.

πŸ“Œ Remember

No evals, no confidence. Measure every change.

πŸ“– Words from this lesson (AI dictionary)

Learn this as part of a full course

Track your progress, take the quick checks and follow the lessons in the right order. This lesson is part of:

AI Product Engineer Β· LLM / Agent Engineer Β· AI Forward Deployed Engineer Β· AI Product Manager

Continue in the course