Hallucination & failure modes
Why a language model states false things fluently, which distinct failures the word hides, and how to detect each one in your own system rather than arguing about it.
“Hallucination” is doing too much work. It gets applied to a fabricated legal citation, a summary that contradicts the document it was given, a model that agrees with your wrong premise, a truncated JSON object and an answer that was correct in 2023. Those have different causes and different fixes, and calling them one thing is why so much advice about them is useless.
These pages start from the mechanism. A model returns a probability distribution over the next token; nothing in that distribution is a truth value, the training objective never asked for one, and the way models are scored afterwards rewards a confident guess over an admission of ignorance. Everything downstream — calibration, grounding, abstention, detection — is an attempt to add the channel that the architecture does not have.
Where a page needs a number, it names the paper the number came from. Where a page needs a rate for your system, it gives you the code to produce it, because nobody else’s rate transfers to your prompts.
Why LLMs Hallucinate: The Mechanical Explanation
Next-token prediction has no truth term, pretraining rewards fluent continuation, and post-training grading rewards guessing over abstention.
5 min read
Types of Hallucination: A Taxonomy That Routes to a Fix
Six distinct failures get called hallucination, they have different causes, and only one of them is fixed by better retrieval.
4 min read
Measuring Hallucination Rate in Your Own App
A claim-level grading rubric, a labelling protocol with an agreement check, and the code to turn both into a rate with a confidence interval.
5 min read
Grounding: The Only Reliable Hallucination Fix
Grounding is four architectural commitments — provided evidence, span attribution, a verifier and a refusal path — not an instruction in the system prompt.
5 min read
Confidence and Calibration: Does the Model Know It's Wrong?
What calibration means precisely, what the published reliability diagrams show about pretraining versus RLHF, and the code to produce one from your own logprobs.
6 min read
Making a Model Abstain Instead of Guessing
Why abstention has to be paid for in the scoring rule before any prompt can produce it, and the risk–coverage harness that tells you whether yours works.
6 min read
Fabricated Citations and Fake References
Why references are the format models fabricate most fluently, what the published evaluations of cited generation found, and a resolver that makes the failure impossible to ship.
5 min read
Sycophancy: Why the Model Agrees With Your Mistake
Where agreement-seeking comes from in the preference data, four probes that expose it in any model, and the prompt structures that reduce it.
5 min read
Prompt Sensitivity: Same Question, Different Answer
Semantically identical prompts produce materially different accuracy, the published spreads are large, and a single-prompt number is a sample of one.
5 min read
Non-Determinism: Why Temperature 0 Isn't Deterministic
Greedy decoding is deterministic given identical logits, and on a shared GPU server the logits are not identical — mostly because kernels are not batch-invariant.
5 min read
Refusals: When Safety Training Blocks Legitimate Work
Exaggerated safety is a documented, benchmarked failure mode with a known trigger taxonomy — and a three-way grading scheme you can run on your own prompts.
5 min read
Context Poisoning and Bad Retrieved Data
Provided context outranks parametric knowledge by design, which makes the retrieval corpus an attack surface and a quality ceiling at the same time.
5 min read
Numerical Reasoning Failures
Why arithmetic breaks in a way that scales badly with digit count, what the benchmarks show about robustness, and why the fix is a tool call rather than a better prompt.
5 min read
Date and Time Reasoning Bugs
A model has no clock, inherits every numeric weakness, and knows nothing about your timezone — which makes scheduling features a reliable source of silent errors.
5 min read
Long-Conversation Degradation
Instruction adherence falls as a conversation grows, for reasons involving position effects, self-conditioning and early commitment — and there is a plot that shows it.
5 min read
Language Drift in Multilingual Conversations
Why a model answering in Dutch slips into English mid-paragraph, what one model vendor documented about fixing it, and how to pin the output language.
5 min read
Repetition Loops and Degenerate Output
Repetition is self-reinforcing — the probability of a repeated phrase rises with each repetition — which is why decoding settings both cause it and cure it.
5 min read
Truncated Output: Diagnosing an Unfinished Answer
Every stop reason decoded, the specific cause behind each, and the streaming case where the response ends with no stop reason at all.
5 min read
Model Degradation Over Time: Real or Perceived?
The study that started this argument, the critique that complicated it, the six things that genuinely change under you, and the regression harness that answers it for your workload.
4 min read
A Field Guide to LLM API Error Messages
What each status code and error type actually means underneath, which ones are safe to retry, and the failures that arrive with a 200.
5 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models