niloy.zaman
← All writing

AI QUALITY / CHECKLIST

How I test LLM features: a QA checklist

Traditional testing assumes the same input gives the same output, and that there's one right answer to check against. LLM features break both assumptions. Here's the checklist I use to test them anyway, and to decide when they're ready to ship.

Why LLM testing is different

When I test a login form, I know what "correct" looks like. When I test a feature that summarizes a document or answers a question, there may be hundreds of correct answers, and the model might give a different one every time I ask. On top of that, the behavior can change without anyone touching the code: a reworded prompt, a new model version, a different retrieval setting, or a new batch of ingested content can all shift the output.

So I stop asking "does the output match?" and start asking "does the output have the properties it must have, and none of the properties it must not have?" Everything below follows from that shift.

Traditional test versus LLM feature testA traditional test compares one output to one expected value. An LLM test accepts many valid answers and checks properties every answer must have and must not have.TRADITIONAL TESTInput: login("ana", password)Output: "Welcome, Ana"assert output == expected ✓LLM FEATURE TESTInput: "Summarize the Q3 note"answer Aanswer Banswer CMUST HAVEgrounded · cited≤ 60 wordsMUST NOT HAVEinvented factsPII · injection
Traditional tests compare against one right answer. LLM tests check the properties every acceptable answer must have, and must not have.

Start with a golden set

Before any checklist, I build a golden set: a versioned collection of test inputs, each paired with the properties a good answer must have. These are not exact expected strings. A good golden set includes:

  • Typical cases that represent real usage, ideally sampled from real (anonymized) requests.
  • Known hard cases: ambiguous questions, long documents, conflicting sources.
  • Unanswerable cases, where the right behavior is "I don't have that information."
  • Adversarial cases: injection attempts, requests for data the user shouldn't see.
  • Every bug you've ever found, added as a regression case the moment it's fixed.

The golden set is the most valuable QA asset on an AI project. Treat it like code: review it, version it, and grow it.

The checklist

I group checks by the kind of risk they cover. Tick them off as you go; your progress is saved in this browser.

0 / 0
1 · Correctness and groundedness
2 · Instruction following and format
3 · Safety and security
4 · Robustness
5 · Tool calls, agents, and MCP
6 · Regression on every change
7 · Performance and cost

How to score it

Not every check needs an AI to grade it. I layer the scoring from cheapest and most reliable to most expensive:

  1. Deterministic checks first. Schema validation, length limits, regex for PII patterns, banned phrases, and whether citations resolve. They're fast, free, and never flaky.
  2. LLM-as-judge for the rest. Groundedness and relevance need judgment, so a second model scores each answer against a written rubric. Calibrate the judge against a sample of human-labeled answers before you trust it.
  3. Humans for a sample. A person reviews a slice of every run, especially new failures and anything safety-related.
Three layers of scoringDeterministic checks run on every answer and are cheapest. An LLM judge scores groundedness and relevance. Humans review a sample. Each layer is more expensive and runs on fewer answers.1 · Deterministic checksschema · length · PII regex · citations resolve2 · LLM-as-judgegroundedness · relevance, scored on a rubric3 · Human reviewa sample of every runEVERY ANSWERSAMPLEDCHEAPESTNEVER FLAKYMOST EXPENSIVE
Layer the scoring from cheapest and most reliable to most expensive. Most problems are caught before an LLM judge or a person ever looks.

Because outputs vary, I run each case more than once and look at pass rates, not single pass/fail results. A case that passes 7 out of 10 times is a finding, not a pass.

Pass rate across repeated runs (illustrative)Three golden cases each run 10 times. Two pass 10 of 10. The Q3 revenue summary passes 7 of 10 and is flagged as a finding.SAME INPUT · 10 RUNS EACHCase 12 · refund policy question10/10 passCase 31 · Q3 revenue summary7/10 → findingCase 47 · unanswerable question10/10 pass
Illustrative example: run every golden case several times. A case that passes 7 of 10 runs is a finding, not a pass.

Here's what a property-based test looks like in practice:

# Golden set: inputs + required properties, versioned with the code
CASES = load_golden_set("summaries.yaml")

@pytest.mark.parametrize("case", CASES)
def test_summary(case):
    out = summarize(case.source)

    assert len(out.split()) <= 60                    # format
    assert not PII_PATTERN.search(out)               # safety
    for fact in case.must_mention:                   # coverage
        assert fact.lower() in out.lower()
    assert judge.grounded(out, case.source) >= 0.8   # groundedness (LLM-as-judge)

None of these assertions checks for an exact string, and all of them would catch a real problem.

Turning it into a release gate

A checklist only matters if it changes what ships. I agree on gate criteria with the team before testing starts, so the release decision isn't negotiated under deadline pressure. A typical gate:

  • Zero critical failures in safety and security, with no exceptions.
  • Groundedness and relevance at or above the last approved baseline.
  • No unexplained regressions: every newly failing case is reviewed and either fixed or accepted, in writing.
  • Performance and cost within budget.
Release gate flowA change to the prompt, model version, retrieval settings, or ingested content reruns the golden set. The release gate checks four criteria. All pass: ship. Any fail: block.ANY CHANGEpromptmodel versionretrieval settingsingested contentRerun thegolden setRELEASE GATE✓0 critical safety failures✓groundedness ≥ baseline✓regressions reviewed✓latency & cost in budgetSHIPBLOCKall passany fail
Any change that can shift behaviour reruns the golden set, and the gate decides using criteria agreed before testing started.

After release, the same checks keep running on a sample of production traffic, because the next model update or content batch can change behavior again.

Testing LLMs isn't about proving the output is right. It's about proving the risks are known, measured, and acceptable before users find them.

Want to see some of these checks in action? The ai-eval demo on my home page scores three model answers for groundedness, invented facts, PII leaks, and prompt injection.

← All writing Talk to me about AI quality