Lesson 4 of 5·7 min read

Understanding and Preventing Hallucinations 🔧

In 2023, a lawyer filed a brief citing six court rulings — all of which had been fabricated by ChatGPT. The case made headlines worldwide and became the prime example of AI hallucinations. Even in 2026, hallucinations are not fully solved, but the tools for containment have become significantly better. Understanding them allows you to deploy AI safely nonetheless.


🎯 What You'll Learn

  • Why LLMs hallucinate — the technical explanation made accessible
  • How to confidently distinguish the four types of hallucinations
  • Grounding techniques compared: RAG, citations, web search
  • How to build a practical verification workflow for your daily work

Why Do LLMs Hallucinate? 🧠

📖 Definition: An AI hallucination is a model-generated statement that sounds plausible but is factually wrong — fabricated facts, non-existent sources, or logically incorrect conclusions.

LLMs are statistical text generators. They calculate the most probable next token (word or word fragment) based on the preceding context. This means:

  • 📊 They optimize for plausibility, not correctness
  • 🧩 When information is missing, they fill gaps with plausible but fabricated content
  • 🔄 They cannot distinguish between "knowing" and "guessing"
  • ⏰ They have no access to real-time information (without tools)

💡 Tip: Hallucinations are not a bug but a feature of the architecture. Every LLM hallucinates — the question is how frequently and how you handle it.


The Four Types of Hallucinations 🎭

TypeDescriptionExampleRisk
📚 Factual hallucinationFabricated facts or events"Company X's revenue in 2025 was exactly 4.7 billion euros" (entirely made up)🔴 High
📄 Source fabricationCiting non-existent sources"According to a 2025 Harvard study…" (study does not exist)🔴 Very high
🔢 Numeric hallucinationWrong numbers, calculations"23% of 450 is 115" (would actually be 103.5)🟡 Medium
🔗 Logical hallucinationCorrect facts, wrong conclusion"A leads to B, B leads to C, therefore A directly leads to D"🟡 Medium

⚠️ Caution: Source fabrication is particularly dangerous because it suggests trustworthiness. When an LLM cites a "study," always verify whether it actually exists — no matter how convincing the reference sounds.


Grounding Techniques Compared ⚓

Grounding refers to methods that anchor AI responses in verified facts:

TechniqueHow It WorksHallucination ReductionEffort
🔍 RAG (Retrieval-Augmented Generation)Model first searches own knowledge base⬇️ 60–80%Medium to high
📎 CitationsModel must back each claim with a source⬇️ 40–60%Low
🌐 Web SearchModel accesses current web content⬇️ 50–70%Low
🔗 Combination RAG + CitationsKnowledge base plus source references⬇️ 80–95%High

🏢 Real-world example: A consulting firm implemented RAG with their internal knowledge base (15,000 documents). Before RAG, 23% of AI-generated reports contained factual errors. After RAG, the rate dropped below 3%. The investment paid for itself in 4 months.


Model-Specific Tendencies (February 2026) 🤖

Not all models hallucinate equally:

  • 🟢 Claude Opus 4.6: More frequently says "I'm not sure" rather than guessing — strong hallucination control through Constitutional AI
  • 🟢 GPT-5: Significantly improved over GPT-4, especially for numeric tasks
  • 🟡 Gemini 3.1: Strong on facts thanks to real-time web access, occasional errors on niche topics
  • 🟡 Llama 4: Good for general tasks, higher hallucination rate on specialized knowledge

💡 Tip: For applications where accuracy is critical (law, finance, medicine), choose models with demonstrably low hallucination rates and combine them with RAG.


Practical Verification Workflow ✅

A proven four-stage process for safely handling AI output:

Stage 1: 🤖 AI generates response (with citation prompt)
Stage 2: 🔍 AI checks its own response for internal consistency
Stage 3: 📊 Automatic comparison with verified data sources
Stage 4: 👤 Human verifies critical facts and approves

Additional safeguards:

  • 🌡️ Lower temperature: Set to 0.0–0.3 for fact-based tasks
  • 📝 Prompt design: "If you are unsure, say so. Do not fabricate information."
  • 🏷️ Confidence labels: Have AI output tagged with certainty estimates
  • 📋 AI labeling: Clearly communicate internally and externally which content is AI-generated

🔑 Remember: Trust AI output like a brilliant intern — impressively fast and often correct, but always worth checking. The more critical the application, the more verification needed.


📋 Summary

  • Hallucinations are a feature of LLM architecture, not a bug — they occur with every model
  • The four types (factual, source, numeric, logical) require different countermeasures
  • RAG + citations is the most effective combination and can reduce hallucinations by 80–95%

🎯 Exercise: Ask the same LLM the same specialized question from your domain three times. Compare the answers — discrepancies are an indicator of hallucination risk. Document where the model responds consistently and where it is uncertain.


Next lesson: Data governance for AI projects — how to ensure compliance and data protection.

📝

Quiz

Question 1 of 4

Warum halluzinieren LLMs?