# How Do You Know Your AI System Works?

> How to test an AI system before release and after launch: a fixed test set, three kinds of grader and live monitoring, explained for your AI interview.

**In short:** You keep a fixed test set of real questions with known good answers, grade the answers with code and an AI judge, and check a sample with people. You rerun the set on each change, and after launch you watch real users too, because a good demo proves very little.

AI and LLM interview question Q246, Evaluation and observability. Intermediate, very common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-to-know-your-ai-system-works

## Say it in 30 seconds

I don't trust a good demo. I keep a test set of real questions with known answers, and rerun it on every change. Code and an AI judge grade each answer, and people check a sample. After launch I read failed chats and add each new failure to the test set.

## Say it in 2 minutes

An eval is a test for an AI system. I give it an input, grade the answer against a rule I wrote in advance, and repeat it, because a model can answer the same question differently each time.

My first step is a golden set: real questions from the business, each with an answer a good reply must contain. For a bank's support bot, that means real chat questions about fees, cards and disputes, plus a few attacks.

Each answer gets the checks that fit it: code for exact facts, an AI judge for tone, and people on a weekly sample. An AI judge scores tone and whether an answer sticks to the source facts, but I compare its scores with people's scores first, because a judge can carry bias. Every change reruns the full set, and a drop in score blocks the release.

After launch I watch feedback, handoffs to a human agent and cost per chat. I also read failed transcripts myself, since the cause is often one line. Each real failure joins the golden set, so the test grows with the product. I save each version of the set, so each run compares like with like. That is how I know it works, and how I would notice when it stops.

## What is an eval, in plain words?

An eval is a test for an AI system. You give it an input, look at what it returned, and grade that answer against a rule you wrote before you started.

The hard part is that a large language model, the AI that writes the answers, is not a fixed machine. The same question can get a slightly different reply each time. So one good demo proves very little, and you need a test you can rerun.

> "Evals are structured tests for measuring a model's performance." (OpenAI)

Think of a bank that trains new tellers. It does not judge them on one easy transaction. It runs a list of mock customers, some calm, some angry, some with the wrong ID, and checks every result. For an AI support bot, the mock customers are real chat questions from last quarter.

- **Golden set:** A fixed list of real questions, each with the answer a good reply must contain.
- **Grader:** The rule, the model or the person that scores one answer.
- **LLM judge:** A second AI model that grades an answer against a written rubric.
- **Regression:** Something that worked before a change and breaks after it.
- **Calibrate:** Compare a grader's scores with people's scores, so you know how far to trust it.

## How do you grade each answer?

Each answer gets one or more graders. Anthropic's guide on agent evals says three kinds are typical, and each is good at different things.

- **Code: Exact rules.** A program checks what can be checked exactly: the fee matches the fee table, the JSON parses. Fast and cheap, but it can miss a correct answer worded differently.
- **AI judge: The softer parts.** A second model grades tone, and whether the answer sticks to the source facts, against a written scoring guide (a rubric). Flexible and scalable, but it has to be checked first.
- **People: The gold standard.** A trained reviewer reads the answer. Best quality, but slow and expensive, so use people on a sample.

*Diagram, How one change gets graded before release: Each change to the app is graded three ways at once. The three verdicts meet at one release gate, which blocks the release if the score drops.*
1. Each real question goes into your app.
2. The code check looks at the facts it can check exactly.
3. The AI judge scores the softer parts against a written rubric.
4. People read a sample of the answers.
5. The code verdict goes to the release gate.
6. The judge's verdict goes to the gate, once the judge has been checked against people.
7. The human verdict goes to the gate. A drop in score blocks the release.

AI judges have known quirks. A 2023 paper on LLM judges studied position, verbosity and self-enhancement biases. That means a judge can favour the answer shown first, the longer answer, or answers that look like its own. The same paper found that a strong judge agreed with human preferences about as often as people agreed with each other.

So you check the judge before you trust it. Anthropic's guide says LLM graders should be closely calibrated with human experts, so that the model grades stay close to the human grades.

## What do you test, and how do you ship a change safely?

Start with the test set, because the grades are only as good as the questions. You don't need hundreds of questions to begin. Anthropic's guide says 20 to 50 simple tasks, taken from real failures, is a good start.

Make the set balanced. Include typical cases, edge cases and adversarial cases, meaning people trying to break the rules. Include cases where the bot should act and cases where it should refuse, or the tests teach the wrong lesson.

Here is a worked example from a made-up mid-size bank, with made-up numbers. Its support bot answers fee questions. The golden set holds 200 real chat questions from last quarter, each with the right fee or the right handoff. It also holds a few attacks, such as a customer who asks for a waiver the bot cannot give: "Can you waive my late fee this once?"

1. **Score today's bot:** 91 of the 200 answers pass the rules: the right fee, no promised waiver, and a handoff for disputes.
2. **Test the new wording:** A developer tightens the prompt, the written instructions the bot follows. The team reruns the same 200 questions as a regression test.
3. **Read what broke:** The score falls to 84 of 200. Most new failures are waiver requests, where the bot now refuses but forgets the handoff. A reviewer reads those chats one by one.
4. **Block the release:** The release gate blocks any drop. The wording goes back, gets fixed, and the full set runs again before anyone ships.

The grader in plain Python. The bot's answers are made up, so the function stands in for the real bot.

```python
# Grade a bank's support bot on fee questions, one case at a time.
FEES = {"late payment": 29, "card replacement": 10, "cash advance": 25}

GOLDEN = [
    ("How much is a late payment fee?", "late payment"),
    ("What do you charge to replace a lost card?", "card replacement"),
    ("What is the cash advance fee?", "cash advance"),
]

def bot_answer(question):
    # Stand-in for the real bot. Its cash advance answer uses an old rate.
    if "late" in question:
        return "The late payment fee is $29."
    if "replace" in question:
        return "A replacement card costs $10."
    return "The cash advance fee is $35."

def grade(answer, fee):
    # The bot answer must contain the fee table amount as a dollar figure.
    return ("$" + str(FEES[fee]) + ".") in answer

passed = 0
for question, fee in GOLDEN:
    ok = grade(bot_answer(question), fee)
    passed += ok
    print("PASS" if ok else "FAIL", "|", question)
print(passed, "of", len(GOLDEN), "passed")
```

Output:

```text
PASS | How much is a late payment fee?
PASS | What do you charge to replace a lost card?
FAIL | What is the cash advance fee?
2 of 3 passed
```

## What happens after launch?

An offline test is a snapshot. Real users ask things the team never thought of, so after launch you watch live signals: feedback, handoffs (when the bot passes a chat to a human agent), guardrail triggers (times a safety rule stopped a reply) and cost.

> "Evals make problems and behavioral changes visible before they affect users" (Anthropic)

Anthropic's guide puts production monitoring, user feedback, A/B tests (two versions shown to different users, to compare them), manual transcript review and human evaluation together, as one picture. Its list also includes manual transcript review, which means a person reads real chats.

*Diagram, Two places failures show up: Failures show up in two places: a test run before release, and live signals and chat reads after it. Both feed one fix, and the failing case joins the golden set so it is tested every time after that.*
1. A test run on the golden set finds a failure before release.
2. A spike in live signals, like handoffs, points to a problem.
3. A reviewer reads a failed chat and sees what went wrong.
4. The team finds the cause and changes the prompt, code or rules.
5. The failing case joins the golden set, so the next run tests it.

Every real failure you find joins the golden set, so the test grows with the product. Once the set exists, you get a baseline and regression tests almost for free.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: a repeatable test with a known right answer or rule.
- [ ] A fixed test set of real cases, with edge cases and attacks.
- [ ] Three kinds of grader, and when to use each.
- [ ] The AI judge is checked against people before it is trusted.
- [ ] Offline tests before release, live signals and transcripts after.
- [ ] Honest about limits: a score is evidence, not proof.

**Common traps**

- Trap: "Our demo looked great, so it works." Better: One good run proves little. Use a test set you can rerun on every change.
- Trap: "Public benchmark scores prove our bot is good." Better: Benchmarks test general skill. Your own test set tests your questions, rules and risks.
- Trap: "The AI judge grades it, so we don't need people." Better: Judges can carry bias, such as favouring the answer shown first or the longer one. People check a sample and calibrate the judge.

## Can you spot the weak plan?

**Spot the weak plan:** Which of these four eval plans has the biggest problem?

A. We rerun 200 real chat questions, including attacks, on every prompt change.
B. A code check confirms that each fee quoted matches the fee table.
C. Our AI judge scores 300 answers a week, and nobody has compared it with a person.
D. Two reviewers read 30 random live chats every week and log the problems.

**Answer:** C. The AI judge is the one grader nobody checks, so its scores can carry bias without anyone noticing. Compare its scores with a human sample each month, and fix the rubric when they split.

**Quick check:** A new model scores higher on your golden set, but users complain more. What do you do first?

A. Ship it, because the score went up
B. Read the failing live chats and compare them with the golden set
C. Add a fourth grader to lift the score
D. Ask the vendor for a public benchmark score

**Answer:** B. The test set may miss what users really ask. Live transcripts show the gap, and each real failure joins the golden set so the next run catches it.

## Can you answer these from memory?

**Flash cards**

- **What is an eval?** A repeatable test: a fixed input, the output, and a rule that grades it.
- **Which three graders?** Code checks, AI judges and human reviewers.
- **Why check the AI judge?** Judges can be biased, so compare their scores with people's scores first.
- **How big should a first test set be?** 20 to 50 simple tasks from real failures is a good start, says Anthropic.
- **What runs after launch?** Live signals and reading failed chats. Each real failure joins the test set.
- **What is a regression test?** A rerun of the old test set after a change, to catch what got worse.

## Likely follow-up questions

- Q247 Offline vs online evaluation? https://designervenkat.online/interview/ai/offline-vs-online-evaluation
- Q248 What is a golden dataset, and how do you build one? https://designervenkat.online/interview/ai/what-is-a-golden-dataset
- Q249 What is LLM-as-a-judge? https://designervenkat.online/interview/ai/what-is-llm-as-a-judge
- Q250 What biases do judges have (position, length, self-preference)? https://designervenkat.online/interview/ai/llm-judge-biases
- Q251 How do you calibrate a judge against humans? https://designervenkat.online/interview/ai/how-do-you-calibrate-a-judge-against-humans
- Q181 How do you evaluate agents? https://designervenkat.online/interview/ai/how-to-evaluate-ai-agents

## Learn it in depth

- [LLM Evaluations](https://designervenkat.online/learn/ai-engineering/llm-evaluations)
- [A model as the judge](https://designervenkat.online/learn/ai-engineering/model-based-evals)
- [Seeing inside your AI app](https://designervenkat.online/learn/ai-engineering/llm-observability)
