AI Help Center › GenAI / LLM › Why LLMs Hallucinate
GenAI / LLM · PRACTITIONER GUIDE

Why Do LLMs Hallucinate, and How Do You Reduce It?

Understand the real causes of confident wrong answers, then apply a seven-rung mitigation ladder and a Python check you can run today.

13 min readPublished 8 Nov 2026Last reviewed 8 Nov 2026
Quick insight

A language model is graded for answering, not for knowing. It was trained to produce the most plausible next words, and most tests reward a lucky guess over an honest "I don't know". Reduce hallucination by changing what the model sees and what you reward.

LLMs hallucinate because they generate the most plausible next words, not verified facts. Rare facts are learned poorly, training and benchmarks reward guessing over admitting uncertainty, and the model often lacks the context your question needs. You reduce hallucination by grounding answers in sources, allowing "I don't know", checking outputs automatically and measuring error rates.

Summary: the short version

  • A hallucination is fluent output that is false or unsupported by the source the model was given; unfaithfulness to your own documents matters most in business use.
  • The main causes are next-token prediction, rare facts in training data, scoring that rewards guessing, and missing context.
  • Hallucinations cannot be removed completely, but you can trade a little coverage for much higher accuracy by letting the model abstain.
  • Grounding with retrieval (RAG) cuts hallucinations sharply but does not end them; models still misread or embellish retrieved text.
  • Cheap automated checks, such as confirming every number in an answer appears in the source, catch costly errors before a human sees them.
GenAI / LLM

What is an LLM hallucination?

An LLM hallucination is output that sounds confident and fluent but is false, invented, or not supported by the information the model was given. There is no intent behind it: the model produces text that fits the pattern of a good answer, whether or not the facts behind it exist.

The hallucination survey by Huang and colleagues (2023) splits them into two useful families:

  • Factuality hallucinations: the answer contradicts the real world. A model says a GST return is due on a date it is not, or invents a court judgment.
  • Faithfulness hallucinations: the answer contradicts or goes beyond the source you supplied. You paste a vendor contract and the summary adds a penalty clause that is not in it.

If you build on your own documents, obsess over faithfulness: it is the one you can measure and control.

Causes

Why do LLMs hallucinate?

LLMs hallucinate because they are built to continue text plausibly, they learn rare facts poorly, their training and tests reward guessing, and they often lack the context a question needs.

Next-token prediction optimises for plausible, not true

A model is pretrained to predict the next token (see how LLMs are trained). It has no fact store to consult. When it knows a fact well, plausible and true coincide. When it does not, the plausible version still comes out, in the same confident tone.

Rare facts are learned unreliably

In OpenAI's 2025 paper "Why Language Models Hallucinate", Kalai and co-authors argue that facts appearing once or rarely in training data cannot be learned reliably from patterns. Grammar follows patterns. A particular person's birthday, or a niche circular number, does not.

Training and benchmarks reward guessing

The paper's sharper point: most evaluations grade answers right or wrong, with no credit for "I don't know". Guessing a stranger's birthday gives a 1-in-365 chance of a point; declining guarantees zero. Models tuned to climb such leaderboards learn to bluff.

The context is missing or buried

Ask about your company's leave policy or last quarter's debtor ageing and the model has never seen the answer, so it fills the gap with something typical. Even when the document is in the prompt, information buried in the middle of a long context is used less reliably than text at the start or end, as the "Lost in the Middle" study (Liu et al., 2023) showed.

Four roads to a confident wrong answer Next-token predictionoptimises for plausible, not true Rare factsseen once or never in training data Scoring rewards guessingno credit for "I don't know" Missing or buried contextyour data was never in the prompt Confident wrong answersame fluent tone as a right one
Each cause needs its own fix: grounding for missing context, abstention for rare facts, and better scoring for the incentive problem.
Types

What are the types of LLM hallucination?

In business use you will meet five recurring types, and each has a cheap first line of defence.

TypeExampleFirst line of defence
Invented factA due date or rate that no notification ever statedGround in the source; allow "not found"
Wrong number₹8,460 instead of ₹8,640 in a GST totalDo arithmetic in code; check numbers against sources
Fake citationA plausible case name, section number or URL that does not existResolve every citation against a real index
Unfaithful summaryA contract summary that adds or drops a clauseRequire quoted evidence for each claim
False premise accepted"Why did RBI cut the repo rate last week?" answered even if it did notInstruct the model to check premises first
Limits

Can you eliminate LLM hallucinations completely?

No, but you can make them rare where it matters by letting the model abstain and by scoring abstention fairly. Some answers the model cannot know; the realistic goal is a system that says "I'm not sure" instead of inventing something.

This is an old problem. The TruthfulQA benchmark (Lin, Hilton and Evans, 2021) asked 817 questions designed around common misconceptions. The best model then was truthful on 58% against 94% for humans, and the largest models were generally the least truthful, because they imitated popular falsehoods well. Models have improved since; the incentive problem has not fixed itself.

Same questions, different scoring (illustrative, 100 questions) A: always guesses 62 correct 38 wrong B: abstains if unsure 55 correct 10 35 "not sure" Accuracy onlyWrong = −1 6224 5545 Illustrative numbers, not benchmark results.
How you score your own evals decides whether you are training your team, and your prompts, to prefer bluffing.
Strong opinion

In finance, tax, legal and HR, a wrong answer costs far more than "I don't know, please check with the team". Score your evals that way.

Mitigation

How do you reduce LLM hallucinations?

Climb a ladder: permit abstention, ground answers in sources, demand citations, constrain the output format, verify automatically, measure with evals, and keep humans on high-stakes decisions. Start at the cheap end.

The hallucination mitigation ladder 1Allow "I don'tknow" 2Ground withRAG 3Requirecitations 4Structuredoutput 5Automatedchecks 6Evals on agolden set 7Humanreview
Start at the bottom. Each rung catches errors the one below it misses.
RungWhat you doWhat it catchesWhat it misses
Allow abstentionTell the model it may answer "not in the documents"Bluffing on unknownsConfident errors
Ground with RAGRetrieve relevant passages and place them in the promptMissing context, outdated knowledgeRetrieval misses, misreading
Require citationsAsk for a quote or passage ID per claimUnsupported claims become visibleReal quotes, wrong conclusion
Structured outputForce a JSON schema with fields such as answer, source_id, confidenceRambling, missing fieldsWrong values in valid fields
Automated checksCode verifies numbers, IDs and citations against sourcesInvented figures and referencesSubtle reasoning errors
EvalsScore a golden question set on every changeRegressions, measured error ratesQuestions you never thought to test
Human reviewRoute flagged or high-stakes answers to a personWhat automation cannot judgeLittle, but slow and costly

Rungs 1 to 3 fit in one prompt, which we hand to finance and HR teams in workshops (our guide to advanced prompting covers the techniques behind it). For rung 5, keep arithmetic out of the model entirely: our LangGraph agent tutorial builds a GST calculator tool for exactly this reason. The stakes rise in agentic AI systems, where a hallucinated tool argument becomes a wrong action rather than a wrong sentence.

Example prompt · Grounded answer with abstention
Answer the question using ONLY the extracts below.
For every figure or rule you state, quote the sentence it came from and give the extract ID.
If the extracts do not contain the answer, reply exactly: "Not in the provided documents."
If the question assumes something the extracts contradict, say so before answering.
EXTRACTS: [paste or retrieve]
QUESTION: [question]
Grounding

Does RAG stop LLM hallucinations?

RAG reduces hallucinations a great deal, but it does not stop them, because the model can still misread, ignore or embellish the passages it is given. Retrieval-augmented generation (Lewis et al., 2020) puts relevant text in front of the model before it answers; see how RAG works.

Grounded systems still fail in four predictable ways: the retriever fetches the wrong chunk; the right chunk sits in the middle of a long prompt and is underused; the model blends the passage with its own prior knowledge; or the source itself is outdated. The fixes: evaluate retrieval separately (chunking and the vector database you choose both affect it), keep context short and well ranked, enforce quote-per-claim, and give documents owners who keep them current. RAG vs fine-tuning explains why fine-tuning is a poor tool for teaching facts.

This is why, in Ivy Professional School's Advanced Generative AI course, we teach vector-database RAG pipelines alongside prompt engineering (including ReAct and Tree-of-Thought) rather than as separate topics: grounding fixes what the model sees, prompting fixes what it is allowed to say, and you need both.

From our classrooms

When participants in Ivy Professional School's enterprise workshops audit their first RAG prototype, the most common finding is a correct-looking answer built on an outdated policy version. Version control for source documents fixes more hallucinations than prompt tweaks do.

Verification

How can you check an LLM answer automatically in Python?

Start with deterministic checks: extract every number from the answer and confirm it appears in the source documents or tool outputs; anything left over is a candidate hallucination. Amounts, rates and dates do the most damage when wrong, and they are easy to check.

number_check.py
import re

UNITS = {"lakh": 1e5, "lakhs": 1e5, "crore": 1e7, "crores": 1e7, "cr": 1e7}
PATTERN = re.compile(r"(\d[\d,]*(?:\.\d+)?)\s*(lakhs?|crores?|cr)?\b", re.IGNORECASE)


def numbers_in(text: str) -> set[float]:
    """Every number in the text, normalised: 1,25,000 and 1.25 lakh both become 125000."""
    found = set()
    for digits, unit in PATTERN.findall(text):
        value = float(digits.replace(",", "").rstrip("."))
        if unit:
            value *= UNITS[unit.lower()]
        found.add(round(value, 2))
    return found


def unsupported_numbers(answer: str, *evidence: str) -> list[float]:
    """Numbers stated in the answer that appear in none of the evidence texts."""
    allowed = set().union(*(numbers_in(e) for e in evidence))
    return sorted(numbers_in(answer) - allowed)


source = ("Invoice INV-1002: taxable value Rs 48,000, GST rate 18%, inter-state "
          "supply (IGST). Payment due 5 Nov 2026.")
answer = ("IGST at 18% on Rs 48,000 is Rs 8,640, so the total payable is Rs 56,640. "
          "Payment is due by 15 Nov 2026.")
print(unsupported_numbers(answer, source))
# [15.0, 8640.0, 56640.0]

calculator_output = '{"igst": 8640.0, "invoice_total": 56640.0}'
print(unsupported_numbers(answer, source, calculator_output))
# [15.0]  <- the due date the model made up

print(unsupported_numbers("Turnover rose to 1.25 lakh", "Turnover: Rs 1,25,000"))
# []

The function normalises Indian formats, so ₹1,25,000 and 1.25 lakh match. In the example, the GST arithmetic is flagged until you add the calculator's output as evidence, which leaves only the invented due date (15 instead of 5). Derived numbers must come from a tool you trust.

Know the limits: the check confirms a number exists in the evidence, not that it is used correctly. Pair it with other cheap checks (cited IDs exist, quotes appear verbatim, JSON matches the schema). For meaning-level checks, use an LLM judge validated against human labels, as our guide on evaluating LLM applications explains. With no source to compare against, consistency checks such as SelfCheckGPT treat disagreement between sampled answers as a warning sign.

Worked example

Worked example: how would a Kolkata CA firm catch a made-up GST figure?

By combining a grounded prompt, a calculator tool and the number check, and routing any flagged answer to a staff member before it reaches a client. Picture a chartered accountancy firm in Kolkata whose article assistants field routine client questions about invoices and GST, and want an AI assistant to draft replies from client ledgers and internal notes.

  1. Retrieve the client's invoice record and the relevant internal note.
  2. Call a GST calculator tool for every amount.
  3. Draft with the grounded prompt above, quoting sources.
  4. Run unsupported_numbers() against record, note and tool output.
  5. Zero flags: quick check and send. Any flag: full review.

Illustrative planning arithmetic: at 400 queries a month and an 8% flag rate, 32 drafts need full review and 368 need a quick glance, so reviewer attention goes where invented figures concentrate. Measure your real flag rate in a pilot, and spot-check unflagged answers weekly, since a real number can still be the wrong one from the right document.

Action plan

What should your team do this week to reduce hallucinations?

Pick one live use case and climb the first three rungs of the ladder before touching anything fancier.

  • Add explicit permission to answer "Not in the provided documents" to every production prompt.
  • Move all arithmetic (GST, discounts, totals, ageing) into code or tools.
  • Require a quote or source ID for every factual claim in high-stakes answers.
  • Run the number check on a sample of 50 recent answers and count the flags.
  • Write 30 golden questions, including five whose answer is not in your documents, and score them with a penalty for wrong answers.
  • Decide in writing which answer types always need a human.
FAQ

Frequently asked questions

Why does ChatGPT make up facts and sources?

Because it generates the most plausible continuation of text rather than looking facts up. When it lacks reliable knowledge, a plausible-sounding answer or citation still comes out in a confident tone. Training and evaluation that reward guessing make this worse. Asking for sources helps only if someone or something checks them.

Does lowering temperature stop hallucinations?

No. Lower temperature makes outputs more consistent, but a model can be consistently wrong. It helps for repeatable extraction and testing. Reducing hallucinations needs grounding in sources, permission to abstain, automated checks on numbers and citations, and an evaluation set.

Can RAG eliminate hallucinations completely?

No. RAG greatly reduces hallucinations about your own data by putting relevant passages in the prompt, but the retriever can fetch the wrong passage, and the model can misread or embellish the right one. Measure retrieval quality and answer faithfulness separately, and require quotes for important claims.

Which LLM hallucinates the least?

It changes with every release and depends on the task, so rankings date quickly. Test candidate models on your own questions and documents, with scoring that penalises wrong answers more than abstentions. The system around the model, including grounding and checks, usually matters more than the model choice.

How do you measure hallucination rate?

Build a golden set of questions with known answers and sources, run your system on it, and count answers containing false or unsupported claims. Track abstentions separately. Use automated checks and an LLM judge for scale, calibrated against a sample of human reviews.

Sources

Sources