Mechanisms of LLM Hallucination
Neural networks do not "lie" maliciously; they generate tokens sequentially by sampling from high-dimensional probability distributions. When a model crosses an entropy tipping point or encounters ungrounded prompts, the autoregressive mechanism conditions future steps on its own confabulated tokens—causing an irreversible cascade.
Four Core Mathematical Causes of Hallucination
1. Next-Token Objective vs Truth
Language models are trained to optimize maximum likelihood estimation: $P(w_t | w_1, \dots, w_{t-1})$. The objective rewards linguistic plausibility and grammatical fluency, not empirical truth verification. If a false continuation has high stylistic coherence, it receives high logit scores.
2. Sampling in Flat Logit Basins
When a prompt asks an unanswerable question or asserts a false premise, the factual probability distribution becomes diffuse (high Shannon entropy). Non-zero sampling temperature (τ > 0) samples from the tail, crossing over saddle points into confabulated attractor basins.
3. Autoregressive Error Snowball
Generation is strictly Markovian in context: token $t+1$ conditions on token $t$. Once a single hallucinated entity or date is generated, the self-attention mechanism treats that fabricated token as verified context ground truth, compounding hallucinations in subsequent steps.
4. Factual Knowledge Compression
World knowledge is lossily compressed into static feed-forward weight parameters ($W_k, W_v$). When the model attempts to interpolate between rarely correlated facts, latent representations blend distinct concepts into convincing but non-existent synthetic memories.