Chapter Summary
Summary (Part 1) · What is an LLM + Hallucination
Chapter 1 · Review & Recap · Part 1: LLM basics — what it is and why hallucinations occur.
1 · What is an LLM?
What is an LLM?
Three core mental models you must have
Training Essence
LLM = A Massive Probabilistic Prediction Machine
Training = repeatedly predicting the next Token on vast amounts of text. The parameters memorize statistical patterns, not understanding. At inference, parameters are frozen — only conditional probability calculations occur.
P( next Token | all known Tokens )
Token & Context Window
Token ≠ Character · Context Window is Your "Desktop"
Each Chinese character is ~1-2 Tokens; each English word is ~1 Token. The Context Window determines how much the model can see. Anything beyond it is truncated — gone forever.
Current leading windows: Qwen 3.6 (1M), Kimi K2.5 (200K), Claude 4.6 (200K), GPT-5.4 (128K)
Current leading windows: Qwen 3.6 (1M), Kimi K2.5 (200K), Claude 4.6 (200K), GPT-5.4 (128K)
Evolution Path
Three Stages: Base → SFT → Chat
Base Model (text continuation) → SFT instruction fine-tuning (learns conversation format) → Chat API (simulates multi-turn dialogue).
Every API call you make is essentially constructing a carefully designed Message List, so the model continues it into exactly what you want.
Every API call you make is essentially constructing a carefully designed Message List, so the model continues it into exactly what you want.
[system] + [user/assistant …] + [user_now]
2 · Hallucination: LLM's Innate Limitation
Hallucination: LLM's Innate Limitation
Cannot be eliminated — only mitigated
Factual Hallucination
Fabricating non-existent facts, data, or citations
Source Hallucination
Citing papers, links, or authors that don't exist
Reasoning Hallucination
Correct premise but flawed reasoning steps
Code Hallucination
Calling APIs or functions that don't exist
Root Cause 1
Flawed Parametric Knowledge
The training data contained misinformation; the model knows nothing beyond its knowledge cutoff date.
Root Cause 2
Context Misinterpretation
Unclear Prompt forces the model to guess intent; when context is contradictory, it always picks the most probable continuation — most probable ≠ most accurate.
Key Insight
→ Hallucination cannot be fully eliminated — it is an inevitable product of probabilistic prediction
→ After PreTraining, parameters are frozen and cannot automatically update knowledge — this is the fundamental cause of hallucination
→ The right approach: use engineering techniques to mitigate it — don't expect hallucinations to disappear as models get smarter