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.

What Is a Hallucination?

What an AI hallucination is, why language models make things up, and how teams limit the damage, explained for your AI interview.

In short

A hallucination is when an AI model states something false or made up in a confident, believable way. It happens because models learn to predict likely next words, and rare facts have no pattern to copy, so they fill the gap with a plausible guess.

11 min readBeginnerVery common · 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 when an AI model states something false in a confident, believable way. It happens because the model learns to predict likely next words. Rare facts have no pattern to copy, so it fills the gap with a plausible guess. Tests also tend to reward a confident guess over an honest I don't know. Nobody has removed it completely, so I limit the damage. I give the model the real text, make it quote its source, and let it say it doesn't know.

What is a hallucination, in plain words?

A hallucination is when a language model states something false or made up, in a confident and believable way. The wrong answer reads just as smoothly as a right one, so a reader can't tell them apart by tone.

Picture a new teller at a bank counter. A customer asks about a fee the teller has never seen. A careful teller checks the fee schedule. A weak one answers from memory, sounds sure, and gets it wrong. The customer leaves with the wrong number and trusts it.

The same thing happens in AI products. A support assistant at a mid-size bank is asked about a card's late fee. It replies with a confident figure and says it comes from the tariff. The tariff says £12. The reply is a hallucination, and the bank now has an angry customer.

Key words

Hallucination
A confident answer that is false or made up.
Pretraining
The first training stage, where the model learns to predict the next word in huge amounts of text.
Grounding
Giving the model real source text to answer from, instead of relying on its memory.
Abstain
Admitting it does not know, instead of guessing an answer.

Why does a model make things up?

The first training stage is pretraining. The model learns by predicting the next word in huge amounts of text. Nobody labels each sentence as true or false, so the model never gets a clear signal about which facts are correct.

Patterns that repeat get learned well. Spelling and parentheses follow consistent patterns, so errors there fade as the model grows. A rare fact has no repeating pattern, so the model cannot work it out from other text. It fills the gap with the most likely-sounding answer, and that answer can be false.

Where a hallucination comes from

Training text

lots of text, no true or false labels

Predict next word

picks what usually comes next

What it learns

Common patterns

spelling and parentheses repeat

Rare facts

rare facts can't come from patterns

Confident guess

fluent and wrong, but sounds sure

  1. 1The model reads huge amounts of text and learns to predict each next word.
  2. 2Patterns that repeat, like spelling, get learned well.
  3. 3A rare fact has no repeating pattern, so the model has to fill the gap.
  4. 4The gap gets filled with a guess that reads smoothly but may be false.
Training asks the model to predict the next word in huge amounts of text, with no true or false labels. Patterns like spelling get learned well. Rare facts have no pattern to copy, so the model fills the gap with a confident guess.
  • “If incorrect statements cannot be distinguished from facts, then hallucinations in pretrained language models will arise through natural statistical pressures.”

    Kalai, Nachum, Vempala and Zhang, arXiv 2025

  • “Hallucinations remain a fundamental challenge for all large language models, but we are working hard to further reduce them.”

    OpenAI, 2025

Why don't models just say I don't know?

Most tests score answers, not honesty. A right answer earns a point. A wrong answer earns nothing extra. A blank earns nothing. So a model that guesses can score higher than one that admits it does not know. OpenAI says most scoreboards rank models on accuracy, so models learn to guess.

  1. 1

    Scoring A: right is 1, wrong is 0, blank is 0

    A bot guesses a fee answer it has a one in four chance of getting right. The guess scores 0.25 on average. A blank scores 0, so the guess wins.

  2. 2

    Scoring B: right is 1, wrong is -1, blank is 0

    The same guess now scores 0.25 minus 0.75, which is -0.5 on average. Saying I don't know now wins.

OpenAI suggests scoring tests so that confident errors cost more than honest uncertainty. That idea is not new. Some standardised exams have long used negative marking for wrong answers.

Even so, OpenAI says accuracy will never reach 100%, because some real-world questions cannot be answered from the information available. Honest abstaining is part of the fix.

How do teams limit hallucinations at work?

Teams can't count on a model never to make things up, so they limit the damage. The steps below sit on top of each other, so one missed step is not the end.

Limiting hallucinations in a work bot

Staff question

a fee, a clause, a limit

Grounded answer

Fetch the real text

the policy, not memory

Quote, then answer

each claim needs a quote

Quote in the source?

code checks, not the model

Outcome

Send the answer

every claim is backed

Say I don't know

or drop the claim

  1. 1The question starts a lookup of the right document.
  2. 2The model reads that text and writes its answer with quotes.
  3. 3Code checks that each quote is really in the source.
  4. 4Quote found: the answer goes out with its source.
  5. 5Quote missing: the claim is dropped, or the bot says it does not know.
A staff question is answered from the real policy text, with a quote for each claim. Code checks that each quote exists in the source. If one is missing, the claim is dropped or the bot says it does not know.
  1. 1

    Let it say I don't know

    Tell the model it may admit uncertainty. Anthropic says this technique can drastically reduce false information.

  2. 2

    Make it quote its source

    Each claim comes with a quote from the real text. On long documents, ask for word-for-word quotes first. If no quote can be found, the claim goes.

  3. 3

    Check the quotes in code

    Anthropic's method has the model find each quote itself. Our extra step: code confirms the quote is really in the source, so the model cannot mark its own homework.

  • “although these techniques significantly reduce hallucinations, they don't eliminate them entirely.”

    Anthropic, Claude docs

  • “Misinformation can arise from hallucination, incomplete or stale context, weak grounding, ambiguous prompts, biased or corrupted data, misleading summaries, or unvalidated tool outputs.”

    OWASP, LLM07:2026 Misinformation

Here is the check in plain Python. The model states a claim and quotes its source, and the marked lines decide whether it goes out. The check proves the quote exists. It does not prove the quote supports the claim, so a person still reviews important answers.

Python
# A citation check: the model states a fact and quotes its source, and code checks the quote is really there.
# It proves the quote exists, not that it supports the claim.
SOURCE = """Refunds are paid within 7 working days of approval.
A late payment on a card attracts a fee of £12."""

answers = [
    ("Refunds take 7 working days.", "Refunds are paid within 7 working days"),
    ("A late card payment costs £35.", "A late payment on a card attracts a fee of £35"),
]

for claim, quote in answers:
    if quote in SOURCE:
        print("OK:  " + claim)
    else:
        print("CUT: " + claim + " (quote not in source)")

Output

OK:  Refunds take 7 working days.
CUT: A late card payment costs £35. (quote not in source)

How would you stop a support bot from quoting fees it made up?

Start with the fee schedule. The bot answers from that document only, quotes the line it used, and says it does not know when the document is silent. A code check tests each quote against the file before the reply is sent.

  • Without the fix

    Answer from memory

    The bot names a fee from what it learned in training. It sounds sure, and nothing checks it.

  • With the fix

    Quote, check, then send

    The bot quotes the tariff line. Code confirms the quote is there, or the reply says it does not know.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a confident answer that is false or made up.
  • Why it happens: next-word prediction, and rare facts have no pattern.
  • Why it persists: tests often reward a confident guess over I don't know.
  • Honest limits: it can be reduced, but it remains a fundamental challenge.
  • Fixes you can build: grounding, quotes, permission to abstain, and checks in code.
  • A work example, such as a bot quoting a fee the tariff does not contain.

Common traps

  • Trap"Hallucinations mean the model is broken."

    BetterIt is a known limit of how models are trained and scored, so plan around it.

  • Trap"A bigger model stops hallucinating."

    BetterSize does not remove the pressure to guess. Keep grounding and checks at any size.

  • Trap"If the answer sounds confident, it's probably right."

    BetterFluent text can still be false. The core risk is that a wrong output gets trusted and acted on.

Can you spot the hallucination?

Spot the hallucination

The bot's documents say the card late fee is £12. A customer asks about it. Which reply is a hallucination?

Quick check

A support bot is asked about a fee that is not in its documents. Which setup most reduces the chance it invents an answer?

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. Q134How do you reduce hallucinations in RAG?13 min
  3. Q219How do you detect hallucinations?12 min
  4. Q390"Your model hallucinates too much." What do you do in the first 48 hours?Coming soon
  5. Q135How do you add citations?11 min

Learn it in depth

Last updated on 26 November 2026

Building a bot that answers from your own documents?

I design and build AI agents and their guardrails, including grounding, quote checks and tests with questions the documents can't answer. Book a short call and tell me what yours needs to do.