Techniques to reduce LLMs generating false but plausible information, from RAG to factual verification and prompt design.
Hallucinations are LLM responses that sound correct but contain fabricated information. The model generates plausible text based on statistical patterns, not verified facts. Mitigating hallucinations is critical for applications where accuracy matters.
| Type | Example | Detection | Mitigation |
|---|---|---|---|
| Factual | Incorrect data as facts | Verification against sources | RAG with citations |
| Fabrication | Inventing URLs, papers, citations | Validate sources exist | Instruct "I don't know" + verification |
| Inconsistency | Contradicting itself in same response | Compare assertions | Chain-of-thought |
| Extrapolation | Generalizing from limited examples | Evaluate model confidence | Limit prompt scope |
RAG anchors responses in real documents. The key is instructing the model to cite specific sources and limit itself to the provided context:
GROUNDED_PROMPT = """Answer ONLY with information from the provided documents.
For each factual claim, include the reference in brackets: [Doc N].
If the documents don't contain the information, respond: "I don't have enough information."
Documents:
{context}
Question: {question}
"""This pattern reduces fabrication but doesn't eliminate it — the model can misinterpret context or combine fragments incorrectly.
Technique from Meta (Dhuliawala et al., 2023) where the model verifies its own response in four steps:
def chain_of_verification(client, question: str) -> str:
# 1. Initial draft
draft = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": question}],
).choices[0].message.content
# 2. Generate verification questions
verification_qs = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": (
f"Draft: {draft}\n\n"
"List the factual claims and generate a verification question for each."
)}],
).choices[0].message.content
# 3. Verify each question independently
verifications = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": (
f"Answer each question independently:\n{verification_qs}"
)}],
).choices[0].message.content
# 4. Corrected final response
return client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": (
f"Original question: {question}\n"
f"Draft: {draft}\n"
f"Verifications: {verifications}\n\n"
"Generate a final response correcting any detected errors."
)}],
).choices[0].message.content| Metric | What it measures | Tool |
|---|---|---|
| Faithfulness | Is the response faithful to the provided context? | RAGAS, DeepEval |
| FActScore | Atomic-level factual precision (claim by claim) | FActScore |
| Attribution | Are citations real and relevant? | Manual verification + LLM-as-judge |
| Self-consistency | Do multiple generations agree? | Sampling + comparison |
No perfect solution exists. Even with RAG, the model can:
Mitigation reduces frequency, it doesn't eliminate the problem. In critical applications (medical, legal, financial), human verification remains necessary.
Hallucinations are the most visible risk of AI systems in production. A model that generates false information with confidence can cause real harm — from citing nonexistent case law to fabricating medical data. Mitigation techniques — RAG, grounding, CoVe, verification — are engineering requirements, not optional improvements. The goal is not to eliminate hallucinations (impossible with current LLM architecture) but to reduce their frequency and detect them before they reach the user.
Massive neural networks based on the Transformer architecture, trained on enormous text corpora to understand and generate natural language with emergent capabilities like reasoning, translation, and code generation.
Architectural pattern that combines information retrieval from external sources with LLM text generation, reducing hallucinations and keeping knowledge current without retraining the model.
Field dedicated to ensuring artificial intelligence systems behave safely, aligned with human values, and predictably, minimizing risks of harm.
Prompting technique that improves LLM reasoning by asking them to decompose complex problems into explicit intermediate steps before reaching a conclusion.
Findings from manual review of PR