We use analytics to count visits and form use. It is on unless you reject it. We show no ads on this site.

Glossary

AI hallucination

Published . Last updated . Published by Zapple.Tech, founded by the founders of CodeceptJS and Codeception, open-source testing frameworks.

Also called
confabulation
Published
Updated
Related service
AI chatbot testing
Definition

An AI hallucination is output that a model states as fact but that is false, or not supported by what it was given. NIST uses the word confabulation. Teams test for it by sampling real questions, checking each answer against a source or reference, and counting the failures. The aim is a rate you can accept, not zero.

What is an AI hallucination?

An AI hallucination is output a model presents as true that is false or not supported by what it was given. The word is informal. The NIST Generative AI Profile uses a more exact one, confabulation, and defines it as “the production of confidently stated but erroneous or false content (known colloquially as ‘hallucinations’ or ‘fabrications’) by which users may be misled or deceived”. It adds that confabulations include output that diverges from the input or contradicts earlier statements in the same context.

A model vendor says the same of its own product. Anthropic’s guidance on reducing hallucinations states: “Even the most advanced language models, such as Claude, can sometimes generate text that is factually incorrect or inconsistent with the given context.”

The word covers a wider ground than testing. This page keeps to one question: how does a team find out whether its AI feature does this, before users do?

Why do AI models hallucinate?

NIST gives the plain reason: confabulations “are a natural result of the way generative models are designed”, because they generate outputs that approximate the statistical distribution of their training data. A language model predicts the next word. Such prediction can give accurate output and can give wrong output that reads just as fluently. NIST calls this particularly relevant to open-ended prompts for long-form answers and to domains that need highly contextual or domain expertise. For you the point is simple: fluent does not mean true.

What kinds of hallucination are there, and which check catches each?

The kinds below are our reading, grouped by what a test can catch. They are not a standard taxonomy. The last row follows NIST’s description of output that diverges from the input or contradicts earlier statements.

Kind Example pattern Check that catches it What the check needs
Invented fact A policy, price or date that exists nowhere Compare with a reference answer Reference answers written by a person
Wrong attribution or citation A real quote credited to the wrong document, or a link to a page that does not exist Open each cited source and read it A person, or a script that fetches the source
Unsupported by the supplied source The answer adds a claim the retrieved document does not make A source-support check (see groundedness) The source text for that answer
Wrong tool result reported as done An agent says “refund sent” while the call failed Compare the report with the system state Access to the real end state
Contradicts itself or the question Turn three denies what turn one said A multi-turn test with a check on each turn Scripted conversations with expected states

A source-support check is one method and has its own page. Source support also depends on the quality of retrieval; our RAG evaluation page covers scoring that step.

How much hallucination is acceptable for your product?

In our view, start from what one wrong answer costs you, and let that set the bar. A wrong cafe menu item costs little. A wrong legal statement, medical instruction or price can cost a lot. We give no threshold, because a number copied from elsewhere would not know your cost.

Teams count it as a rate: the share of sampled answers that fail a defined check.

Which reduces hallucination more for your case: retrieval, a narrower prompt, or a check after the answer?

We found no sourced ranking that holds across products, so our advice is to test the options on your own questions. Three levers are documented:

  • Give the model the source. Google Cloud’s grounding overview says: “If you provide models with access to specific data sources, then grounding tethers their output to these data and reduces the chances of inventing content.”
  • Narrow the prompt. Anthropic lists allowing the model to say it does not know, asking for word-for-word quotes first, and asking for a citation per claim, with the claim retracted if none is found.
  • Check after the answer. Microsoft says its groundedness detection “helps you ensure that large language model (LLM) responses are based on your provided source material, reducing the risk of non-factual or fabricated outputs”. Microsoft’s page says the feature retires on April 30, 2027. AWS’s contextual grounding check filters responses. Its Classic tier is strict: any information not stated in the grounding source lowers the score, including reasonable inferences.

Our working method to show which helps: change one thing at a time on the same fixed set of questions. Count failures before and after, and have a person read a sample of both. If the count does not move on your questions, the lever did not help your case.

How do you test for AI hallucinations?

Our working method, in order:

  1. Collect real questions from support logs or users, plus questions the system should refuse.
  2. Write the expected answer, or name the source the answer must come from.
  3. Run the questions and keep the full output.
  4. Read a sample by hand before trusting any automatic score.
  5. Score the rest by reference, by source support or with a judge model. The LLM-as-a-judge page explains how to check the judge.
  6. Rerun the set after each change to the model, prompt or sources.

Our guides on automating a chatbot test and testing AI agents walk through the checks around it.

If you are choosing what to buy for a customer-facing chatbot, AI chatbot testing is the service that tests whole conversations against your policies and tone of voice.

AI hallucination testing: collect real questions, write the expected answer or name its source, run them and keep the output, read a sample by hand, score the rest, and get a failure rate on the questions you sampled, not a guarantee on the next one

What does AI hallucination testing not solve?

Testing gives a rate on the questions you sampled, not a guarantee on the next one. Anthropic’s own guidance says its techniques do not eliminate hallucinations entirely, so the product still needs a fallback for a wrong answer. A person must own the sample and decide what counts as wrong. Our post on whether AI will replace software testers covers what still needs a person.

What does Zapple.Tech do about it?

If you are not sure how your AI feature’s answers are checked before release, start with the evidence. Zapple.Tech starts with a one-week QA audit of one product area. It looks at its tests, pipeline and release process, and ends in a written report on what is at risk and what to fix first, plus a pilot plan you can run with Zapple.Tech or without it. Read more on the QA audit and assessment page.

Tell us about your AI feature in the form below.

  • Groundedness

    Groundedness tells you whether an AI answer is supported by the source material the model was given, such as retrieved documents or a tool result. A grounded answer adds nothing the sources do not say. It does not tell you whether the sources are right, so you still need a check on correctness.

  • RAG evaluation

    RAG evaluation measures a retrieval-augmented generation system in two parts: whether the search step returned the right passages, and whether the answer built from them is supported and useful. Scoring the two separately tells you which one to fix. You need a labelled question set before any score means something.

  • LLM as a judge

    LLM as a judge means using one language model to grade the output of another against a rubric, so a team can score thousands of answers unread by people. It is fast and flexible, but the judge makes its own errors. Trust its score only after you compare it with human labels, and check hard rules without a model.

  • Model drift

    Model drift is an AI feature getting worse, or just different, without any change to your code. The data it sees may have moved. We also count the vendor replacing the model behind it. You catch it by comparing today's behavior with a stored baseline, before your users notice that the answers changed.

All terms in the glossary

Test AI

AI chatbot testing

Testing for customer-facing AI chatbots: multi-turn conversations, policy and tone checks, prompt injection and hand-off to a human. One-week baseline.

See the service

Questions about AI hallucination

What is an AI hallucination?

An AI hallucination is content a generative model presents as true that is erroneous, false or unsupported. NIST's term for it is confabulation, defined as confidently stated but erroneous or false content, and it notes that people also say hallucinations or fabrications.

Why do AI models hallucinate?

NIST says confabulations are a natural result of how generative models are designed: they produce outputs that approximate the statistical distribution of their training data. Such prediction can give accurate output, and it can give wrong output that reads just as fluently.

How do you test for AI hallucinations?

Our working method: collect real questions, including ones the system should refuse. Write the expected answer or name the source for each. Run them, have a person read a sample, then score the rest with a reference check, a source check or a judge model. Rerun after each model or prompt change.

What is the difference between hallucination and groundedness?

Hallucination is the failure you want to prevent. Groundedness is one test for it, and it applies only when the model was given source material to answer from. A model with no source material can still hallucinate, so that case needs a reference answer to compare with.

Can AI hallucinations be eliminated?

No source we found shows a method that does. Anthropic's guidance says its techniques significantly reduce hallucinations but do not eliminate them entirely. Plan for a wrong answer: add a fallback, a way for users to report it, and a person who owns the sample you test.

Request a QA audit quote

Tell us what you ship and what worries you.

What happens after you send this

  1. You send the form: your situation and what you need tested, then your name and work email.
  2. Within one business day, we reply with a suggested first step, its scope, timeline and a quote.
  • Fixed scope
  • You decide after each step
  • The tests live in your repository
  • An NDA signed before access

“They helped us to close the positions and consult our team how to proceed further. High-quality quick feedbacks with the deep checking of the required tasks, professional approach, great understanding of the company's technologies and product, detailed reports.”

Kristina Lavrentieva, Manager at keepgo.com, Israel
  • Rated 4.9 out of 5 on Clutch, from 7 client reviews
  • 42 completed test automation and infrastructure projects
  • Founded by the founders of CodeceptJS and Codeception, open-source testing frameworks

Request a QA audit quote

    What is closest to your situation?
    Optional. The product, the platforms, how often you release, what broke last.

    You decide after our reply whether to go ahead.

    Prefer to talk first? Book a call

    One-week QA audit · written report

    Request a QA audit quote