Topic 5 of 5 · 4 min read
Testing an AI tool before rollout
Goal: Design a known-answer test set that measures an AI tool's error rate before a team relies on it.
Before a team relies on an AI tool, run it on cases where you already know the right answer and count how often it is wrong. The count tells you how much checking the tool needs. A demo does not.
Check yourself · 1 of 3
Why should the correct answers in a test set be fixed before the tool is run?
Why it matters
A vendor demo shows the tool at its best, on chosen examples. Your work has odd cases, old formats and messy data. A tool that is right most of the time can still fail on the type of case you care most about. Regulators also expect evidence that a tool was tested for its intended use. The FDA's good practice principles, for example, say that test data should be independent of the data used to build the tool.
Build a known-answer set
- Collect real cases from your own work, with personal details removed or approved for use.
- Fix the right answer for each case, decided by a qualified person before you run the tool. If the answer is set after seeing the output, it will lean toward the output.
- Cover the range. Include easy cases, hard cases, edge cases, rare cases and ones the tool should refuse or flag. Include different groups of people, languages, document formats and sources the tool will meet.
- Keep it separate. Do not use these cases to write or tune your prompts. If you do, you are testing the prompt on its own homework.
Measure it
Record, for each case, whether the output was right, wrong, or needed a fix. Then report error rates by case type and by group, not one overall average. A tool that is right on 95 of 100 cases may be wrong on half of the rare ones. Decide in advance what error rate is acceptable for each type, and what happens when it is higher.
Re-test
Vendors update models, sometimes without notice. Re-run the same set after any change to the model, the prompt, the settings or the data sources, and on a regular schedule. Keep the old results to compare.
Before and after
Before: "We tried it on five invoices and it worked, so we are rolling it out."
After: "We ran 120 past invoices with known totals, split by supplier type and scan quality. Errors: 2 of 80 clean scans, 9 of 40 poor scans. Poor scans stay with manual entry until the rate improves."
What goes wrong
- The test set is made of easy cases, so the error rate looks low.
- Only an overall rate is reported, hiding weak groups.
- Nobody re-tests after the vendor's update.
Examples
A small test-set table
| Case type | Cases | Wrong | Error rate | Accepted |
|---|---|---|---|---|
| Clean typed forms | 60 | 1 | 2% | Yes, under 3% |
| Handwritten forms | 30 | 7 | 23% | No, manual entry |
| Forms in a second language | 20 | 4 | 20% | No, review all |
Re-test trigger
A vendor emails that its model has been updated for 'improved accuracy'. The team reruns its 110 known-answer cases that week. Overall errors fall, but dates in older formats get worse. The team keeps manual review for those until it clears the pass mark.
Key points
- A known-answer test set measures how often a tool is wrong on your own kind of work.
- Fix the correct answers before running the tool, and keep the set apart from prompt tuning.
- Cover easy, hard, rare and should-refuse cases, and the different groups the tool will meet.
- Report error rates by case type and group, not just one average.
- Re-run the set whenever the vendor changes the model or you change the prompt or settings.
Common mistakes
- Testing on a handful of easy examples picked after seeing the demo.
- Setting the right answers after looking at the tool's output.
- Reporting one overall accuracy figure that hides weak case types.
- Assuming a tool tested once stays valid after the vendor updates it.
Check yourself · 2 of 3
A tool is right on 95 of 100 test cases overall. What should you check next before relying on it?
Check yourself · 3 of 3
The vendor announces a model update. What should the team do with its known-answer test set?
Practice items, not counted towards your mastery.
Start here
- AI Risk Management Framework (NIST) (opens in a new tab)StandardFree
The US reference for measuring and managing AI risk, including testing and human review as ongoing duties.
- NIST AI RMF Playbook (opens in a new tab)ArticleFree
Suggested actions for testing, documenting and escalating, written for teams that run AI systems.
Where to go in your country
- Good machine learning practice for medical device development: guiding principles (FDA) (opens in a new tab)DocsFreeUS
Ten principles from regulators, including testing on data that is independent of the data used to build the tool.
- Artificial Intelligence Risk Management Framework: Generative AI Profile (NIST) (opens in a new tab)StandardFreeUS
Lists risks specific to generative AI, such as made-up content, and the checks suggested for each.
- Article 14: Human oversight (EU AI Act) (opens in a new tab)StandardFreeEU
The legal text on what real human oversight of a high-risk AI system must allow a person to do.