Implementation Guide

How to Test a Chatbot for Hallucinations Before Launch

To test a chatbot for hallucinations, define failure categories with severity ratings, build representative, out-of-scope, and adversarial test sets, and score responses against approved source content. Calibrate any automated judge against human review, set launch thresholds by business impact, and record the results as audit evidence. Testing bounds hallucination risk but does not remove it, so runtime controls must cover what remains.

Pre-launch hallucination test program

The program has six stages. Each stage produces an output that the next stage depends on, and the final stage hands remaining risk to runtime controls.

Six stages of a pre-launch hallucination test program
StageWhat it covers
1. DefineCategories and severity ratings
2. BuildRepresentative, out-of-scope, and adversarial test sets
3. EvaluateHuman review, automated checks, grounding verification
4. GateThresholds tied to business impact
5. RecordAudit evidence and named risk acceptance
6. Hand offRuntime controls for residual risk

Define hallucination categories before writing test cases

Start by defining the failure categories you need to detect, and assign each one a severity rating. Write down the rule for what counts as supported, so that every reviewer and every automated check scores a response the same way.

Build representative, out-of-scope, and adversarial test sets

A single test set cannot cover every failure. Build three kinds:

  • Representative: cases that reflect what the chatbot is expected to handle.
  • Out-of-scope: cases that fall outside what the approved source content supports.
  • Adversarial: cases written to push the chatbot toward unsupported answers.

Version each test set and record its sources, authors, and reviewers.

Match evaluation methods to what they can actually detect

Score each response against approved source content. Human review, automated checks, and grounding verification each detect different failures, so use them in combination rather than relying on one.

Calibrate any automated judge against human review before you trust its scores, and keep the judge prompts and calibration results with the rest of the test record.

Choose metrics and set launch thresholds tied to business impact

Set launch thresholds by business impact, not by a single overall score. Report results by category and severity, so that the failures with the greatest consequences are visible and are not averaged away.

Record results as audit evidence

Keep a record of the test program that a reviewer could follow end to end. It should include:

  • Category definitions, severity ratings, and the rule for what counts as supported
  • Test set versions, sources, authors, and reviewers
  • The configuration tested: model, prompts, retrieval index, and tool versions
  • Judge prompts and the results of calibration against human labels
  • Results by category and severity, with failed cases and the fixes applied
  • The launch decision, the named risk owner, and the residual risk accepted

Where pre-launch testing stops and runtime governance begins

Testing bounds hallucination risk but does not remove it. The residual risk accepted at launch needs controls that operate while the chatbot is in use.

Plan the controls that follow testing

Review how runtime policy enforcement, monitoring, and audit logging can manage the hallucination risk that pre-launch testing leaves in place.

Explore Runtime Governance