Evaluating AI

Sign in to save progress

Sign in to watch. It takes one tap.

8 two-minute lessons are ready in this course. The first one is free; a Google sign-in keeps your streak, progress and quiz history.

Continue with Google
  1. 1Why benchmarks misleadFree
  2. 2What a good eval looks likePremium
  3. 3Using AI to judge AIPremium
  4. 4Testing for hallucinationsPremium
  5. 5A/B tests and real user metricsPremium
  6. 6Red teamingPremium
  7. 7Contamination: when models cheatPremium
  8. 8Building your own evalPremium

Prefer reading? Every lesson in this course as text

Read this lesson as text: Why benchmarks mislead

Why benchmarks mislead

What exactly is the problem with benchmarks? Let's try to understand. In a simple way. A benchmark is a fixed exam for AI models.

A big set of questions with known answers. Run the model, count the right ones, get a score. Scores go on a leaderboard, and headlines follow. Model A beats model B by two points.

Sounds like proof. Here is the thing. It usually is not. A benchmark is a proxy.

It stands in for the real skill. But your real job is messy. Long documents, vague requests, follow up questions. The exam never covers that.

Take a famous one. Thousands of multiple choice questions. But nobody uses AI by giving it four options. Picking a letter is a different skill from writing a good answer.

Now the deeper problem. Goodhart's law. When a measure becomes a target, it stops being a good measure. Labs tune models toward the score, so the score inflates.

It's like a student who drills past papers. Grades go up, understanding does not. The model gets better at benchmark style questions, not at your work. There is also saturation.

Once top models all score above ninety, the exam is used up. The remaining gaps are mostly noise, not real ability. That is why a model can top the charts, then flop on your task. The benchmark measured something, just not the thing you needed.

So, treat benchmark scores as a rough first filter. Never as proof. The only exam that matters is your own use case. Quick check now.

One question is coming up. Let's see if it clicked.

Read this lesson as text: What a good eval looks like

What a good eval looks like

What exactly is a good eval? Let's try to understand. In a simple way. Here is the thing.

An eval is just a measurement. You give the model a fixed set of tasks, score the answers, and get a number. A good eval starts with validity. The score must track the thing you actually care about.

If you care about helpful answers, do not just count keywords. Next, reliability. Run the same eval twice, and you should get nearly the same score. If the number jumps around, you are measuring noise, not skill.

Say you are testing a support bot. A good eval uses real customer questions, messy ones included, not tidy textbook prompts. The set should mirror real traffic. Now, discrimination.

A good eval separates strong models from weak ones. If every model scores ninety-nine percent, it is saturated. No headroom, so it tells you nothing. Scoring needs a rubric, written before you see any outputs.

What counts as correct? What earns partial credit? Decide first, or you will grade toward what you like. Size matters too.

With fifty questions, a two point gap is noise. You need hundreds of examples before your confidence intervals shrink enough to trust small gaps. One more sign. A good eval lets you read the failures.

Not just a score, but which questions broke, and why. That is what actually improves the model. So, the checklist. Valid, so it measures what matters.

Reliable, so scores repeat. Realistic, unsaturated, big enough, and graded by a rubric you fixed in advance. Quick check now. One question is coming up.

Let's see if it clicked.

Read this lesson as text: Using AI to judge AI

Using AI to judge AI

What exactly is an LLM judge? Let's try to understand. In a simple way. Say your chatbot answers a million questions a day.

Someone has to check those answers. Humans are careful, but slow and expensive. You can't grade everything by hand. So here is the idea.

Use a strong model as the grader. Give it the question, the answer, and a rubric. It reads everything and gives a verdict. The rubric is the key part.

Not just, is this good. You spell out criteria. Is it factually correct? Did it follow the instructions?

Vague rubrics give vague grades. Two common setups. Scoring: rate one answer, say one to five. Pairwise: see two answers, pick the better one.

Pairwise is more reliable, because comparing is easier than scoring. But judges have biases. Position bias is a famous one. Swap the order of two answers, and the verdict can flip.

The fix: judge both orders, keep only consistent wins. Verbosity bias is another. Judges tend to prefer longer, fancier answers, even when the short one is correct. And self preference.

A model often rates its own writing style higher. So don't let a model be the sole judge of its own outputs. So how do you trust the judge? You calibrate it.

Take a small set humans already graded, and check the judge agrees with them. High agreement, then let it scale. So, an LLM judge is a model grading other models with a rubric. Cheap at scale, close to human judgment, if you watch its biases.

Quick check now. One question is coming up. Let's see if it clicked.

Read this lesson as text: Testing for hallucinations

Testing for hallucinations

How does testing for hallucinations work? Let's try to understand. In a simple way. First, what is a hallucination?

It's when a model states something false, but says it with full confidence. A fake citation. A made up date. Fluent, and wrong.

Why does this happen? Because the model predicts plausible next words. It never checks a database of facts. And plausible is not the same as true.

So how do we test it? One trick: ask about things that do not exist. A fake paper, a fake person. An honest model should say, I don't know.

Here is the main method. Take the answer, and split it into small atomic claims. One fact per claim. Then check each claim against a trusted source.

Now you can count. Say the answer has ten claims, and two are unsupported. That's a twenty percent hallucination rate. One clean number you can track.

With RAG, the bar is stricter. The model gets documents, so every claim must come from them. This is called faithfulness. Supported by the source, or it fails.

No source handy? Try consistency checking. Ask the same question many times. Real knowledge stays stable across samples.

Fabrications wobble, and contradict each other. And measure abstention too. Saying I don't know is a win, not a failure. If your eval only rewards answers, you are training confident guessing.

So, the gist. Trap questions catch fabrication. Atomic claims give you a rate. Faithfulness checks grounding, and consistency exposes the wobble.

Quick check now. One question is coming up. Let's see if it clicked.

Read this lesson as text: A/B tests and real user metrics

A/B tests and real user metrics

What exactly is an A/B test? Let's try to understand. In a simple way. Offline evals happen in a lab.

Fixed questions, fixed answers. But your users are not a lab. The only real test of a model is what happens when real people use it. So here is the trick.

You split your traffic. Half the users get the old model, call it A. The other half get the new one, B. Neither group knows.

The split must be random. Randomization makes the two groups identical on average. Same mix of power users, casual users, everything. So any difference you see comes from the model.

Now you watch a metric. Say your chatbot's thumbs up rate. Group A sits at forty percent. Group B hits forty four.

That gap is your evidence. But thumbs are rare. Most users never click them. So teams lean on implicit signals.

Did the user copy the answer? Did they regenerate it? Did they come back tomorrow? One catch.

Small gaps can be pure luck. So you run a significance test, and you decide the sample size up front. Peeking early and stopping when B looks good inflates false wins. Second catch.

Metrics can lie. Longer sessions might mean users are stuck, not happy. So teams pair the main metric with guardrail metrics, like error rates and retention. So, an A/B test is a randomized experiment on live traffic.

Real users vote with their behavior, and statistics decides if the new model truly wins. Quick check now. One question is coming up. Let's see if it clicked.

Read this lesson as text: Red teaming

Red teaming

What exactly is red teaming? Let's try to understand. In a simple way. Most testing asks, does the model do its job?

Red teaming flips that. You attack your own model, on purpose, to find the ways it fails. The idea comes from security. One team defends, and a red team plays the enemy.

Here, the enemy is anyone trying to make your AI misbehave. Say your chatbot refuses to explain how to pick a lock. Now ask it to write a movie scene where a burglar explains it. Often, it just answers.

That trick has a name. A jailbreak. A prompt crafted to slip past the model's safety training. Roleplay, clever encodings, long weird prefixes.

Attackers try everything. There is a nastier cousin, prompt injection. Hidden instructions planted inside content the model reads, like a webpage or an email, that hijack what it does. So how do you red team?

Start manual. Experts sit down and probe the model, domain by domain. Weapons, scams, private data, hate. Then you scale it.

An attacker model generates thousands of adversarial prompts automatically, and you measure the attack success rate. How often the target gives in. Every successful attack becomes training data. You patch the model, then attack again.

Because attackers adapt, red teaming is a loop, never a one time audit. So, red teaming means attacking your own model to find failures before real adversaries do. Break it in the lab, so it holds in the wild. Quick check now.

One question is coming up. Let's see if it clicked.

Read this lesson as text: Contamination: when models cheat

Contamination: when models cheat

What exactly is benchmark contamination? Let's try to understand. In a simple way. We test models with benchmarks.

Fixed sets of questions, like an exam. A high score should mean the model can actually reason. But here is the problem. Models train on huge scrapes of the internet.

And the exam questions are on the internet too, with their answers. When test data leaks into training data, that's contamination. The model has already seen the exam. So it can memorize answers instead of reasoning.

The score still looks great. But it's fake. It measures memory, not ability. Like a student who stole the answer key the night before.

Here is the tell. Take a contaminated math benchmark and just rephrase each question. Same logic, new words. Contaminated models suddenly drop hard.

Clean ability would survive a rewrite. So how do we catch it? One way is overlap checking. Search the training data for long n-grams, exact strings from the test set.

If they match, you've found a leak. Another trick is canary strings. Benchmark authors hide a unique code inside the dataset. If a model can repeat that code, it trained on the test.

The strongest fix is a private held-out test set. Questions that never touch the internet. Fresh exams, written after the training cutoff, work too. So, contamination means the model saw the test during training.

Trust a score only when you know the test stayed unseen. Quick check now. One question is coming up. Let's see if it clicked.

Read this lesson as text: Building your own eval

Building your own eval

How does building your own eval work? Let's try to understand. In a simple way. Your product does one specific job.

Maybe it summarizes legal contracts. No public benchmark measures exactly that. So you build your own eval. A test tuned to your task.

Start with real examples. Pull actual inputs from your app, especially ones where the model failed. Even thirty to fifty good examples beat a thousand random ones. Next, for each input, write down what a correct output looks like.

That's your gold answer. This step is slow. And honestly, it's the most valuable part. Now, how do you score each output?

That's the grader. For clean tasks, use code. An exact match check, or a regex. Deterministic, cheap, and it never drifts.

For fuzzy outputs, like summaries, code won't cut it. So write a rubric. Clear pass and fail criteria for each example. Then a judge applies it, consistently.

Run all your examples through the model and score them. Then read the failures yourself. Don't just stare at the number. The transcripts tell you why it broke.

Here's the payoff. Your eval becomes a regression suite. Every prompt change, every model swap, run it again. If the score drops, you catch it before your users do.

And keep it alive. Every new failure in production becomes a fresh test case. So your eval grows with your product, and it never goes stale. So, the recipe.

Real inputs, gold answers, a grader, and a loop. That's an eval you can actually trust. Quick check now. One question is coming up.

Let's see if it clicked.