Why Large Language Models Hallucinate - LLM Hallucinations: Definition, Causes, Examples, and Mitigation
Opening Anecdote: 3 Supposed “Facts”
- Speaker challenges audience to find a link among three space/aviation statements.
- 54million km said to be the Earth–Moon distance.
- Reality: 54million km ≈ closest Earth–Mars distance; Earth–Moon ≈ 384400km.
- Claim: Speaker worked at a major Australian airline before IBM.
- Reality: It’s the speaker’s brother, not the speaker.
- Claim: The James Webb Space Telescope (JWST) captured the first exoplanet image.
- Reality: First exoplanet image taken in 2004 (before JWST launched).
- Common thread: All three are LLM hallucinations—fluent, plausible-sounding but incorrect outputs.
What Is an LLM Hallucination?
- Output that deviates from factual truth or contextual logic.
- May be minor inconsistencies or fully fabricated/contradictory statements.
- Occurs in models such as ChatGPT, Bing Chat, Bard, etc.
Granularity / Types of Hallucinations
- Sentence Contradiction
- Consecutive sentences disagree.
- Example: “The sky is blue today.” → “The sky is green today.”
- Prompt Contradiction
- Generated text conflicts with explicit user instruction.
- Example: Prompt: Write a positive restaurant review. Response: “The food was terrible and the service was rude.”
- Factual Contradiction / Factual Error
- Model states an empirically false fact.
- Example: “Barack Obama was the first president of the United States.”
- Nonsensical or Irrelevant Additions
- Content unrelated or meaningless in context.
- Example: “The capital of France is Paris. Paris is also the name of a famous singer.”
Why Do Hallucinations Occur?
1. Data Quality
- Training corpora (Wikipedia, Reddit, web crawl) contain noise, errors, bias, inconsistencies.
- Topic coverage may be incomplete ⇒ model generalizes beyond data.
- Improved reasoning abilities typically reduce hallucination frequency.
2. Generation Method / Objective
- Algorithms: beam search, stochastic sampling, maximum-likelihood estimation, reinforcement learning.
- Inherent trade-offs
- Fluency ↔ Diversity
- Coherence ↔ Creativity
- Accuracy ↔ Novelty
- Example: Beam search leans toward high-probability but generic words; may drop specific correct details.
3. Input Context
- Prompt acts as guidance; if unclear, contradictory, or incomplete, model gets confused.
- Example:
- Prompt: “Can cats speak English?”
- Without context → “No.”
- Within a Garfield-comic discussion → “Yes, Garfield speaks English and loves lasagna.”
- Context also includes task framing (academic essay vs. creative fiction).
How to Minimize Hallucinations
A. Craft Clear, Specific Prompts
- Detail what, who, when, format, and scope.
- Example improvement:
- Vague: “What happened in World War Two?”
- Better: “Summarize major events of World War Two, list key countries involved, and explain primary causes.”
B. Active Mitigation via Model Parameters
- Temperature controls randomness.
- Low temperature ⇒ conservative, focused, fewer hallucinations.
- High temperature ⇒ diverse, creative, higher hallucination risk.
- Other tunables (top-p, max tokens, etc.) can be adjusted similarly.
C. Multi-Shot Prompting (Few-Shot Examples)
- Supply multiple samples of desired style/format.
- Helps model infer patterns, remain on-task.
- Especially useful for code generation, poetry, specialized Q&A, or rigid templates.
Ethical & Practical Implications
- Incorrect outputs can misinform, harm credibility, or propagate bias.
- Responsibility on users & developers to verify critical info and apply guardrails.
Key Takeaways
- Hallucinations = plausible yet false outputs from LLMs.
- Root causes span training data, generation algorithms, and prompt context.
- Mitigation: better prompting, parameter tuning, multi-shot examples, continual model refinement.
- Understanding limitations lets us “harness the true potential” while avoiding 54million km-scale errors.
- Speaker enjoyed reading about a fictional Australian-airline career—illustrates how convincing hallucinations can be.
- Audience invited to leave questions, like, and subscribe for future content.