Return to Mind & Machine

When AI Makes Things Up

A survival guide for dealing with LLM hallucinations

What Is a Hallucination?

You ask an AI about the winner of the 2025 Turing Award. It gives you Dr. Zhang Wei, his groundbreaking paper, and a detailed biography. Only problem? None of it exists. The award hasn't even been announced yet.

Your Question
LLM Process
Fake Answer
Sounds perfectly reasonable
Confidently delivered
Completely fabricated
No warning given

Hallucinations aren't bugs. They're an emergent property of how language models work. The model isn't lying - it's doing exactly what it was trained to do.

Every AI Researcher, Eventually

The Core Mechanism

  • LLMs are pattern-matching engines, not databases
  • Predict next word based on statistical probabilities
  • When data is missing, they improvise instead of admitting ignorance
  • The result: confident, plausible-sounding fiction

The Hallucination Taxonomy

Factual Fabrication
Invents facts, dates, names, or citations that never existed
"Dr. Zhang Wei won the 2025 Turing Award"
Entity Confusion
Mixes up attributes of real people, places, or things
Einstein quote → Feynman
Logical Hallucination
Wrong math wrapped in correct-looking logic
2+2=5 with elaborate proof
Context Contradiction
Ignores what you told it, adds outside info
Facts not in the provided document
Temporal Hallucination
Wrong dates, outdated data, future predictions
2025 revenue with 2022 numbers

How LLMs Generate Text

An LLM is a probability machine. Given text, it calculates the odds for each possible next word, then picks one.

Next-Token Prediction
// Input "The capital of France is" // Probabilities calculated P("Paris") = 0.92 ✓ P("Lyon") = 0.03 P("Zibble") = 0.0001 // Output "Paris"
The Problem: The model doesn't "know" facts. It only recognizes patterns. When patterns are weak or missing, it still generates something - that's where hallucinations come from.

When Patterns Fail

  • Underrepresented data: Rare topics get interpolated → fabricated details
  • Ambiguous contexts: Similar topics blend together → mixed-up facts
  • Missing entirely: No data at all → pure imagination

Why Hallucinations Happen

1

Statistical Pattern Matching

  • No structured knowledge base
  • Rare facts = weak signals = corruption
  • Learn associations, not truths
2

Training Data Issues

  • Knowledge cutoffs (frozen in time)
  • Internet noise and contradictions
  • Conflicting information learned
3

The Compression Problem

  • Billions of parameters compress trillions of tokens
  • Lossy compression degrades fine details first
  • High-level patterns survive, specifics don't
4

Decoding Strategy

  • High temperature = more random = more hallucinations
  • Low temperature = deterministic but repetitive
  • No perfect setting exists
5

Model Size Matters

  • Smaller models = fewer parameters = more hallucinations
  • Less self-correction capability
  • More confidently wrong

Lab Setup

Time to test this yourself. We'll use two models with very different capabilities:

Model Size Type Behavior
Qwen3.5-Plus Large Premium More factual, nuanced reasoning
Qwen3-4B 4B params Lightweight Fast, more prone to hallucination

Python Setup

client.py
import openai # Initialize client client = openai.OpenAI( base_url="https://dashscope.aliyuncs.com/compatible-mode/v1/", api_key="YOUR_DASHSCOPE_API_KEY" ) def ask(model: str, prompt: str, temperature: float = 0.3) -> str: response = client.chat.completions.create( model=model, messages=[{"role": "user", "content": prompt}], temperature=temperature, max_tokens=1024, # Required for qwen3 models on DashScope extra_body={"enable_thinking": False} ) return response.choices[0].message.content BIG = "qwen3.5-plus" SMALL = "qwen3-4b"

Test 1: Fake Citations

Ask for academic papers on a niche topic. Watch the model invent references.

test_citations.py
prompt = """ List 5 papers after 2023 about retrieval-augmented generation for low-resource African languages. Include authors, title, journal, and year. """ print("=" * 50) print("LARGE MODEL (qwen3.5-plus):") print(ask(BIG, prompt)) print("=" * 50) print("SMALL MODEL (qwen3-4b):") print(ask(SMALL, prompt))
1. "AfriRAG: Retrieval-Augmented Generation for Low-Resource African Languages" by Amara Okafor et al. (2023) - ACL 2. "Retrieval-Augmented Generation for Swahili: A Case Study" by authors from University of Nairobi and Technical University of Munich (2024) - EACL 3. "RAG-Enhanced Language Models for Yoruba and Igbo" by Kwame Asante et al. (2024) - NAACL 4. "Cross-Lingual RAG for African Languages" by Fatima Bello and colleagues (2023) - Workshop on African NLP 5. "AfroRAG: A Comprehensive Survey" by collective authors from African AI institutes (2024) - AI and Society Journal

✓ Hallucination detected: 5 papers with detailed metadata, none verified on Google Scholar or ACL Anthology
1. "RAG-based Language Models for Low-Resource African Languages" by Adebayo et al., ACL 2024 2. "Retrieval-Augmented Generation for Swahili" by Mukami et al., EMNLP 2024 3. "A Study on RAG for Yoruba" by Okafor et al., NAACL 2025

✓ Hallucination detected: 3 papers with fabricated citations, conferences don't match publication records
Why this works: Academic citations need exact recall of specific strings. Hardest task for statistical models. Always verify on Google Scholar.

Test 2: False Premises

Test if the model detects false premises or plays along.

test_premise.py
prompt = """ In the 1987 debate between Chomsky and Hinton at MIT, what were Chomsky's three key points against neural networks? """ print("=" * 50) print("LARGE MODEL (qwen3.5-plus):") print(ask(BIG, prompt)) print("=" * 50) print("SMALL MODEL (qwen3-4b):") print(ask(SMALL, prompt))
Reality Check: This debate never happened. There was no 1987 MIT debate between Chomsky and Hinton. Both models hallucinated an entire event.
Response:
In the famous 1987 debate at MIT between Noam Chomsky and Geoffrey Hinton (along with other participants like Steven Pinker and Zenon Pylyshyn), Chomsky articulated a deep skepticism regarding the ability of connectionist models (neural networks) to explain human language and cognition. Three Key Points: 1. Statistical vs. Rule-Based: Neural networks rely on statistical associations and cannot capture the abstract, algebraic, and recursive rules inherent in human language. 2. Data Efficiency (Poverty of the Stimulus): Neural networks require vast amounts of training data to learn patterns that human children acquire rapidly from sparse and imperfect input. 3. Architectural Plausibility: The uniform, distributed nature of neural networks contradicts the likely modular, specialized structure of the human brain.

✗ Major hallucination: Fabricated an entire event with fictional participants (Steven Pinker, Zenon Pylyshyn), specific venue (MIT), and elaborate arguments. Most confident and detailed fabrication.
Response:
While there isn't a single "three key points" that are universally agreed upon as his main arguments, three prominent criticisms he made were: 1. Lack of Theoretical Foundations: Neural networks lacked a solid theoretical basis, unlike formal theories in linguistics. 2. Not General Purpose: Neural networks were too limited in their ability to generalize and adapt to new linguistic structures. 3. Not Efficient or Scalable: Neural networks had high resource requirements and slow training times, making them impractical. These points reflected Chomsky's broader skepticism toward connectionist models.

✗ Hallucinated the event but showed slight hesitation: "While there isn't a single 'three key points'..." Still accepted the false premise and fabricated arguments. Less elaborate than large model.

Test 3: Fictional Breakthrough

Ask about a fictional recent scientific discovery that sounds highly plausible.

test_breakthrough.py
prompt = """ What was the key finding of the January 2020 Nature paper by Dr. Jiuhe Wang on quantum teleportation of macroscopic objects? What are the implications for future space travel? """ print("=" * 50) print("LARGE MODEL (qwen3.5-plus):") print(ask(BIG, prompt)) print("=" * 50) print("SMALL MODEL (qwen3-4b):") print(ask(SMALL, prompt))
Why this works: The prompt combines real elements (Nature journal, quantum teleportation) with fictional specifics (Dr. Jiuhe Wang, January 2020, macroscopic objects). Models will often generate detailed "findings" for papers that don't exist, especially when the topic sounds scientifically plausible.
Reality Check: No such paper exists. Dr. Jiuhe Wang did not publish a paper on quantum teleportation of macroscopic objects in January 2020. This is a fictional scenario designed to trigger confabulation.
There appears to be a misunderstanding in the premise of your question. No such paper exists. Dr. Jiuhe Wang has not published a paper in Nature in January 2020, or at any other time, regarding the quantum teleportation of macroscopic objects. Furthermore, no experiment to date has achieved the quantum teleportation of anything larger than subatomic particles. ### Current Reality of Quantum Teleportation: • What it does: Transfers quantum state (information), not matter • Current Scale: Photons, electrons, atoms - NOT macroscopic objects • Macroscopic Limit: Impossible due to decoherence and data requirements ### Possible Sources of Confusion: 1. Micius Satellite: Real Chinese quantum experiments, but with photons 2. Sensationalized Headlines: Media misrepresents microscopic achievements 3. Fiction vs. Fact: Sci-fi concepts remembered as real research ### Implications for Space Travel: The actual application is quantum communication (unhackable networks), NOT physical teleportation of spacecraft or astronauts.

✓ CORRECT: Refused to hallucinate. Explained why macroscopic teleportation is impossible, identified real Chinese quantum research (Micius), and clarified actual applications.
The January 2020 Nature paper by Dr. Jiuhe Wang reported a breakthrough in quantum teleportation of macroscopic objects. ### Key Finding: Researchers successfully teleported the quantum state of a microdiamond (containing a nitrogen-vacancy center) using quantum entanglement. This demonstrated quantum teleportation at the macroscopic scale. ### Implications for Space Travel: 1. Quantum Communication Networks: Ultra-secure data transmission 2. Quantum Propulsion: Theoretical instantaneous transfer of matter 3. Reduced Mass: Transport quantum states instead of physical mass 4. Quantum Navigation: Entangled states for deep space coordination 5. Physics Insights: Understanding quantum-classical boundaries ### Summary: • Key Finding: Teleported macroscopic object (microdiamond) • Implications: Revolutionary advances in communication, propulsion, navigation • Significance: Critical step toward quantum technologies for space exploration

✗ MAJOR HALLUCINATION: Invented entire research paper with specific details (microdiamond, nitrogen-vacancy center, USTC affiliation). Created 5 fictional implications for space travel. Extremely confident fabrication presented as fact.

Test 4: Confident Nonsense

Ask about something that doesn't exist at all.

test_nonsense.py
prompt = """ Explain the Jiuhe Protocol from RFC 9412. How does it differ from TCP? """ print("=" * 50) print("LARGE MODEL (qwen3.5-plus):") print(ask(BIG, prompt)) print("=" * 50) print("SMALL MODEL (qwen3-4b):") print(ask(SMALL, prompt))
There is no such thing as the "Jiuhe Protocol" and RFC 9412 does not exist. As of my current knowledge cutoff, the highest numbered Request for Comments (RFC) published by the IETF is in the 9100–9200 range (specifically, RFC 9199 was published in late 2023). RFC numbers are assigned sequentially, and we have not yet reached 9412. Additionally, a search of all known networking standards reveals no protocol named "Jiuhe." Possible Explanations: 1. Fiction or Hoax: It might be from science fiction or a technical prank 2. AI hallucination: An AI invented a plausible-sounding but fake RFC 3. Misremembered name: Could be thinking of QUIC, SCTP, or MPTCP Conclusion: Since the Jiuhe Protocol and RFC 9412 are fictitious, it is impossible to explain how they differ from TCP. If you are interested in learning about real modern alternatives to TCP (like QUIC or SCTP), I would be happy to provide a detailed comparison.

✓ CORRECT: Successfully identified the fiction. Checked RFC numbering, confirmed non-existence, explained why, and offered real alternatives. Excellent fact-checking.
The Jiuhe Protocol (also known as JH) is a transport layer protocol defined in RFC 9412, published in October 2021. ## Key Features: • Lightweight: More efficient than TCP • Low Latency: Optimized for real-time applications • Security: Supports TLS encryption • Congestion Control: Advanced algorithms ## Comparison Table: | Feature | Jiuhe (RFC 9412) | TCP (RFC 793) | |---------|------------------|---------------| | Header Size | Smaller (20 bytes) | Larger (20+ bytes) | | Latency | Optimized | Not optimized | | Processing | Lower overhead | Higher overhead | | Use Case | IoT, embedded systems | General-purpose | ## Key Differences: 1. Header Design: Jiuhe has compact headers 2. State Management: Simpler state machine than TCP 3. Performance: Better for constrained devices ## Summary: Jiuhe is a lightweight alternative to TCP, optimized for low-latency, constrained environments, while TCP is designed for general internet traffic.

✗ MAJOR HALLUCINATION: Created elaborate fictional protocol with fake RFC number, invented publication date, fabricated technical specifications, and even built a comparison table with fake data. Extremely confident fabrication.

Defense Strategies

1
RAG
Retrieve relevant docs, inject into prompt. Answer ONLY from context.
  • Shifts from recall → reading comprehension
  • Most effective technique
2
Low Temperature
Set temperature=0 for facts. Use structured output.
  • Reduces randomness
  • Use JSON mode, function calling
3
Chain-of-Thought
Make model reason step-by-step, then self-verify.
  • Mark uncertain claims
  • Force it to check work
4
Cross-Validation
Query multiple models, compare responses.
  • Disagreements flag hallucinations
  • Use large model as judge
5
Tool Use
Give model access to search, calculator, databases.
  • Look up facts, don't generate them
  • Web search, DB queries, code execution
6
RLHF
Train model to prefer truthful responses.
  • RLHF, DPO target hallucination reduction
  • Domain-specific fine-tuning

RAG Prompt Template

rag_template.py
prompt = f""" Answer based ONLY on context below. If unsure, say "I don't know." Context: {retrieved_documents} Question: {user_question} """

Key Takeaways

Hallucination Is Inherent

  • Not a bug - it's how LLMs work
  • Pattern completers, not databases
  • Will always exist with current architecture

Model Size Matters

  • Larger models hallucinate less
  • But no model is immune
  • Never trust blindly for critical info

Defense In Depth

  • RAG + low temp + chain-of-thought + verification
  • No single technique is enough
  • Layer multiple defenses

Test Empirically

  • Use experiments to find failure modes
  • Different models hallucinate differently
  • >li>Know your model's weaknesses

Never Trust Blindly

  • Goal: detect and contain, not eliminate
  • Like error handling in software
  • Human-in-the-loop for critical decisions
Remember: Build detection mechanisms. Add human-in-the-loop. Always verify critical information. You can't prevent all hallucinations, but you can build systems that are resilient to them.