Say your team ships an internal assistant that summarizes customer tickets. A support lead opens one summary: two correct details, then a sentence saying the customer was promised a refund by Friday. Nobody promised that. The sentence sits right between the true parts, in the same smooth tone, and it would have gone straight into an escalation email if she hadn't opened the original ticket.
That's what makes hallucinations so annoying in day-to-day work. They don't come with a warning label. This post covers the engineering side: the layers you can build around a model so fewer of those sentences reach users, and the ones that slip through get caught. For the reader's side of the same problem, see the cost of trusting a fluent AI answer.
Why models make things up
A hallucination is an answer that sounds plausible but isn't backed by the facts the task needs. The model invents a source, blends two similar products, or fills a gap because the prompt nudged it to be helpful at any cost.
Nobody's lying here. A September 2025 paper by OpenAI researchers argues that standard training and evaluation reward guessing over admitting uncertainty. Most benchmarks grade answers as right or wrong, so "I don't know" earns zero while a lucky guess earns points, and models end up tuned to be good test-takers (Kalai et al., "Why Language Models Hallucinate"). The authors' fix is to change how existing benchmarks score uncertain answers. For product teams the lesson is closer to home: if your feature rewards answering everything, you'll get confident guesses.
Layer 1: narrow the task
"Explain this customer case" lets the model pick its own boundaries. A tighter request says which materials are allowed, which question needs an answer, how to flag uncertainty and what format to return. Anthropic's prompting guide backs two of these directly: give the model explicit permission to say it doesn't know, and tell it to use only the documents you provide when that's the job (Anthropic, "Reduce hallucinations", checked November 2026).
Here's a before and after:
Before: Summarize this ticket.
After: Summarize the ticket below for a support lead.
Use only the ticket text. List what the customer asked for,
what we promised (quote it) and any open questions.
If the ticket doesn't say, write "not in ticket".
The model can still slip. There's just a lot less room for invention.
Layer 2: send the right context
Dumping a whole folder into the prompt can make answers look richer while hiding weak retrieval. Long inputs have their own problem too. In "Lost in the Middle", models did best when the relevant passage sat at the start or end of a long input, and accuracy dropped noticeably when it sat in the middle, even for models built for long contexts (Liu et al., TACL 2023). Models have improved since that paper, but the habit still pays off: send less, send the right passages and put them where they're easy to find.
For internal knowledge tools, that means chunking documents with care, keeping titles and dates attached to every chunk, retrieving the passages closest to the question and showing the source next to the answer. The context window bottleneck goes deeper on this.
Layer 3: retrieval helps, within limits
RAG helps when the answer depends on private or changing knowledge. Instead of asking the model to remember a policy, the system fetches the relevant source and asks the model to answer from it. The original RAG paper found that retrieval-backed generation gave more specific and more factual answers than a model working from its weights alone (Lewis et al., 2020). New to it? Start with RAG basics.
Retrieval still won't fix everything. In 2024 a Stanford team tested AI legal research tools from LexisNexis and Thomson Reuters, tools whose makers said retrieval kept hallucinations away. They still hallucinated between 17% and 33% of the time: better than a general-purpose chatbot, and a long way from hallucination-free (Magesh et al., 2024). Pull the wrong document, a stale version or a chunk cut off from its context, and you get a wrong answer that now looks well researched.
Layer 4: citations people can actually check
A citation earns its place when it points to the exact passage behind the claim. A link pasted at the end of a paragraph proves nothing. Anthropic's guide suggests a neat pattern: ask the model to back each claim with a quote, then have it go back over every claim, and drop any claim it can't find a supporting quote for. For long documents (their threshold is over 20k tokens), ask for word-for-word quotes first and answer only from those.
In the product, keep the source one click away and highlight the quoted text. A citation is really a UI for verification. If checking one claim means five minutes of digging, nobody will check.
Layer 5: give the model room to say "I don't know"
Plenty of systems accidentally reward answering everything. A safer flow accepts replies like "the provided documents don't cover this", "this part is uncertain" or "I can only answer the first question from these sources". They sound less impressive than a polished guess, and they're far more useful. Track refusals as a metric too. If the refusal rate suddenly drops to zero, the model may have gone back to guessing.
Layer 6: move checks out of the prompt
Some checks belong in code, where they give the same result every time:
- Code: run the tests and the type checker.
- Math: hand the calculation to a calculator or a function.
- Structured output: validate against a schema and reject anything that doesn't parse.
- Facts and policy: compare against the source documents, or at least confirm each cited quote really exists in the source.
- Consistency: ask the same question a few times and compare. Anthropic calls this best-of-N verification. Answers that disagree with each other hint that something got invented.
The model can help draft the verification plan. It shouldn't be the only judge of its own answer. When an AI answer needs a test covers how to decide which answers deserve this treatment.
Layer 7: an eval set built from real failures
An eval set is where a team stops judging quality by the last few chats. Collect examples of your real failure modes: missing context, two documents that contradict each other, a stale policy, product names that look alike, tricky edge cases and questions the system should refuse. Run every prompt change, retrieval change and model upgrade against that same set. Without it, "better" is just a feeling. Evaluating LLM performance has the how-to.
Score refusals fairly, too. If your eval only counts right answers, you're rebuilding the incentive the OpenAI paper describes, where guessing wins. Give "I don't know" partial credit when the answer really isn't in the sources, and penalize confident wrong answers more than abstentions.
Layer 8: a UI that shows how sure it is
If an AI feature presents every answer as final, users learn the wrong habit. Show the sources, last-updated dates and which parts are uncertain, plus an obvious path to the evidence. You want people to trust each answer about as much as the evidence on screen supports.
Anthropic's own guide says these techniques reduce hallucinations without eliminating them, and that critical information still needs validating. Each layer catches a different kind of mistake. Skip one and the rest end up carrying more than they can.
Try this week
- Add one line to your system prompt that lets the model say it doesn't know, with the exact phrase it should use.
- Pick 20 real questions your feature got wrong or should have refused, and save them as your first eval set.
- Make one citation in your UI open the exact quoted passage.
- Move one check from the prompt into code: a schema, a test or a "does this quote exist in the source" check.
Fluent text has never been proof. Pick one layer from this list, ship it this week and see which mistakes it starts catching.