AI hallucination: a measurable defect, not a personality quirk
By Abdul Asim · ·
What is AI hallucination?
AI hallucination is when a language model produces content that sounds confident but is false, unsupported by its sources, or made up outright: a fact, a figure, a citation or a policy that does not exist. In production it is best treated as a defect with a rate you can measure and push down, not as an occasional quirk. You will not get it to zero, but you can make it rare, visible and caught before it reaches a customer.
Why do LLMs hallucinate?
A language model writes by predicting likely next tokens. Nothing in that process checks the output against the world. When the model knows a fact well, the likely answer and the true answer coincide. When it does not, the likely answer is still fluent, and fluent is what you get.
Training adds to this. A 2025 paper on why language models hallucinate argues that training and evaluation reward guessing over admitting uncertainty. On most benchmarks a confident guess scores better than "I don't know", so models learn to guess.
In real applications, more causes stack on top of the model itself:
- Missing knowledge. The question is about your pricing, your products or last week's policy change, none of which the model has seen.
- Bad retrieval. The system fetched the wrong passage, an outdated version or nothing at all, and the model answered anyway.
- Pressure in the prompt. Instructions demand an answer every time and give the model no permitted way to say the information is missing.
- Loose output. Free text where a number, date or ID was needed, which leaves room to improvise.
AI hallucination examples in document systems
The kinds that matter in business systems are rarely dramatic. They look plausible, which is the problem.
| Type | What it looks like | Why it hurts |
|---|---|---|
| Invented fact | A product feature, spec or policy that does not exist | Someone acts on it |
| Wrong number | A price, total or date recalled or calculated by the model | Money and contracts depend on it |
| Fabricated citation | A source that does not support the claim, or does not exist | It breaks trust in every citation |
| Unfaithful summary | A summary that draws a conclusion the source never drew | Decisions get made on it |
| Generic answer | True in general, wrong for this company | It looks right, so nobody checks |
The second row is why prices in the MavenIT quoting workflow are calculated through defined rules, not by the model. The model helps interpret the request and draft the quote. Deterministic pricing rules set the number. When no suitable historical quote matches, a person reviews the case instead of letting the model fill the gap.
How do you measure AI hallucination?
You cannot reduce what you do not count. Treat it like any other defect:
- Build a test set of real user questions with known answers and the sources that support them. Include questions the system should decline because the information is not in its documents.
- Break each answer into claims and check every claim against the retrieved sources. A claim with no support counts as a hallucination, even if it happens to be true.
- Track rates by type: unsupported claims, wrong numbers, bad citations, and missed "not found" cases.
- Re-run the set on every change to prompts, models, chunking or retrieval, and block releases that raise the rate.
Claim checks can be done by people on a sample, by a second model acting as a judge, or both. A model judge is cheaper but needs its own spot checks against human labels. The mechanics are covered in LLM evaluation. Score retrieval and generation separately: if the right passage was never retrieved, no prompt change will fix the answer.
How grounding and retrieval reduce AI hallucination
Grounding means the model answers from material you supply rather than from memory. Retrieval-augmented generation is the standard way to do it: fetch the relevant passages for each question and place them in the prompt. The original RAG paper, which I cover in when RAG was introduced, reported that adding retrieval made generated text more specific and more factual than a model relying on its parameters alone. If the idea is new to you, start with what retrieval-augmented generation is and how RAG differs from a plain LLM.
Grounding only helps if you hold the model to it:
- Tell it to answer only from the supplied context and to say plainly when the context does not contain the answer.
- Require a citation for each claim, then check in code that the cited passage exists and was actually retrieved.
- Retrieve less but better. A pile of loosely related chunks gives the model more material to blend wrongly.
- Keep the index in sync with its sources, so the model is not faithfully quoting a superseded document.
Retrieval can also cause hallucination. A wrong passage, used faithfully, produces a wrong answer with a real citation attached. That is why most production RAG failures turn out to be retrieval problems wearing a generation costume.
Making output more deterministic: temperature, structured outputs and grounding
Determinism and truth are different things. Still, less randomness makes hallucinations easier to reproduce, trace and fix. Four levers work best together:
- Temperature. Lower values make sampling favour the most likely tokens. OpenAI's API reference describes higher temperatures as more random and lower ones as more focused. Keep it low for extraction, classification and factual answers. It makes the model consistent, not correct, and even a fixed seed is documented as best effort, with determinism not guaranteed.
- Structured outputs. When the answer is data, ask for data. A JSON schema with fields for the value, the source ID and a "not found" flag leaves less room to improvise. OpenAI's Structured Outputs guide is clear that the schema constrains the shape of the response, and that your application still has to validate business rules the schema cannot express. A well-formed wrong value is still wrong.
- Grounding. Restrict answers to retrieved sources, as above, so the same question over the same documents tends to produce the same supported answer.
- Code for anything computable. Totals, prices, dates and unit conversions belong in deterministic code fed by values the model extracted, as in the quoting workflow.
Together these turn free-form generation into output you can repeat and check field by field.
Controls that catch what slips through
Some hallucinations will still get through, so put checks after generation too. In the Center for Creative Leadership reporting workflow, source data is validated before the model drafts anything, the generated analysis passes through a separate validation stage afterwards, and team leads approve each report through Outlook before it is distributed. The model drafts. It does not decide what gets released.
The same layering works elsewhere: validate inputs, constrain and check outputs, send exceptions to a person, and log enough to trace any bad answer back to the passage and prompt that produced it. If your system is already live and you cannot tell where the invented answers are coming from, my AI app review examines retrieval, chunking, evals, cost and model routing and returns a written report with prioritised fixes.
Key takeaways
- AI hallucination is fluent output that its sources do not support. Treat it as a defect with a measurable rate.
- Models guess because generation and training reward fluent answers over admitted uncertainty.
- Measure with real questions, claim-level checks and rates by type, and re-run on every change.
- Ground answers in retrieved sources, require citations and allow "not found" as a valid answer.
- Low temperature, structured outputs and code for numbers make output consistent and checkable, not automatically true.
- Put validation and human approval after generation for anything that carries money, contracts or decisions.
