Skip to main content

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.

📝HALLUCINATIONS ARE NOT LIES

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:

  1. 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.
  2. Training data limitations: models learn from imperfect, incomplete, and sometimes contradictory data sources, which can introduce inaccuracies.
  3. Parametric knowledge compression: information is compressed into model weights, leading to lossy reconstruction where details may be distorted or conflated.
  4. Lack of real-time knowledge: most LLMs do not have native access to live databases or external verification systems during generation.
  5. Ambiguous or incomplete prompts: vague or under-specified inputs can lead models to "fill in gaps" with fabricated information.
  6. Overgeneralization: models may apply learned patterns to contexts where they are not valid.

Types of hallucinations

TypeDescriptionExample
Factual hallucinationIncorrect dates, names, statistics, or events"The Eiffel Tower was built in 1867" (actually 1889)
Source hallucinationInvented citations or referencesCiting a paper with DOI 10.1234/fake.2023 that does not exist
Logical hallucinationInternally inconsistent reasoning"All cats are mammals. Dogs are cats. Therefore, dogs are mammals."
Contextual hallucinationMisinterpretation of user intentA user asks about Python (programming) but receives information about pythons (snakes)
Fabricated contentCreation of non-existent entities or conceptsInventing a historical figure or scientific discovery
📖A NON-EXHAUSTIVE SET

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:

  1. Retrieval-augmented generation (RAG): integrates external knowledge sources to ground model responses in verified data.
  2. Fine-tuning and alignment: improves reliability through high-quality, curated data and human feedback.
  3. Prompt engineering: carefully structured prompts reduce ambiguity and guide accurate responses.
  4. Confidence calibration: encourages the model to express uncertainty when appropriate.
  5. Human-in-the-loop systems: maintain human oversight for critical outputs.
  6. Multi-model verification: cross-checks outputs across different models to identify inconsistencies.
  7. Temperature and sampling parameters: lower temperature settings reduce randomness and creative divergence.