TL;DR
-
Hallucination is confident, plausible text that is factually wrong or unsupported — not gibberish. It is the highest-risk silent failure mode in production LLM systems.
-
It exists because next-token prediction is not truth-seeking. LLMs maximize likelihood of fluent continuations. Gaps in knowledge are filled with statistically probable content, not verified facts. See generative AI.
-
Parametric knowledge ≠ retrieved knowledge. Weights compress training data (often stale or wrong). RAG and tools inject evidence at inference time — but the generator can still invent, misread, or mis-cite that evidence.
-
Generation is not reasoning. Chain-of-thought and fluent explanations are longer generation, not a proof engine. Correct-looking steps can still conclude wrongly.
-
Mitigation is engineering, not model magic: grounding (RAG/tools), abstention, structured outputs, citation checks, hallucination detection, guardrails, and faithfulness evaluation.
On this page
- Why This Matters
- The Problem Hallucinations Force You to Solve
- How We Got Here
- What Are Hallucinations?
- How Hallucinations Happen
- Architecture
- Step-by-Step Flow
- Real Production Example
- Design Decisions
- Comparisons
- Common Mistakes
- Where It Breaks Down
- When NOT to Ship Without Verifiers
- Running in Production
- Related Guides
- Interview Questions
- Key Takeaways
- FAQs
- References
- Further Reading
Why This Matters
A healthcare support bot retrieves a policy that says the dose is 50mg. The model answers 500mg, cites the policy, and sounds certain. The failure is silent: schema validation passed, the UI rendered a clean answer, and the user trusted the fluency.
Hallucinations differ from format errors (caught by parsers) and refusals (visible to users). They are confident fabrications — structurally identical to correct answers. In medical, legal, financial, compliance, and policy-driven support systems, that failure mode has real consequences. Even in lower-stakes products, one wrong "fact" destroys trust faster than an honest "I don't know."
If you are building on generative AI, you are building on probabilistic sampling. Reliability is not a property of the base model alone. It is a property of the application architecture around it: evidence, constraints, verification, and measurement.
The Problem Hallucinations Force You to Solve
Framing "the problem hallucinations solve" sounds inverted — hallucinations are the failure. The engineering problem they force is clearer: how do you ship fluent generation when fluency is not truth?
Without an explicit answer to that question, teams typically:
- Blame the model instead of fixing retrieval, prompts, or verification
- Chase prompt engineering for faithfulness when the failure is missing evidence
- Ship RAG that looks grounded while inventing details between retrieved sentences
- Skip measurement — no faithfulness rate, no golden set, no CI gate
- Put no trust boundary between model output and user-facing delivery
Treating hallucination as an engineering problem with known causes and layered mitigations — not an unsolvable AI quirk — is the prerequisite for reliable LLM products.
| Failure mode | Symptom | Primary fix |
|---|---|---|
| Missing evidence | Answer invented when docs absent | Retrieval / tools / abstention |
| Ignored evidence | Context says X; answer says Y | Prompting + claim verification |
| Mis-cited evidence | Citation points to wrong span | Citation validation |
| Wrong reasoning | Facts OK, conclusion wrong | Tools / deterministic logic |
| Stale parametric memory | Outdated CEO, price, policy | RAG / live tools, not weights |
How We Got Here
Hallucination became a product term after chat LLMs entered production. The underlying behavior is older: any open-ended generator will invent when evidence is missing.
Diagram: How hallucination became an engineering concern
timeline
title From fluent demos to verified generation
2019-2021 : GPT-2/3 completions
: Plausible text, little grounding
2022-2023 : Chat UIs go mainstream
: Confident wrong answers at scale
2023-2024 : RAG as default fix
: Intrinsic and citation errors remain
2024-2026 : Faithfulness eval + verifiers
: Abstention, citations, guardrails
Capability shipped first; faithfulness engineering followed once fluent wrong answers hit real users.
| Era | Dominant response | Gap |
|---|---|---|
| Raw generation | "The model will know" | No evidence, no refusal policy |
| Prompt-only | "Say I don't know" | Best-effort; easily overridden |
| RAG era | Retrieve then generate | Intrinsic / citation hallucination persist |
| Verified generation | Ground + verify + measure | Cost, latency, incomplete coverage |
Research and industry practice converged on the same conclusion: you cannot train away all hallucination for open-domain generation. You reduce rate with better models and post-training, then control residual risk with grounding, abstention, and verifiers.
What Are Hallucinations?
In LLM systems, hallucination (also called confabulation) means generated content that is:
- Factually incorrect — states false information as true
- Unsupported — claims not entailed by provided context or reliable knowledge sources
- Inconsistent — contradicts earlier statements in the same conversation or source set
You cannot detect hallucinations by reading fluency alone. Grammar, confidence, and formatting are orthogonal to truth.
Types of hallucination
| Type | Description | Example |
|---|---|---|
| Intrinsic | Contradicts provided context | Context: "50mg"; model: "500mg" |
| Extrinsic | Adds facts not in context | Invents a CEO name absent from docs |
| Citation | References a real source but misrepresents it | Cites policy §3; claim is not in §3 |
| Reasoning | Flawed logic despite correct premises | Correct numbers, wrong conclusion |
| Parametric | From wrong/outdated training weights | States last year's product SKU |
Engineering Insight
RAG primarily reduces parametric hallucination (knowledge cutoff / missing private facts). Intrinsic and citation hallucinations persist because the model still generates freely over the context window.
Parametric vs retrieved knowledge
Two knowledge sources matter in production:
| Source | Where it lives | Strength | Failure |
|---|---|---|---|
| Parametric | Model weights | Fluency, general patterns, style | Stale, incomplete, unverifiable |
| Retrieved | Prompt context from search/tools | Fresh, private, citable | Wrong chunk, noisy context, ignored evidence |
Hallucination risk is highest when the system pretends parametric memory is authoritative, or when retrieved evidence is present but the generator does not faithfully condition on it.
Generation vs reasoning
Generative models sample tokens. Intermediate steps labeled "reasoning" are still generated tokens. They can improve multi-step accuracy by letting later tokens condition on earlier ones — and they can also produce a coherent wrong proof.
Engineering implication: for exact computation, policy lookup, or high-stakes logic, offload to tools and deterministic code. Do not treat fluent chain-of-thought as a verifier.
How Hallucinations Happen
Root cause: the training objective
LLMs are trained (and often post-trained) to produce high-likelihood continuations given prior text. The objective rewards plausible next tokens, not grounded truth. When context is incomplete, ambiguous, or conflicting, the model must still emit something unless abstention is trained or enforced. Statistically likely filler fills the gap — and filler can be false.
This is why temperature tricks alone fail. Temperature 0 makes the most likely wrong answer more deterministic. It does not make the distribution truth-seeking.
Common production causes
Knowledge gaps. The fact was never in training data, or was overwritten by later tokens. Without retrieval or tools, the model improvises.
Retrieval failure. The right document is not in context. The answer looks like a generation bug but is a recall bug. Fix retrieval evaluation before blaming the generator.
Context overload / distraction. Too many chunks create noise. Attention lands on irrelevant passages; the model synthesizes incorrectly. See chunking strategies and context windows.
Numeric and negation fragility. Numbers, units, dates, and negations ("not refundable") are easy to flip even with correct context.
Pressure to answer. Prompts that prioritize helpfulness over honesty discourage refusal. Models comply with impossible requests by fabricating.
Citation theater. Requiring [1] markers without validating that the cited span entails the claim creates false auditability.
Diagram: Where falsehoods enter a RAG answer
flowchart TD
Q[User query] --> R[Retrieve top-k]
R --> G{Evidence sufficient?}
G -->|No| A[Abstain / refuse]
G -->|Yes| Gen[Generate answer]
Gen --> C{Claims entailed by context?}
C -->|Yes| Out[Deliver + citations]
C -->|No| V[Block / rewrite / escalate]
R -.->|Wrong or empty chunks| H1[Parametric / extrinsic hallucination]
Gen -.->|Ignores context| H2[Intrinsic hallucination]
Gen -.->|Wrong span| H3[Citation hallucination]
Most "model hallucinations" in RAG are either retrieval misses or unfaithful generation over retrieved text.
Architecture
Production mitigation is defense in depth. No single layer eliminates hallucination. Architecture separates prevention, generation constraints, verification, and delivery policy.
Diagram: Hallucination mitigation architecture
flowchart TB
subgraph Prevent [Prevention]
Ret[High-recall retrieval + rerank]
Tools[Live tools for facts/math]
Prompt[Abstention + ground-only prompts]
end
subgraph Generate [Constrained generation]
Temp[Temperature 0 for factual paths]
Cite[Required citations]
Struct[Structured outputs where needed]
end
subgraph Verify [Verification]
Claim[Claim decomposition]
NLI[NLI / faithfulness check]
CiteV[Citation span validation]
end
subgraph Deliver [Delivery]
Gate[Faithfulness threshold gate]
Guard[Guardrails + escalation]
Log[Audit logs + eval metrics]
end
Prevent --> Generate --> Verify --> Deliver
Treat verification as a trust boundary between model output and user delivery.
| Layer | Mechanism | Reduces |
|---|---|---|
| Retrieval | High-recall search, reranking, metadata filters | Parametric, extrinsic |
| Tools | Calculators, DB queries, live APIs | Reasoning, real-time facts |
| Prompting | Answer only from context; prefer abstention | Extrinsic, pressure-to-answer |
| Structured outputs | Schemas for machine-consumed fields | Format chaos; not factuality alone |
| Citations | Required source references + span checks | Citation hallucination |
| Detection | NLI, LLM-as-judge faithfulness | Intrinsic, unsupported claims |
| Guardrails | Block/rewrite low-confidence outputs | Residual risk at the edge |
| Human review | Escalation for high-stakes | Residual risk in regulated domains |
Production Tip
Log retrieval chunks, faithfulness scores, unsupported claims, and refusals. Hallucination patterns cluster by query type — your eval set must cover those clusters.
Faithfulness tooling (RAGAS, DeepEval) operationalizes claim-level checks used in both offline eval and online gates:

Source: RAGAS

Source: DeepEval Faithfulness
Step-by-Step Flow
End-to-end flow for a factual Q&A path with grounding and verification:
Diagram: Grounded generation with citation checks
sequenceDiagram
participant U as User
participant API as App API
participant Ret as Retriever
participant LLM as Generator
participant Ver as Verifier
U->>API: Query
API->>Ret: Embed + search + rerank
Ret-->>API: Chunks + scores
alt max score below threshold
API-->>U: Refusal / escalate
else evidence OK
API->>LLM: Prompt + context + cite rules
LLM-->>API: Answer + citations
API->>Ver: Decompose claims + check spans
alt faithfulness pass
API-->>U: Answer + citations
else fail
API-->>U: Refusal / safer rewrite
end
end
Refuse early on weak retrieval; never deliver failed verification as a confident answer.
- Classify risk. Route creative vs factual vs transactional. Only factual/compliance paths need full verification.
- Retrieve with recall first. Optimize recall@k on a golden set before tuning generation. Rerank for precision.
- Abstain on weak evidence. If top score < threshold or chunks empty, return a refusal — do not let the model fill the gap from weights.
- Generate under constraints. Temperature 0; instruct "answer only from context"; require citations for auditable claims.
- Decompose claims. Split the answer into atomic factual statements (numbers, names, dates, policy rules).
- Verify entailment. NLI or LLM-as-judge: is each claim supported by retrieved text? Validate that each citation span actually supports the claim.
- Gate delivery. Below faithfulness threshold → refuse, rewrite with only supported claims, or escalate to a human.
- Log and evaluate. Persist chunks, scores, unsupported claims; refresh golden sets from production failures. See evaluation and hallucination detection.
Real Production Example
A fintech policy assistant must not invent fee rules. Every answer is grounded in retrieved policy chunks, citations are required, and unsupported claims block delivery.
from __future__ import annotations
from dataclasses import dataclass
import re
from typing import Protocol
class EntailmentResult(Protocol):
entailed: bool
score: float
class Verifier(Protocol):
def check_entailment(self, premise: str, hypothesis: str) -> EntailmentResult: ...
@dataclass
class Chunk:
text: str
score: float
doc_id: str
span_id: str
@dataclass
class RagResult:
chunks: list[Chunk]
answer: str
citations: list[str] # span_ids referenced by the model
@dataclass
class VerifiedResponse:
answer: str
faithfulness_score: float
unsupported_claims: list[str]
invalid_citations: list[str]
passed: bool
class HallucinationMitigationPipeline:
REFUSAL = "I don't have enough information in our policies to answer that."
def __init__(
self,
rag_pipeline,
verifier: Verifier,
*,
min_retrieval_score: float = 0.70,
min_faithfulness: float = 0.85,
claim_score_floor: float = 0.80,
):
self.rag = rag_pipeline
self.verifier = verifier
self.min_retrieval_score = min_retrieval_score
self.min_faithfulness = min_faithfulness
self.claim_score_floor = claim_score_floor
def extract_claims(self, answer: str) -> list[str]:
sentences = re.split(r"(?<=[.!?])\s+", answer.strip())
return [s for s in sentences if len(s) > 10]
def validate_citations(
self, citations: list[str], chunks: list[Chunk]
) -> list[str]:
known = {c.span_id for c in chunks}
return [cid for cid in citations if cid not in known]
def verify_claim(self, claim: str, context: str) -> tuple[bool, float]:
result = self.verifier.check_entailment(premise=context, hypothesis=claim)
return result.entailed, result.score
def generate_with_grounding(self, query: str) -> VerifiedResponse:
result: RagResult = self.rag.query(
query,
system_rules=(
"Answer only from the provided policy excerpts. "
"If the excerpts are insufficient, say you cannot answer. "
"Cite span_ids for every factual claim."
),
temperature=0,
)
chunks = result.chunks
if not chunks or max(c.score for c in chunks) < self.min_retrieval_score:
return VerifiedResponse(self.REFUSAL, 1.0, [], [], True)
invalid_cites = self.validate_citations(result.citations, chunks)
context = "\n\n".join(f"[{c.span_id}] {c.text}" for c in chunks)
unsupported: list[str] = []
scores: list[float] = []
for claim in self.extract_claims(result.answer):
entailed, score = self.verify_claim(claim, context)
scores.append(score)
if not entailed and score < self.claim_score_floor:
unsupported.append(claim)
avg_faith = sum(scores) / len(scores) if scores else 0.0
passed = (
not unsupported
and not invalid_cites
and avg_faith >= self.min_faithfulness
)
if not passed:
return VerifiedResponse(
self.REFUSAL, avg_faith, unsupported, invalid_cites, False
)
return VerifiedResponse(result.answer, avg_faith, [], [], True)
What this encodes in production terms:
- Weak retrieval → immediate abstention (no parametric improvisation)
- Claim-level verification against the same context the model saw
- Citation integrity — referenced spans must exist in retrieved evidence
- Failed verification → safe fallback, never the hallucinated answer
Wire this behind a latency budget: sync NLI for high-stakes paths; async sampling + offline faithfulness for lower risk.
Design Decisions
Common patterns
| Pattern | What it does | Use when |
|---|---|---|
| Grounded RAG | Retrieve then generate | Private / fresh docs |
| Tool-first | Call APIs/DB/calc before prose | Live facts, math, inventory |
| Abstention-first | Prefer "I don't know" | High-stakes factual Q&A |
| Cite-then-verify | Require + validate citations | Auditable answers |
| Structured extract | Schema for fields; prose optional | Machine consumers |
| Risk-tiered verify | Full NLI only on high risk | Cost/latency constrained |
Decision matrix
| Decision | Option A | Option B | When to choose |
|---|---|---|---|
| Primary defense | Better retrieval | Output verification | Retrieval first; verification catches residual errors |
| Refusal policy | Aggressive abstention | Always answer | Aggressive for high-stakes; permissive only with strong verifiers |
| Verification | NLI model | LLM-as-judge | NLI for speed/cost; judge for nuanced claims — see Hallucination Detection |
| Citations | Required + validated | Optional | Required for anything that could be audited |
| Temperature | 0 | 0.3–0.7 | 0 for factual Q&A; higher only for creative tasks |
| Escalation | Auto on low faith | Manual only | Auto when faithfulness < threshold in regulated domains |
| Knowledge path | RAG | Fine-tuning | RAG for facts; fine-tuning for style/format — not a hallucination silver bullet |
When should I use mitigations?
| Situation | Primary mitigation |
|---|---|
| Answers need private or current facts | RAG / tools — not more prompting alone |
| Downstream systems consume outputs | Structured outputs + validation |
| High-stakes claims must be checkable | Hallucination detection + citations |
| Model invents confident falsehoods | Abstention, retrieval, or human review |
Comparisons
| Approach | What it buys | What it does not buy |
|---|---|---|
| Bigger / better model | Lower base hallucination rate | Guarantees; still probabilistic |
| Prompt abstention | Cheap refusal bias | Enforcement under pressure/injection |
| RAG | Fresh/private evidence | Intrinsic faithfulness |
| Tools | Exact facts/actions | Correct tool selection always |
| Structured outputs | Parseable schema | Truth of field values |
| NLI / faithfulness | Detect unsupported claims | Perfect judges; adds latency |
| Guardrails | Runtime block/rewrite | Fixing root retrieval bugs |
| Human-in-the-loop | Residual risk control | Throughput at scale |
| Metric | Measures | Blind spot |
|---|---|---|
| Fluency / preference | How good it sounds | Rewards confident wrong answers |
| Answer relevance | On-topic vs query | Can be relevant and false |
| Faithfulness | Supported by context | Useless if context is wrong |
| Citation precision | Claims match cited spans | Needs span-level labels |
| End-task correctness | Business outcome | Needs labeled golden set |
Common Mistakes
- Assuming RAG eliminates hallucination. RAG reduces parametric hallucination. Intrinsic and citation errors remain common.
- Weak refusal instructions. "Be helpful" overrides "say I don't know." Make abstention preferred when context is insufficient.
- No verification layer. Trusting output because it "sounds right" — especially for numbers, dates, and policy details.
- Blaming the model for retrieval failures. Wrong answer with empty or irrelevant context is a retrieval bug. Fix recall@k first.
- Citations without validation.
[1]markers do not help if the cited text does not support the claim. - Evaluating fluency instead of faithfulness. A well-written wrong answer passes casual review. Automate claim checks.
- Temperature as a fix. Temperature 0 makes hallucination more deterministic — not more correct.
- Fine-tuning as a truth engine. Fine-tuning can improve refusal style and domain phrasing; it does not guarantee factuality for open facts.
Common Mistake
Shipping "grounded" UX (source cards in the UI) without verifying that cited spans entail the claims. That is citation theater, not grounding.
Where It Breaks Down
- Creative tasks. Brainstorming and fiction benefit from unconstrained generation. Faithfulness gates designed for factual Q&A will over-refuse. Route by intent.
- Subjective questions. "What's the best approach?" has no single ground truth. Use rubrics and preference eval, not entailment alone.
- Real-time facts. Prices, inventory, weather, and live status need tools — not parametric memory or stale RAG indexes.
- Verification cost. Claim-by-claim NLI can add 200–500ms+ and API spend. Tier verification by risk; cache identical context+answer pairs.
- Adversarial inputs. Prompt injection can override grounding instructions. Combine with guardrails.
- Judge errors. LLM-as-judge and NLI both err — false positives cause over-refusal; false negatives leak hallucinations. Calibrate on your domain golden set.
- Long-context distraction. Huge context windows do not guarantee attention to the right sentence. More tokens can increase intrinsic error if retrieval is noisy.
When NOT to Ship Without Verifiers
Do not rely on fluent generation alone — without grounding and/or verification — when:
- Incorrect answers cause material harm — clinical, legal, financial advice; safety-critical instructions; compliance attestations.
- Outputs are audited — regulators, customers, or internal audit will ask "where did this number come from?"
- Claims drive automated actions — refunds, access grants, config changes, or code execution based on model text.
- Users cannot easily spot errors — dense policy, medical dosing, tax rules, unfamiliar domains.
- You lack a measurement loop — no golden set, no faithfulness metric, no refusal telemetry.
In those cases, either add verifiers (retrieval + claim checks + citations + escalation) or do not use an LLM for that path. Deterministic rules, forms, and human workflows remain valid architectures.
Warning
If hallucination risk is unacceptable and you cannot build a verifier, do not ship generative answers for that use case. Capability demos are not production safety.
Running in Production
Best Practice
Publish an internal faithfulness number on a golden set and block deploys on regression. You cannot manage what you do not measure.
| Dimension | Guidance |
|---|---|
| Scaling | Cache verification for identical context+answer pairs; batch NLI claims; risk-tier which queries get full checks |
| Latency | Verification adds ~200ms–2s. Sync for high-stakes; async post-check + correction for UX-sensitive streams |
| Cost | Prefer small NLI models for online gates; reserve frontier LLM judges for escalations and offline eval |
| Monitoring | Track faithfulness distribution, refusal rate, unsupported-claim rate, citation-invalid rate, user corrections |
| Evaluation | Weekly faithfulness on golden set; CI gate on regressions; refresh cases from production failures — see Evaluation |
| Security | Treat verification as a trust boundary; log failed cases for audit; minimize PII in judge prompts |
| Ops | Pin model IDs; separate factual vs creative routes; alert on refusal spikes (retrieval outage) and faith drops (prompt/index drift) |
Production checklist
- High-recall retrieval with reranking (recall@k target on golden set)
- Prompt: answer only from context; abstain when insufficient
- Temperature 0 on factual paths
- Citations required for auditable claims + span validation
- Claim verification (NLI or judge) before delivery on high-stakes routes
- Refusal / escalation when retrieval or faithfulness is below threshold
- Faithfulness metric in eval suite with CI gate
- Logs: chunks, faith scores, unsupported claims, refusals
- Human escalation path for regulated or low-confidence responses
- Golden set refreshed from production failure cases
Related Guides
Foundations:
- Generative AI — why generation is probabilistic
- Large Language Models — next-token prediction is not truth-seeking
- Prompt Engineering — abstention and ground-only instructions
Mitigations:
- RAG — retrieved knowledge vs parametric memory
- Structured Outputs — schema constraints (format, not truth)
- Hallucination Detection — NLI, claim checks, citation validation
- Guardrails — runtime blocks and policy enforcement
- Evaluation — faithfulness metrics and regression gates
Tools: LangChain · LlamaIndex · ChatGPT · Claude
Interview Questions
-
Why do LLMs hallucinate?
Because training and decoding optimize for likely next tokens, not verified truth. When evidence is missing or ignored, the model fills gaps with plausible text. -
What is the difference between parametric and retrieved knowledge?
Parametric knowledge lives in weights (compressed training data). Retrieved knowledge is injected at inference via search or tools. RAG reduces stale parametric answers but does not guarantee faithful use of context. -
Is chain-of-thought real reasoning?
No — it is longer generation. Intermediate steps can help and can also be confidently wrong. Exact work should go to tools or deterministic code. -
Does RAG eliminate hallucination?
No. It primarily reduces parametric hallucination. Intrinsic contradictions and citation errors remain unless you verify claims against context. -
How would you detect hallucinations in production?
Decompose answers into claims, check entailment against retrieved evidence (NLI or LLM-as-judge), validate citations, and gate delivery on faithfulness thresholds. See Hallucination Detection. -
When should the model abstain?
When retrieval confidence is low, context lacks the answer, or verification fails. In high-stakes domains, over-refusal beats fluent wrong answers. -
Why doesn't temperature 0 fix hallucination?
It selects the most probable continuation more deterministically. If that continuation is unsupported, you get a stable wrong answer. -
How do you measure progress?
Faithfulness / claim-support rates on a labeled golden set, plus refusal rate and citation validity — not preference scores alone. Gate deploys on regressions.
Key Takeaways
- Hallucination is confident fabrication rooted in next-token prediction — fluency is not truth-seeking.
- Separate parametric vs retrieved knowledge; separate generation vs verified reasoning.
- RAG and tools reduce missing-evidence failures; claim verification and citation checks catch unfaithful generation.
- Abstention, structured outputs, guardrails, and evaluation are application layers — not optional polish.
- If risk is unacceptable and you cannot verify, do not ship generative answers for that path.
FAQs
Are hallucinations the same as all errors?
No. Hallucinations are factual fabrication or unsupported claims. Format errors, latency failures, and refusals are different failure modes.
Can frontier models still hallucinate?
Yes. Stronger models often hallucinate less often and more convincingly. Capability reduces rate; it does not eliminate the need for grounding and verification.
Does RAG fix hallucination?
RAG reduces hallucination from missing or outdated training knowledge by supplying context. It does not fix intrinsic hallucination, citation errors, or retrieval misses.
What's the difference between hallucination and confabulation?
Often used interchangeably. "Confabulation" emphasizes filling gaps with plausible content. Engineering practice treats them as the same reliability problem.
How do I measure hallucination rate?
Decompose answers into claims and verify each against context (or a trusted source). Frameworks like RAGAS and DeepEval automate faithfulness scoring. See Evaluation.
Should I use temperature 0?
Yes for factual Q&A. It reduces variance but not hallucination caused by bad context or retrieval failure.
When should the model refuse?
When retrieval confidence is low, context does not contain the answer, or verification fails. Tune thresholds on your eval set — prefer over-refusal in high-stakes domains.
Can fine-tuning eliminate hallucination?
No. Fine-tuning can improve domain style and refusal behavior. Combine with RAG, tools, and verification for factual reliability.
Do citations prevent hallucination?
Citations help humans and systems audit claims. They do not prevent misrepresentation unless you validate that cited spans support the claims.
What's the biggest cause of "hallucination" in RAG systems?
Often retrieval failure — the right evidence never entered the prompt. Fix recall@k before optimizing the generator. See Retrieval Evaluation.
References
- RAGAS — Faithfulness
- DeepEval — Faithfulness Metric
- OpenAI API Documentation
- Anthropic Documentation
- LangChain Documentation