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.
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.
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.
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.
| Type | Example | First line of defence |
|---|---|---|
| Invented fact | A due date or rate that no notification ever stated | Ground in the source; allow "not found" |
| Wrong number | ₹8,460 instead of ₹8,640 in a GST total | Do arithmetic in code; check numbers against sources |
| Fake citation | A plausible case name, section number or URL that does not exist | Resolve every citation against a real index |
| Unfaithful summary | A contract summary that adds or drops a clause | Require quoted evidence for each claim |
| False premise accepted | "Why did RBI cut the repo rate last week?" answered even if it did not | Instruct the model to check premises first |
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.
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.
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.
| Rung | What you do | What it catches | What it misses |
|---|---|---|---|
| Allow abstention | Tell the model it may answer "not in the documents" | Bluffing on unknowns | Confident errors |
| Ground with RAG | Retrieve relevant passages and place them in the prompt | Missing context, outdated knowledge | Retrieval misses, misreading |
| Require citations | Ask for a quote or passage ID per claim | Unsupported claims become visible | Real quotes, wrong conclusion |
| Structured output | Force a JSON schema with fields such as answer, source_id, confidence | Rambling, missing fields | Wrong values in valid fields |
| Automated checks | Code verifies numbers, IDs and citations against sources | Invented figures and references | Subtle reasoning errors |
| Evals | Score a golden question set on every change | Regressions, measured error rates | Questions you never thought to test |
| Human review | Route flagged or high-stakes answers to a person | What automation cannot judge | Little, 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.
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]
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.
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.
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.
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: 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.
- Retrieve the client's invoice record and the relevant internal note.
- Call a GST calculator tool for every amount.
- Draft with the grounded prompt above, quoting sources.
- Run
unsupported_numbers()against record, note and tool output. - 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.
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.
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
- OpenAI. "Why language models hallucinate." Research post, September 2025. https://openai.com/index/why-language-models-hallucinate/
- Kalai, A. T., Nachum, O., Vempala, S. S. and Zhang, E. "Why Language Models Hallucinate." 2025. https://arxiv.org/abs/2509.04664
- Lin, S., Hilton, J. and Evans, O. "TruthfulQA: Measuring How Models Mimic Human Falsehoods." 2021. https://arxiv.org/abs/2109.07958
- Huang, L. et al. "A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions." 2023. https://arxiv.org/abs/2311.05232
- Lewis, P. et al. "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks." 2020. https://arxiv.org/abs/2005.11401
- Liu, N. F. et al. "Lost in the Middle: How Language Models Use Long Contexts." 2023. https://arxiv.org/abs/2307.03172
- Manakul, P., Liusie, A. and Gales, M. J. F. "SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models." 2023. https://arxiv.org/abs/2303.08896

By