Hallucinations
In the context of Generative AI and Large Language Models (LLMs), hallucinations refer to the phenomenon in which a model generates outputs that are fluent and plausible but factually incorrect, misleading, or unsupported by reliable evidence.
These outputs are not random errors. They are coherent responses produced by the model based on learned statistical patterns rather than verified knowledge.
The model has no intentionality or awareness that it is producing false information. A hallucination is a pattern-based prediction that happens to be wrong, not a deliberate falsehood.
Why "hallucinations"?
The term draws an analogy with human hallucinations, where the brain perceives things that are not present in reality. Similarly, LLMs "perceive" and generate content based on internal patterns rather than external truth.
Causes of hallucinations
Hallucinations arise from structural characteristics of LLMs, such as:
- Probabilistic generation: LLMs generate text by predicting the most likely next token, not by validating facts. As a result, they prioritize linguistic coherence over factual accuracy.
- Training data limitations: models learn from imperfect, incomplete, and sometimes contradictory data sources, which can introduce inaccuracies.
- Parametric knowledge compression: information is compressed into model weights, leading to lossy reconstruction where details may be distorted or conflated.
- Lack of real-time knowledge: most LLMs do not have native access to live databases or external verification systems during generation.
- Ambiguous or incomplete prompts: vague or under-specified inputs can lead models to "fill in gaps" with fabricated information.
- Overgeneralization: models may apply learned patterns to contexts where they are not valid.
Types of hallucinations
| Type | Description | Example |
|---|---|---|
| Factual hallucination | Incorrect dates, names, statistics, or events | "The Eiffel Tower was built in 1867" (actually 1889) |
| Source hallucination | Invented citations or references | Citing a paper with DOI 10.1234/fake.2023 that does not exist |
| Logical hallucination | Internally inconsistent reasoning | "All cats are mammals. Dogs are cats. Therefore, dogs are mammals." |
| Contextual hallucination | Misinterpretation of user intent | A user asks about Python (programming) but receives information about pythons (snakes) |
| Fabricated content | Creation of non-existent entities or concepts | Inventing a historical figure or scientific discovery |
The table above shows a small, non-exhaustive set of examples. While there are several methods to identify hallucinations (human review, fact-checking, automated verification systems), fully automated detection remains an open research challenge.
Mitigation strategies
To reduce the occurrence of hallucinations, several approaches can be employed:
- Retrieval-augmented generation (RAG): integrates external knowledge sources to ground model responses in verified data.
- Fine-tuning and alignment: improves reliability through high-quality, curated data and human feedback.
- Prompt engineering: carefully structured prompts reduce ambiguity and guide accurate responses.
- Confidence calibration: encourages the model to express uncertainty when appropriate.
- Human-in-the-loop systems: maintain human oversight for critical outputs.
- Multi-model verification: cross-checks outputs across different models to identify inconsistencies.
- Temperature and sampling parameters: lower temperature settings reduce randomness and creative divergence.