Lesson 2 of 5 · 30 min

Build an LLM Test Set That Represents Real Use

A test set is only as good as how well it mirrors real inputs.

XDQ Tutor · AI guide

Hello. In this lesson I will take you through 4 ideas, one at a time.

  1. Where cases come from
  2. Size and balance
  3. Labels and references
  4. Version the set

Why it matters: A test set is only as good as how well it mirrors real inputs. After each idea I will ask you one quick question.

Where cases come from

The short version: The best cases come from real use: support tickets, past documents, logged queries, with personal data removed.

The best cases come from real use: support tickets, past documents, logged queries, with personal data removed. Add cases for known edge cases, such as empty inputs, very long inputs, other languages and ambiguous requests, and a set of adversarial cases that try to break the rules.

Label each case with the expected behaviour, not necessarily an exact expected text. For many tasks there are several good answers.

Quick check

What is the best source of test cases?

Size and balance

The short version: Start with 50 to 100 cases that cover your main categories, then grow.

Start with 50 to 100 cases that cover your main categories, then grow. Balance matters more than size: if 90% of real traffic is order status questions, a test set that is 90% refund disputes will mislead you. Tag each case with its category so you can report results per category.

Keep a held-out set that you never look at while tuning prompts, so you can check you did not overfit.

Quick check

Why keep a held-out set?

Labels and references

The short version: For each case, store the input, any context provided, the expected behaviour and, where useful, a reference answer or a list of required facts.

For each case, store the input, any context provided, the expected behaviour and, where useful, a reference answer or a list of required facts. A reference answer lets graders compare; a list of required facts lets you check coverage without demanding exact wording.

Have domain experts write or review labels. A support lead knows which answer is right better than an engineer.

Quick check

Who should review labels for domain tasks?

Version the set

The short version: Store the test set in version control with the code.

Store the test set in version control with the code. Record why cases were added and who labelled them. When policy changes, update the affected labels in the same change as the prompt or code.

Never silently delete failing cases to make a score look better.

Key takeaways
  • Draw cases from real, anonymised use
  • Cover common, edge and adversarial cases
  • Balance by category and keep a held-out set
  • Store expected behaviour or required facts
  • Version the test set with the code
Try it

Build a 50-case test set for your feature from real or realistic inputs, tag each by category, write expected behaviour, and set aside 10 cases as held-out.

That is the lesson.
Mark it complete to track your progress on this device.
← PreviousWhy LLM Features Need Evaluations, Not Spot ChecksNext lesson →Choosing Graders: Code Checks, Model Graders and Human Review