Gradient LabSign up free

Cheat sheets › Chapter 15

Story: judging an AI with people cheat sheet

Follow Maya’s team as they launch a chatbot and learn every way people evaluate AI. Every lesson in one page: the key idea, the pseudocode and the terms.

Episode 1: Launch week

Automatic scores compare words. They can’t tell whether an answer is truly helpful, correct, kind or safe. human evaluation means people read real answers and judge exactly those qualities.

automatic_score = matches the reference answers    # 94%!
complaints = rising
# some qualities can't be counted automatically:
#   helpful?  correct?  polite?  safe?
human_eval = people read real answers and judge them
decide using both the numbers and human judgment

Terms: human evaluation

Episode 2: Give it a score

A rating scale turns opinions into numbers you can track. Pip averages 3.6. But look at the spread too: a fair number of 1s and 2s are hiding inside that respectable-looking average.

for each answer in a sample of 200:
    a rater gives a score from 1 (useless) to 5 (excellent)
average score = 3.6
look at the spread, not just the average

# raters use scales differently → write clear anchors:
#   5 = fully solves it, accurate, polite   1 = wrong or unsafe

Terms: rating scale, anchor

Episode 3: Which version is better?

Instead of scoring answers one at a time, show both versions’ answers to the same question side by side and ask “which is better?” This pairwise comparison is easier for people, and their choices are more consistent than their star scores.

for each question:
    show answer A (old Pip) and answer B (new Pip) side by side
    the rater picks: A is better, B is better, or a tie
win_rate(B) = B wins / all comparisons      # 64%

# randomize which side each version appears on

Terms: pairwise comparison, win rate, position bias

Episode 4: Two raters, two verdicts

Both raters label the same answers: teal is safe, coral is unsafe. Top row is Priya, bottom row Sam. They match on 8 of these 10.

two raters label the same 100 answers: safe or unsafe
agreement = matching labels / 100                    # 82%
agreement expected by pure chance = 50%    # if each says “safe” half the time
kappa = (82% − 50%) / (100% − 50%) = 0.64           # beyond chance

low agreement → unclear guidelines → fix them, practice together

Terms: inter-rater agreement, kappa

Episode 5: Real customers decide

In an a/b test, each incoming customer is randomly sent to old Pip or new Pip. Random assignment makes the two groups alike in every way except which Pip they talk to.

split real customers at random:
    50% talk to old Pip (A), 50% talk to new Pip (B)
measure what matters: problem solved without a human agent?
A: 61% solved      B: 68% solved
check the difference is bigger than random noise
also check nothing important got worse (complaints, escalations)
roll out B only if it wins

Terms: a/b test, guardrail metric

Episode 6: Paid to break it

red-teaming means attacking on purpose: trick instructions, false premises, requests for other customers’ data, role-play tricks. Pip resists most attempts, but one gets through: it agreed that “fees are zero”, which isn’t true.

red team = people who try hard to make Pip fail
they try: tricky questions, false premises, requests for harmful help,
          attempts to reveal other customers' data, role-play tricks
log every failure → fix it (training data, rules, filters)
re-test the fix
keep every attack in a library and re-run it before each release

Terms: red-teaming

Episode 7: Too many answers to read

Leo sets up an ai judge: a strong AI model given Maya’s scoring guide. It reads every conversation and gives a score with a short reason, in seconds.

judge = a strong AI model plus a written scoring guide
for each answer: the judge gives a score and a short reason
check the judge against human ratings on 200 answers    # agree?
test for biases: longer answers, first position, its own style
use the judge for scale; keep people for spot checks and hard cases

Terms: ai judge

Episode 8: The evaluation ladder

Lower rungs are fast and cheap, so they run constantly. Higher rungs are slower and costlier but closer to reality, so they run less often. Each catches problems the others miss.

every release of Pip:
    automatic tests          (seconds, every change)
    AI-judge scores          (thousands of answers)
    human ratings + side-by-side   (hundreds, weekly)
    red-team attack library  (every known attack)
    A/B test                 (real customers)
ship only if quality is up and safety isn’t down

Terms:

Revise with flashcards and quizzes. Free practice for every lesson in this chapter.

Open in the app