Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Generation  ›  Capstone Project

Evaluating the AI Feature

2. Generation 15 minEvaluate an AI feature by rerunning a fixed set of realistic test cases after every change and checking properties of the output, since the exact wording varies.

Evaluating the AI Feature

The code that Asha's builder generates is only half of what can go wrong. The other half is what Pantry Pal's own model generates for users. She tweaked the prompt to make dinners "more exciting", tried three pantries, and liked what she saw. A week later, users with small pantries were getting dishes that needed ten extra ingredients. Three examples checked by eye had told her nothing about the cases she never tried.

The rule

Keep a fixed set of test cases, and rerun all of them after every change.

An evaluation set, or eval set, is a saved list of realistic inputs, each paired with what a good answer must do. The model's wording changes from run to run, so you do not check for exact words. You check properties: things every good answer has, however it is phrased.

Property How it is checked
No allergens Code compares each ingredient with the allergy list
Mostly uses what is listed Code counts ingredients not in the pantry (at most two, say)
Steps a beginner can follow A person, or a second model given a written rubric, grades it
Fast enough The time for each case is measured

Include the easy cases and the awkward ones: a nearly empty pantry, unusual items, misspellings, several allergies at once, a vegetarian whose pantry holds little more than rice and spices. A few dozen well-chosen cases teach you more than hundreds of easy ones.

Record the cost and time of each run as well. A change that improves quality but doubles the bill is a trade-off you want to see before your users do.

The shortcut

Change one thing, rerun everything, compare the scores.

Testing the "more exciting" promptStep 1 of 4
  1. Baseline

    Run the current prompt on all 30 cases: 29 pass "mostly uses what is listed", and all 30 pass "no allergens".

Every failure a real user reports becomes a new case. Over time the eval set turns into a record of every way the feature has gone wrong, checked automatically on every change.

Drills

Answer fast — trust the rule.

quick drill

Why not test an AI feature by checking for the exact expected words?

quick drill

Which is a property check for Pantry Pal's suggestions?

quick drill

Asha changes the prompt and the model on the same day, and the scores drop. What went wrong with her method?

quick drill

A user reports a bad suggestion that no test case covers. What should happen?

Remember

  • Keep a fixed set of test cases, and rerun all of them after every change.
  • Check properties, not exact words, and track cost and time per run too.
  • Trap: judging a change on a few examples by eye, or changing two things at once.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainBuild a small eval set

An app uses AI to write short, friendly replies to customer reviews for small shops. Describe five test cases you would put in its eval set and two properties you would check on every reply, and explain how you would use the set when you change the prompt.