esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

How Do You Detect Hallucinations?

How to catch confident answers that no source backs: check claims against passages, ask again and compare, and keep a person in the loop, for your AI interview.

In short

Check each claim in the answer against a source, and ask the model the same question several times to see whether its answers agree. A claim with no source, or answers that keep changing, gets flagged. No method catches every hallucination, so risky answers still need a person.

12 min readIntermediateCommon · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

A hallucination is a confident answer that is false or has no source behind it. I catch them in two ways. First, I check each claim against a passage from a trusted source, and remove any claim with no passage behind it. Second, I ask the model the same question several times and compare the answers, since answers that drift apart are a warning sign. No method catches everything, so risky answers still go to a person.

What is a hallucination, in plain words?

A hallucination is when an AI model states something false or unsupported in the same calm tone it uses for true things. Detecting one means catching that answer before a person acts on it.

OWASP's 2026 list files this under misinformation, LLM07. It says misinformation can arise from hallucination, and that people and systems often trust fluent, confident answers.

Think of a hospital pharmacist checking each dose against the patient's chart before it goes out. The pharmacist compares every order with a record, and sends doubtful ones back to the doctor. An AI assistant needs the same habit.

Key words

Claim
One fact in the answer, checked on its own.
Grounding
Tying a claim to a passage from a source you trust, such as policy wording.
Self-consistency
Asking the same question again and comparing the answers.
Retract
Taking a claim out when no source backs it.

How do you check a claim against a source?

Grounding is the check to reach for first when you have trusted sources. The model answers from passages you give it, such as policy wording or search results, and every claim must point to a passage that says it. Anthropic's guide to reducing hallucinations sets the rule plainly:

  • “If it can't find a quote, it must retract the claim.”

    Anthropic

  1. 1

    Split the reply into claims

    One fact per line, so each can be checked alone. A reply that gives a fee, a date and a rule has three claims.

  2. 2

    Find the passage

    Search the source for the passage that backs each claim. No passage, no claim.

  3. 3

    Make the model quote

    Ask for the exact words it relied on. In our system, code then checks that those words really appear in the source, because the quote itself can be made up.

  4. 4

    Remove or flag

    A claim with no matching words is removed, or sent to a person.

How a draft reply gets checked

Model's draft reply

states facts about the policy

Quoted source found?

each claim needs a matching passage

Same answer 5 times?

re-asked, then compared

Claim removed

no passage, so it goes

Reply goes out

every claim passes both checks

Person reads it

the re-runs disagree

  1. 1Each claim in the draft is checked, one at a time.
  2. 2A claim with a matching passage moves on to the re-run check.
  3. 3A claim with no passage is taken out of the reply.
  4. 4When the re-runs agree, the reply can go out.
  5. 5When the re-runs disagree, a person reads it first.
Each claim must match a passage in the source, then the same question is asked five times and the answers are compared. A claim with no source is removed. Answers that disagree go to a person.

Here is a made-up case. A mid-size insurer's claims assistant tells a customer that the excess (the amount the customer pays first) on a home claim is £250. The policy wording says £350. The check finds no passage with £250 in it, so the claim is removed before the reply goes out.

How do you catch a guess by asking again?

Some questions have no document to check against, such as a general question about a topic. Then you can test the model against itself. A 2023 survey of the field presents a thorough overview of hallucination detection methods and benchmarks, and one simple method is to ask again.

  • “However, for hallucinated facts, stochastically sampled responses are likely to diverge and contradict one another.”

    SelfCheckGPT authors

The idea is simple. If the model knows a fact, its answers to the same question tend to match. A made-up fact tends to come out differently each time. The re-asks need some randomness, so set the temperature (a setting for how much the output varies) above zero. At zero, the model often repeats itself whether or not it knows the fact. Anthropic's guide makes the same point: "Inconsistencies across outputs could indicate hallucinations."

A related method called semantic entropy, from 2023, first groups answers that mean the same thing, then measures how spread out those meanings are. It works with one model and needs no changes to it.

Both checks test consistency and support. Neither one proves that a claim is true. A model that is wrong the same way every time passes the re-run check. OWASP's 2026 list asks for checks that the answer sticks to its sources (groundedness) and that repeated answers agree (consistency), and says to use them, not only how confident the answer sounds.

Here is the insurer case in plain Python. The five re-runs are made up, and the code only compares them. A real system would ask the model five times and compare the replies.

Python
# Made-up insurer example: check a drafted reply before it goes out.
import re
POLICY = [
    "The standard excess on home claims is £350 for each claim.",
    "Accidental damage is covered once the excess is paid.",
]
RERUNS = ["£350", "£250", "£350", "£350", "£250"]  # the same question, asked five times

def backed_by_source(figure):
    return any(re.search(re.escape(figure) + r"\b", line) for line in POLICY)

def review(draft_figure):
    if not backed_by_source(draft_figure):
        return "RETRACT: no passage in the policy supports " + draft_figure
    votes = {v: RERUNS.count(v) for v in dict.fromkeys(RERUNS)}
    if len(votes) > 1:
        return "REVIEW: re-runs disagree " + str(votes)
    return "SEND: backed by the policy and consistent"

print(review("£250"))
print(review("£350"))

Output

RETRACT: no passage in the policy supports £250
REVIEW: re-runs disagree {'£350': 3, '£250': 2}

The first line fails, because £250 appears in no passage. The second line passes the source check, but the five answers split three to two, so a person reads it before it goes out. The code also needs the figure to end at a word boundary, since a plain text match would find £350 inside £3500.

Why can't one check catch everything?

Part of the reason is how models are trained and tested. A 2025 paper argues that language models hallucinate because the training and evaluation procedures reward guessing over acknowledging uncertainty. In plain words, a guess can score better than an honest "I don't know".

Each check has a blind spot. The re-run check passes a model that is wrong the same way every time. The source check matches words, so it can miss meaning: a passage can hold the right figure in the wrong context, and a checker can be fooled by a close match. A model used as the judge of a claim can be wrong too.

So who decides that a passage backs a claim? In real systems, a second model or a checker scores it. RAGAS is a framework for scoring answers from retrieval systems, which look up documents before the model answers. It uses an LLM to split an answer into statements, then checks whether each claim can be inferred from the context.

No detector is perfect. Anthropic's guide says the same about its own techniques: although they significantly reduce hallucinations, they don't eliminate them entirely.

So a person stays in the loop for risky answers. OWASP's 2026 list recommends enforcing runtime verification for high-impact actions, with approval workflows and system checks.

Tip

Asked how you'd detect hallucinations? Name two checks, the source check and the re-run check. Say no check is perfect, and say which answers go to a person.

How would you watch for hallucinations after launch?

As a starting point, not a standard: before launch, a golden set (a list of questions with checked answers) tests the model. After launch, you sample real answers and have a person mark any unsupported claim. Then you watch the share that gets flagged.

  • Golden set

    About 200 real questions, each with an answer an expert has checked. Run it after every model or prompt change.

  • Weekly sample

    A person reads 50 live answers chosen at random, and marks each unsupported claim.

  • Alert on the trend

    If the share of flagged answers rises two weeks running, pause the risky feature and look into it.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a confident claim that no source backs.
  • Two checks: grounding in a source, and asking again to compare answers.
  • Why one check fails: no detector is perfect, and one 2025 paper says training rewards guessing.
  • A person reviews risky answers, with a sample of live answers after launch.
  • How you'd measure it: a golden set, a live sample and an alert on the trend.
  • An honest limit: a check can miss a claim that has a real source but is misread.

Common traps

  • Trap"If the answer sounds sure, it is right."

    BetterHallucinations often sound sure. Check the claim against a source.

  • Trap"Our test set passed, so it does not hallucinate."

    BetterA test set covers only the questions you wrote. Keep sampling live answers.

  • Trap"Just ask the model if it is sure."

    BetterA model that made something up will often say it is sure. Use a source or a second check.

Can you spot the hallucination?

Spot the unsupported claim

Your insurer's assistant answers from this part of the home policy wording. The wording says: the standard excess is £350 for each claim; accidental damage is covered once the excess is paid; claims can be made through the app or by phone. Which reply has no support in the wording?

Quick check

Every claim in a reply has a matching quote, but the same question gives different answers across five runs. What is the best next step?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q220What is grounding?9 min
  2. Q249What is LLM-as-a-judge?12 min
  3. Q254Faithfulness vs relevance?10 min
  4. Q248What is a golden dataset, and how do you build one?11 min
  5. Q390"Your model hallucinates too much." What do you do in the first 48 hours?Coming soon

Learn it in depth

Last updated on 26 November 2026

Checking AI answers before your users see them?

I design and build AI products and agents, including the checks that catch wrong answers. Book a short call and tell me what your assistant answers and who relies on it.