A hallucination is output from an AI model, most often from large language models, that is fluent and confident but factually false, unsupported by the provided sources or inconsistent with the input. Typical examples are invented citations, fabricated statistics, nonexistent software functions, wrong dates and summaries that add details the source document never contained.
Hallucination is not a rare malfunction but a structural property of how language models generate text: they produce the most plausible continuation of a prompt, and plausibility is not the same as truth. Rates vary widely by model, task and domain, and they can be reduced substantially but not eliminated with grounding, prompting, training and verification techniques.
Why language models hallucinate
An LLM predicts the next token from a probability distribution learned during training. It stores knowledge only implicitly in its weights, compressed from vast text, and has no built-in mechanism to look facts up or to know which of its beliefs are reliable. When the prompt asks about something rare, ambiguous or absent from training data, the model still produces a statistically plausible answer rather than a refusal.
Several factors make this worse. Training objectives and evaluation practices that reward a guess over admitting uncertainty encourage confident fabrication. Sampling with a higher temperature increases the chance of selecting unlikely tokens. Long generations can compound early errors, because each token is conditioned on the previous ones, including wrong ones.
| Cause | Mechanism | Typical symptom |
|---|---|---|
| Knowledge gaps | Fact rare or absent in training data | Invented details about obscure entities |
| Knowledge cutoff | Training data ends at a fixed date | Outdated or fabricated recent events |
| Pressure to answer | Guessing rewarded over abstaining | Confident answer instead of uncertainty |
| Sampling randomness | Higher temperature selects unlikely tokens | Inconsistent answers across runs |
| Weak grounding | Model ignores or misreads supplied context | Summary adds facts not in the source |
| Ambiguous prompt | Model fills in missing assumptions | Answer to a different question |
Types of hallucination
Researchers distinguish hallucinations by what the output contradicts. Intrinsic hallucinations contradict the source or input the model was given, while extrinsic hallucinations add claims that cannot be verified from the source at all. A related distinction separates factuality errors, which contradict world knowledge, from faithfulness errors, which deviate from the provided context.
| Form | Description | Risk area |
|---|---|---|
| Fabricated references | Citations, cases or papers that do not exist | Legal, academic and medical writing |
| Invented numbers | Plausible statistics with no basis | Reports, analysis, finance |
| Entity confusion | Merging facts about similarly named people or products | Biographies, customer support |
| Unfaithful summary | Details added or meaning reversed | Document summarization |
| Nonexistent code elements | Invented functions, parameters or packages | Software development |
| Reasoning errors | Wrong intermediate step presented as valid | Math, planning, multi-step analysis |
Hallucinated package names in generated code are a recognized security risk: if an attacker registers a package under a name that models frequently invent, developers who install it without checking may run malicious code.
Hallucination compared with related errors
Not every wrong answer is a hallucination. Separating the categories helps choose the right fix, because a retrieval failure needs a different remedy from a reasoning failure or a biased output.
| Failure type | What goes wrong | Primary fix |
|---|---|---|
| Hallucination | Unsupported content generated as fact | Grounding, abstention, verification |
| Outdated knowledge | Answer was once correct | Retrieval of current sources |
| Retrieval error | Wrong or irrelevant documents supplied | Better search, reranking, chunking |
| Instruction misreading | Correct facts for the wrong question | Clearer prompts and system prompt |
| Bias | Systematically skewed content | Data curation, evaluation, guardrails |
Reducing hallucinations in practice
Mitigation works in layers, and no single technique is sufficient. The most effective step for factual applications is retrieval-augmented generation (RAG), which supplies relevant documents in the context window and instructs the model to answer only from them and to cite the passages it used.
| Technique | How it helps | Limitation |
|---|---|---|
| Retrieval and grounding | Answers drawn from supplied sources | Fails if retrieval returns wrong documents |
| Permission to abstain | Model may say it does not know | Can increase unhelpful refusals |
| Low temperature | Reduces random token choices | Does not fix missing knowledge |
| Structured output and tools | Calculators, databases and APIs supply exact values | Requires integration work |
| Self-consistency checks | Compares several sampled answers | Higher cost and latency |
| Automated verification | Second model or rules check claims against sources | Verifier can also err |
| Human review | Expert checks high-stakes output | Slow and expensive at scale |
Prompt engineering also matters. Asking for quotes from the source before the answer, requiring citations, splitting complex tasks with prompt chaining and giving explicit instructions such as answering only from the provided documents all reduce unfaithful output. Reasoning models and chain-of-thought can improve multi-step accuracy, although their intermediate reasoning can itself contain errors.
Measuring hallucination and common misconceptions
Hallucination rates are measured with task-specific evaluations: question-answering sets with known answers, summarization benchmarks scored for faithfulness to the source, and citation checks that verify every reference exists and supports its claim. Published rates are not comparable across benchmarks, because they depend heavily on task difficulty and scoring rules.
- A confident tone signals nothing: fluency and correctness are independent.
- Larger models still hallucinate, often less on common facts but persuasively on rare ones.
- Retrieval does not guarantee truth, since the model can still misread or ignore sources.
- Zero hallucination is not a realistic target; risk management through verification is.
In everyday language
An AI hallucination is when a chatbot makes something up and says it with full confidence. It might name a book that was never written or quote a law that does not exist.
This happens because the system is built to produce text that sounds right. It is a bit like a student who never leaves an exam answer blank and writes something convincing instead. Important facts from AI should always be checked against a reliable source.
Seen in the real world
A law firm uses a language model to draft research memos. In an early trial, the model produced a well-written memo citing several court decisions, two of which did not exist; the case names and quotations looked entirely authentic. The error was caught only because an associate checked every citation in the firm’s legal database.
The firm then rebuilt the workflow. The model now receives retrieved decisions from the database as context, must quote the passage supporting each statement, and is instructed to state when no supporting decision was found. A script verifies that every cited case exists in the database. Fabricated citations stopped reaching reviewers, and attorneys still read every cited passage before filing.