Quality Tests

How to Write a Small Test Set for an AI Workflow

Build a narrow AI test set with reference answers, ambiguous questions, missing evidence, and a held-out final run.

Write the expected answer before you run each test request. If the evidence is missing, write what a careful reply would ask for or leave unresolved. Set those examples aside before tuning the final prompt.

Start with a single task. Suppose a return-policy assistant answers questions from a small set of approved documents. Each example needs a question, the version of the documents it can see, the answer or expected action, and a reason to mark a failure. For a question about a policy exception, include the exception that needs to appear and its page. NIST recommends testing relevant generative AI behavior and verifying outputs, and Google Cloud’s evaluation overview describes use-case prompts and reference answers. NIST generative AI risk profile · Google Cloud evaluation service overview

Split the set by the failures you want to find

Example group Count What a passing response must do
Routine 8 Apply the current policy and cite its relevant clause.
Exception 5 Apply the condition that changes the normal rule.
Ambiguous 4 Ask for the detail that resolves the question before giving a definite rule.
Missing evidence 3 Say the supplied material leaves the answer open or route to someone who can confirm.

These counts illustrate a deliberately small set. Change the distribution when your workflow has a different risk. Keep the group labels in your evaluator’s copy. Use “Can I return it today?” to see if the assistant asks which product it was and when the customer bought it. For a missing-evidence case, ground truth could be “the supplied policy applies to standard items only.” A confident answer about a separate product line fails even if it sounds plausible.

Write the grader instructions beside the cases

For each example, specify a must-have, an acceptable variation, and a clear failure. If your citation rule allows printed or viewer page numbers, record the mapping in the answer key. Require the cited clause to match in either case. A sentence that changes a date or removes an eligibility condition should fail. Multiple writing styles can pass the same rubric. Google Cloud’s metrics guide describes task-specific rubrics and deterministic checks, useful when some outcomes are easier to score as exact matches. Google Cloud evaluation metrics

Put one common success beside one easy mistake

Imagine a shop needs answers about its return policy. A routine example can use a standard item bought within its expected window. An exception case could use the same purchase date but identify a product whose conditions are different. Put the complete product category and relevant version in the test input. In the answer key, quote the clause that supports each result and say which missing condition would fail the example.

Add a pair where an ordinary question is missing its purchase date. A careful answer could ask when the product was bought or give an explicitly conditional response if the workflow allows that. Decide before running the test. An answer that picks a plausible date should fail even if its general explanation sounds right. Use a case where the available documents do not cover the product. Ask the evaluator to mark whether the assistant acknowledged that gap before making a promise.

The draft's fluency is less useful than the evidence it gives. Write a check for the exact facts the reader will use, such as the accepted timeframe and any store or product restriction. Keep other preferences in a separate field. Some cases should pass with different wording. A deterministic comparison of an order number can be exact, while a correct request for clarification can be phrased several ways. Include both types to reveal different problems.

Use a small set to find patterns, then vary it

Label the cases without putting the label in the question. A line that begins “Missing evidence case” would tell the model what you are trying to observe. Give the person checking the result an answer key with a case label, ground truth and expected source scope. Preserve the app settings and file version. Ask another person to grade a few examples if there is uncertainty about what their answers should say.

Keep the final set outside prompt design. For five exception cases, you might tune on three and hold out two with distinct wording. If you look at a held-out failure to improve the prompt, move that case into your working set and plan a fresh test for the same type of error. Use an input from the same environment so the test remains meaningful. Build representative samples without live records if you cannot use actual customer material.

Review both the count and reasons for failure. A success on eight routine examples and four exceptions looks different if every case about missing evidence fails. Keep the denominator for each group. With a small set, one success can change a percentage substantially. Show the actual counts and identify the behavior that caused the failure. This helps readers judge whether to change the prompt or keep human review for a particular class.

Before collecting new cases, preserve the decision

For a test that will be used at release time, write which result would require work to stop or stay in human review. A wrong approval condition could stop rollout even if the other 19 cases pass. A formatting variation might only need a follow-up. Keep the stop conditions visible in the answer key, and agree on how to review a borderline result before running the set.

Store each input and rubric version with the result. Add new cases without silently replacing past ones. Keep one ordinary and one difficult run handy for checking the next update. If the app changes how it loads sources, run the stale-policy question again using the same dates. The model-update check describes comparing the old and new outcomes without losing context.

Before the final run, ask another person to check the answer file against the policy it names. Let them correct a bad assumption in the rubric without seeing any model answers. A missing exception in the test key can make both models seem to fail a case where the original policy actually supports their result.

Sources