Hallucination mitigation and citations
Hallucinations are the failure users notice first and forgive last: a confident, fluent answer that is simply wrong. You cannot eliminate them, but you can make them rarer, make them visible, and stop them from reaching high-stakes decisions. This doc covers why they happen, then the practical stack: grounding, citations, verification, abstention and UI that keeps humans appropriately sceptical.
Why it matters
Misinformation is LLM09 in the OWASP Top 10 for LLM Applications 2025, and NIST's Generative AI Profile (AI 600-1) lists "confabulation" as one of its twelve generative AI risks. The real-world cost shows up as invented legal citations in court filings, wrong policy answers from support bots, and fabricated API names in generated code.
OpenAI's September 2025 paper "Why Language Models Hallucinate" gives a useful explanation: training and evaluation reward guessing over admitting uncertainty, so a model that says "I don't know" scores worse on most benchmarks than one that guesses. The practical takeaway for builders is that your product and your evals need to reward abstention, or you will train and select for confident guessing too.
How it works
I group mitigations by where they act.
Rendering diagram…
Grounding. Give the model the facts instead of relying on its memory. Retrieval quality is the biggest lever; most "hallucinations" in RAG systems are actually retrieval misses where the model filled the gap.
Citations. Require the model to attach sources to claims. Native citation features are more reliable than asking for citations in free text. Anthropic's Citations support, for example, lets you pass documents (plain text, PDFs or custom content blocks) with citations enabled and returns structured citation objects pointing at character ranges, pages or content blocks; search result content blocks give the same behaviour for your own RAG results.
Verification. Check that each cited passage actually supports its claim, using an entailment model or an LLM judge with a strict rubric. For structured facts (prices, dates, IDs), check against the source of truth in code.
Abstention. Tell the model it is allowed and expected to say it does not know, give it a clear way to do so (a field in a structured response), and make sure your evals reward it.
Self-consistency. For high-stakes answers, sample several times and flag disagreement. Inconsistency across samples is a decent signal of low confidence.
Reference architecture
A grounded answer service with a verification pass and an explicit abstain path.
Rendering diagram…
In the UI, show sources inline, make them clickable to the exact passage, and label answers that are partially supported. Users calibrate quickly when they can see what the answer rests on.
Code
Using document citations with the Anthropic Python SDK. Each document block has citations enabled, and the response contains text blocks with a citations list you can render as footnotes.
import anthropic
client = anthropic.Anthropic()
policy_text = open("refund_policy.txt").read()
msg = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
system="Answer only from the provided documents. If they do not answer the question, say so.",
messages=[{
"role": "user",
"content": [
{
"type": "document",
"source": {"type": "text", "media_type": "text/plain", "data": policy_text},
"title": "Refund policy v7",
"citations": {"enabled": True},
},
{"type": "text", "text": "Can I get a refund after 45 days on an annual plan?"},
],
}],
)
for block in msg.content:
if block.type == "text":
refs = [f'[{c.document_title}: "{c.cited_text[:60]}..."]' for c in (block.citations or [])]
print(block.text, " ".join(refs))
Treat any sentence that makes a factual claim without a citation as a candidate for verification or removal.
Trade-offs and pitfalls
- Citations can be wrong too. A model can cite a real passage that does not support its claim. Verify support, not just presence.
- Retrieval misses look like hallucinations. Measure retrieval recall separately before tuning prompts.
- Over-abstention. Push too hard and the assistant refuses answerable questions. Track abstention rate alongside accuracy.
- Stale sources. Grounding in outdated documents produces correct citations to wrong facts. Version and expire your corpus.
- Verification cost. A second model pass adds latency. Apply it to high-stakes surfaces or sample it for monitoring elsewhere.
- Fine-tuning for facts backfires. Training facts into weights can increase confident errors; prefer retrieval for knowledge.
Checklist
- Ground answers in retrieved, versioned, authoritative sources.
- Use native citation features where your provider offers them.
- Verify that cited spans support claims for high-stakes answers.
- Give the model an explicit abstain path and reward it in evals.
- Show sources in the UI, linked to the exact passage.
- Track hallucination, abstention and retrieval recall as separate metrics.