Skip to content
learn
  1. Learn
  2. Artificial Intelligence
  3. AI Safety, Security and Governance

AI AI-13.01

Hallucinations

Why language models state false things confidently, and how grounding, citations, permission to abstain and the right evals reduce and measure it.

Beginner 10 min Last reviewed

The big idea

Ask a chatbot for the birthday of someone only slightly famous and it may answer at once with a specific date. Ask again and you may get a different date, just as confident. Neither is from a source; both are guesses that look like facts. That is a hallucinationA fluent, plausible statement produced by a language model that is false or not supported by its sources, usually delivered with the same confidence as true statements..

A language model is trained to produce likely text, not verified truth. For facts that appear often in its training data, likely and true are usually the same thing. For rare facts, such as a birthday mentioned once on one web page, there is no pattern to learn, and the most fluent continuation is a guess.

Think of a student in an exam where blank answers score zero and wrong answers also score zero. The rational strategy is to guess on every question. A model trained and graded the same way learns the same habit. If you want "I don't know" when it does not know, you have to make that answer possible, and worth more than a confident wrong one.

How it works

Why models confabulate

  • Rare facts cannot be learned from patterns. Spelling and grammar follow patterns, so errors there disappear with scale. A fact that appears once in the training data has no pattern behind it. Researchers have shown that for such "arbitrary" facts, a base model's hallucination rate is at least roughly the share of facts that appeared only once: if 20 percent of birthday facts appear exactly once, expect at least about 20 percent wrong birthdays.
  • Grading rewards guessing. Most benchmarks score accuracy only. A guess sometimes scores; "I don't know" never does. Models tuned to climb those leaderboards learn to guess.
  • Pressure from the prompt. A question that assumes something false ("Why did the company close in 2019?") or asks for a quote, a citation or a number invites the model to produce one.
  • Missing or ignored context. If retrieval returns nothing useful, or the answer sits in a part of a long context the model attends to poorly, the model falls back on what sounds right.

The fixes, in order of strength

A grounded answer pipeline Step 1: the question comes in and relevant documents are retrieved. Step 2: the model answers using only those documents, citing a quote for each claim, and is allowed to say it does not know. Step 3: code checks that every quoted passage really appears in the sources. Claims with a verified quote are shown with citations; unsupported claims are removed or the model abstains, and the case is logged for the eval set. sources supported not found question retrieve relevant documents model quotes or I don't know verify quotes in the sources? answer with citations remove or abstain log for evals Figure 1. Grounding gives the model sources, citations make each claim checkable, and the verifier (glowing) catches what slips through. Step through it.
  1. Retrieve Fetch documents relevant to the question so the model answers from sources, not memory.
  2. Answer with quotes, or abstain Instruct the model to use only the documents, to attach a word-for-word quote to each claim, and to say it does not know when the documents do not answer the question.
  3. Verify and route Code checks each quote against the sources. Supported claims are shown with citations; unsupported ones are removed, and the failure is logged as a new eval case.
  1. Ground the answer. Give the model the relevant documents ( Why RAG? ) and tell it to answer only from them. This moves the job from recalling facts to reading them, which models do far more reliably.
  2. Allow and encourage abstention. Say explicitly that "I don't know" or "the documents do not say" is an acceptable answer. Anthropic's guide to reducing hallucinations lists this first and says it can drastically reduce false information.
  3. Ask for quotes and citations. For long documents, have the model extract word-for-word quotes first and reason from them. Then each claim carries evidence a person, or code, can check.
  4. Verify. Check that cited quotes really exist in the source; ask the model to re-check each claim and retract any it cannot support; for high-stakes answers, compare several samples, since disagreement between them is a warning sign.
  5. Use tools for what tools do better. Dates, arithmetic, prices and stock levels should come from a calculator, a database or an API call, not from the model's memory.

None of these drives the rate to zero. They lower it and, as important, make the remaining errors visible.

Try it

This interactive needs JavaScript. The diagrams and text above cover the same idea.

  1. Keep "accuracy only" and move the threshold up from 0. The wrong answers drop, but what happens to the score? This is why accuracy-only leaderboards reward guessing.
  2. Switch to "wrong = -3". Where is the best threshold now? Compare it with 3 / (1 + 3) = 0.75.
  3. Set "wrong = -9", the kind of cost a wrong medical or legal answer carries. How many questions should the model now decline, and is that a failure or the right behaviour?

Measuring it in Python: grade answers as correct, wrong or abstained, then check citations:

measure.pyruns with python3 (standard library)
# Measure hallucination the way short-answer factuality evals do: each answer is
# correct, incorrect, or not attempted. Then check that every cited quote really
# appears in the source, a cheap guard for grounded (RAG) answers.
# Answers and sources are made up for illustration.

gold = {"q1": "1889", "q2": "Canberra", "q3": "8", "q4": "Lisbon", "q5": "1969"}
model_a = {"q1": "1889", "q2": "Sydney", "q3": "8", "q4": "Porto", "q5": "1969"}
model_b = {"q1": "1889", "q2": "Canberra", "q3": None, "q4": None, "q5": "1969"}  # None = "I don't know"

def grade(answers):
    c = sum(answers[q] == gold[q] for q in gold)
    na = sum(answers[q] is None for q in gold)
    w = len(gold) - c - na
    return c, w, na

for name, ans in [("A (always answers)", model_a), ("B (abstains)", model_b)]:
    c, w, na = grade(ans)
    print(f"{name:19} correct {c}/5  wrong {w}/5  abstained {na}/5  "
          f"wrong when it answered {w / (c + w):.0%}")

source = ("The refund window is 30 days from delivery. Opened software "
          "cannot be returned. Refunds go back to the original payment method.")
claims = [
    ("You have 30 days to return it.", "The refund window is 30 days from delivery."),
    ("Refunds can be paid as store credit.", "Refunds go back as store credit."),
]
for claim, quote in claims:
    ok = quote in source
    print(f"{'supported  ' if ok else 'UNSUPPORTED'} {claim}")

Output

A (always answers)  correct 3/5  wrong 2/5  abstained 0/5  wrong when it answered 40%
B (abstains)        correct 3/5  wrong 0/5  abstained 2/5  wrong when it answered 0%
supported   You have 30 days to return it.
UNSUPPORTED Refunds can be paid as store credit.

Both models have the same accuracy, 3 out of 5. Model A is wrong 40 percent of the time it answers; model B never is. An accuracy-only score cannot tell them apart. The quote check catches the second claim because its "quote" is not in the source at all.

Going deeper

Measuring hallucination rates

Report three numbers, not one: correct, incorrect and not attempted. OpenAI's SimpleQA benchmark grades short factual answers exactly this way. Then track the error rate on attempted answers alongside accuracy, so a model that guesses less is not punished for it. For long answers, split the text into small factual claims and check each against a trusted source; the FActScore method does this, and found that one widely used chat model's biographies had only 58 percent of their atomic facts supported. For your own product, build the eval from your own questions and documents ( Building an eval set ) and include questions the documents cannot answer, where the right response is to abstain.

Scoring that rewards honesty

Kalai and colleagues propose stating a confidence target in the instructions: answer only if you are more than t confident, because wrong answers cost t / (1 - t) points, right ones earn 1 and "I don't know" earns 0. With t = 0.75 a wrong answer costs 3. A model whose confidence is calibrated then maximizes its score by answering exactly when it is more than 75 percent sure, which is what the lab shows.

Trade-offs

OptionWins whenLoses when
Answer from memory Fast, no retrieval system Hallucinates rare and recent facts; nothing to cite
Ground in retrieved documents Answers from sources; citations possible Only as good as retrieval; bad chunks still mislead
Encourage abstention Far fewer confident errors More unanswered questions; can become over-cautious
Verify quotes and claims Catches unsupported claims before users see them Extra latency and cost; does not catch a real quote used wrongly
Sample several times and compare Disagreement flags shaky answers Several times the cost; consistent errors pass

Common mistakes

  • Treating a fluent, detailed answer as evidence it is true. Specific details such as dates, names and citations are exactly where guesses hide.
  • Never telling the model it may say "I don't know", then counting refusals as failures in your eval.
  • Measuring only accuracy, so a model that guesses more looks better than one that abstains appropriately.
  • Asking the model for citations and never checking that they exist.
  • Using the model for arithmetic, prices or live data that a tool or database should supply.

In the wild

Kalai et al., 2025 (paper and OpenAI post)

Why Language Models Hallucinate (opens in a new tab)

The authors argue that hallucinations start as ordinary errors in a hidden classification problem (is this statement valid?) and survive because most evaluations grade only right or wrong, so guessing beats admitting uncertainty. Their proposed fix is socio-technical: change the scoring of the mainstream benchmarks to give credit for appropriate abstention, for example with explicit confidence targets, rather than adding a few separate hallucination tests.

Avianca sanctions order (US District Court, 2023)

Opinion and Order on Sanctions, S.D.N.Y. case 22-cv-1461 (opens in a new tab)

Lawyers in a lawsuit against an airline filed a brief citing court decisions that a chatbot had generated and that did not exist. The court imposed a 5,000 dollar penalty and ordered the lawyers to send letters to each real judge falsely named as the author of a fake opinion. The lesson: a citation is only evidence once someone has checked it exists.

Moffatt v. Air Canada, 2024 (case summary)

BC Tribunal Confirms Companies Remain Liable for Information Provided by AI Chatbot (opens in a new tab)

An airline's support chatbot told a traveller they could buy a full-price ticket and apply for a reduced bereavement fare within 90 days, which contradicted the airline's actual policy. The airline argued it could not be liable for its chatbot's answers, even calling the chatbot a separate legal entity. British Columbia's Civil Resolution Tribunal (2024 BCCRT 149) rejected that and found negligent misrepresentation. A company answers for what its bot says.

Check yourself

  1. Why do language models hallucinate rare facts such as an obscure person's birthday?

    Show answer

    B. Training teaches likely text, and a fact seen once has no pattern to learn, so the likeliest output is a guess Common facts are reinforced many times and become reliable. A fact seen once cannot be predicted from patterns, so the model produces something plausible instead.

  2. Two models have equal accuracy. Model A answers every question; model B says I don't know on the ones it is unsure of. Which is better for a medical help line?

    Show answer

    B. B, because it makes fewer confident errors and its gaps can be routed to a person With equal accuracy, B's errors become abstentions. Where a wrong answer is costly, an honest 'I don't know' is worth much more than a confident guess.

  3. Which change most directly reduces hallucinations in a support bot that answers policy questions?

    Show answer

    B. Retrieve the policy documents and instruct the model to answer only from them, with quotes, or say it does not know Grounding turns recall into reading, quotes make claims checkable, and permission to abstain removes the pressure to guess. Temperature 0 makes output repeatable, not true.

  4. An eval reports 80 percent accuracy. What else do you need to know about hallucination?

    Show answer

    B. How many of the other 20 percent were wrong answers versus abstentions 80 percent correct with 20 percent wrong is very different from 80 percent correct with 20 percent honest abstentions. Report correct, incorrect and not attempted separately.

  5. Your bot cites a quote for each claim. What is the cheapest useful check?

    Show answer

    B. Verify in code that each quoted passage actually appears in the source A string match against the source catches invented quotes for almost no cost. It will not catch a real quote used to support the wrong claim, so keep human review for high-stakes answers.

Recap

  • Hallucinations are confident, plausible statements that are false or unsupported; they come from predicting likely text, not verified truth.
  • Rare facts and accuracy-only grading make guessing the model's best strategy unless abstaining is allowed and rewarded.
  • Ground answers in retrieved sources, allow I don't know, require quotes, and verify them in code.
  • Measure correct, incorrect and not-attempted separately, and include questions your documents cannot answer.
  • No technique reaches zero: route high-stakes answers to people and use tools for numbers and live data.

Get new lessons by email

Get new posts on backend and AI internals. No spam, unsubscribe anytime.

Your email is only used to send new posts. Privacy