LLM Concepts

Hallucination Detection Guide

Engineering hallucination detection for LLM systems using claim decomposition, NLI, self-checks, citation verification, faithfulness scoring, and production delivery gates.

60 min readIntermediateLast reviewed: 21 July 2026

Quick Summary

Hallucination detection tests whether each factual claim in an LLM response is supported by an authoritative evidence set before the response crosses a trust boundary.

One Analogy

It is a fact-checking desk between a fast writer and publication: the writer drafts, but evidence must support every publishable claim.

Engineering Rule

Never infer truth from fluency or model confidence; define the evidence boundary, verify atomic claims, calibrate on labeled data, and fail safely when support is insufficient.

TL;DR

  • Detection is not prevention. RAG, prompting, tools, and model training reduce the chance of unsupported generation. Detection evaluates the response that was actually produced and decides whether to deliver, revise, abstain, or escalate it.
  • Define what “supported” means first. Corpus faithfulness asks whether a claim follows from supplied evidence. Factual correctness asks whether it is true in the world. A response can be unfaithful but true, or faithful to an incorrect source.
  • Claim decomposition is the practical unit of work. Split an answer into atomic factual claims, map each claim to evidence, classify it as entailed, contradicted, or not established, then aggregate without hiding one severe error behind many trivial correct claims.
  • NLI, LLM judges, citation checks, and self-consistency are signals, not oracles. Each has distinct errors. Production systems combine deterministic checks with one or more semantic verifiers and calibrate thresholds on domain-specific labeled examples.
  • RAGAS-style faithfulness is useful but incomplete. A ratio such as supported claims divided by total claims is interpretable, but claim extraction, evidence coverage, severity, and judge accuracy determine whether the score means anything.
  • Run detection as an observable delivery gate. Record evidence identifiers, verifier versions, per-claim decisions, latency, cost, overrides, and eventual user or reviewer feedback. Use those traces to improve LLM evaluation and guardrails.

On this page

Why This Matters

An LLM answer can be syntactically valid, on-topic, polite, and still state the wrong dosage, refund window, account balance, or legal requirement. Conventional software checks catch malformed JSON and invalid enum values; they do not establish that a sentence follows from evidence. The output therefore crosses a different trust boundary: semantic claims must be verified, not merely parsed.

The cost of an undetected hallucination depends on the action it influences. A wrong movie summary may be inconvenient. A fabricated compliance exception may create legal exposure. A customer-support answer that invents a refund entitlement can trigger financial loss. Detection turns this vague risk into measurable system behavior: claim support rate, contradiction rate, abstention rate, reviewer disagreement, and escaped-error rate.

Detection also localizes responsibility. A weak answer may result from missing retrieval, irrelevant context, contradictory sources, poor generation, or a faulty verifier. A claim-level trace shows which stage failed. That distinction matters because model limitations and engineering mitigations are different:

Model limitation Engineering mitigation
Generates likely tokens, not verified propositions Ground outputs and verify claims against evidence
Internal knowledge may be stale Retrieve versioned sources or query live systems
Confidence language is not calibrated probability Ignore rhetorical certainty; calibrate external detectors
Long context can dilute relevant evidence Select, rank, and attribute evidence per claim
May follow malicious instructions inside documents Isolate data from instructions and enforce source policy

The companion Hallucinations guide explains why the failure exists and how to reduce it. This guide focuses on measuring residual failures after generation.

The Problem Hallucination Detection Solves

The operational problem is not “does this text look suspicious?” Hallucinated text often looks normal. The problem is:

Given a response, an authorized evidence set, and a task policy, determine which claims are supported strongly enough to cross the delivery boundary.

That definition contains three contracts:

  1. Response contract: what counts as a factual claim, recommendation, calculation, or quoted statement?
  2. Evidence contract: which documents, database rows, tool results, timestamps, and source versions are authoritative?
  3. Decision contract: which labels and scores lead to deliver, revise, abstain, or human review?

Without those contracts, “hallucination score” collapses several different questions. Consider “Paris is the capital of France” when the supplied policy manual says nothing about France. It is world-factually correct but unsupported by the evidence boundary. A corpus-grounded assistant should label it unsupported. A general fact checker might verify it using another source. Neither label is universally correct; the product contract determines the target.

Similarly, a response can faithfully repeat a source that is outdated. Faithfulness detection will pass it. Source freshness and factual correctness need separate checks. Detection does not repair bad ground truth.

How We Got Here

Early language-model evaluation relied on lexical overlap with reference answers. Metrics such as BLEU and ROUGE were useful for constrained generation but weak for open-ended answers: many correct phrasings share few words, and a response can overlap strongly while adding one unsupported assertion.

As chat systems and RAG moved into production, evaluation shifted toward semantic similarity, NLI, claim verification, and LLM-as-judge methods. RAG made the evidence boundary explicit, enabling “is the answer supported by retrieved context?” to become a computable question. Frameworks then packaged faithfulness, groundedness, and hallucination metrics into offline test runners and production traces.

Diagram: Evolution of hallucination detection

timeline
    title From overlap metrics to claim verification
    2016-2020 : Reference overlap
              : Token probability signals
    2021-2022 : NLI-based factual consistency
              : Sampling and self-checks
    2023-2024 : RAG faithfulness metrics
              : LLM-as-judge adoption
    2025-2026 : Claim traces and delivery gates
              : Calibrated hybrid verifiers

Detection evolved from answer-level similarity toward evidence-bound, claim-level decisions integrated into runtime control.

This history explains why current tools use similar words for different implementations. “Hallucination metric” may mean answer-reference similarity, context entailment, self-consistency, citation correctness, or an LLM rubric. Read the metric definition and inspect its intermediate artifacts before trusting the name.

What Is Hallucination Detection?

Hallucination detection is a family of methods that identify generated claims that are contradicted by, or not established by, an accepted evidence source. In a grounded application, the basic object is a tuple:

(claim, evidence, source policy, verifier version, decision)

Useful labels are:

  • Supported: the authorized evidence entails the claim at the required granularity.
  • Contradicted: evidence directly conflicts with the claim.
  • Not established: evidence neither supports nor contradicts it.
  • Unverifiable: the system cannot evaluate it because evidence, language, modality, or verifier capability is missing.

Do not merge “not established” with “contradicted.” The first often indicates retrieval or coverage failure; the second indicates conflict. They should trigger different remediation.

Detection operates at several levels:

Level Question Typical implementation
Claim Does evidence support this proposition? NLI or rubric-based judge
Citation Does this source and span exist and support the claim? Identifier, span, and entailment checks
Answer How much of the response is supported? Weighted claim aggregation
Conversation Did an earlier unsupported claim propagate? Turn-level claim ledger
Dataset Did a change increase unsupported output? Offline eval and regression gates

How Hallucination Detection Works

1. Establish an evidence boundary

Evidence can be retrieved passages, database results, API responses, approved web pages, or a labeled reference answer. Preserve source ID, version, timestamp, tenant, and authorization scope. Concatenated text without provenance makes citation validation and incident analysis difficult.

2. Decompose the answer

“Premium accounts receive refunds within 60 days and free expedited shipping” contains two independently verifiable claims. Sentence splitting misses conjunctions; unconstrained LLM decomposition may over-split or silently omit claims. Require structured output, stable claim IDs, original character spans, and a coverage check.

3. Select evidence per claim

Passing every retrieved document to every verifier increases cost and can lower accuracy through distraction. First use explicit citations, lexical matching, embeddings, or a reranker to identify likely supporting passages. Retain enough context to interpret qualifications and exceptions.

4. Verify support

An NLI model treats evidence as the premise and the claim as the hypothesis, returning entailment, contradiction, or neutral. An LLM judge applies a stricter rubric and can reason across multiple passages, but is slower, nondeterministic across model versions, and vulnerable to prompt injection in evidence. Deterministic checks should handle identifiers, numbers, dates, quotes, and schema constraints where possible.

5. Aggregate and decide

A simple faithfulness score is:

faithfulness = supported_claims / verifiable_claims

This RAGAS-style ratio is illustrative, not a universal standard. Weighting claims by severity or user impact is often safer. One incorrect dosage must not be averaged away by nine harmless supported statements. Keep contradiction, unsupported, and unverifiable rates visible alongside any aggregate.

RAGAS faithfulness metric showing claim extraction and support against retrieved context

Source: Ragas faithfulness documentation

6. Route the response

The delivery policy can pass supported responses, remove unsupported claims, regenerate with better evidence, abstain, or request review. Re-verify revisions; rewriting can introduce new claims.

Architecture

A production detector belongs between generation and external side effects. It needs access to generation traces and evidence metadata but should be independently deployable and versioned.

Diagram: Evidence-bound verification architecture

flowchart LR
    Q[User query] --> R[Retriever or tools]
    R --> E[Evidence bundle]
    Q --> G[Generator]
    E --> G
    G --> D[Claim decomposer]
    D --> V[Verifier ensemble]
    E --> S[Evidence selector]
    S --> V
    V --> P[Decision policy]
    P -->|pass| U[Deliver]
    P -->|revise| G
    P -->|abstain| A[Safe response]
    P -->|review| H[Human queue]
    V --> O[Eval and telemetry]

The generator proposes text; an independent policy combines per-claim verification with domain risk before delivery.

Core components:

  • Evidence bundle: immutable source records, authorization scope, timestamps, and retrieval scores.
  • Claim service: structured extraction with span coverage and deduplication.
  • Evidence selector: maps claims to the smallest sufficient source set.
  • Verifier ensemble: deterministic validators, NLI, and optionally an LLM judge.
  • Policy engine: applies calibrated thresholds, severity, and fallback rules.
  • Trace store: records intermediate artifacts with privacy controls and retention limits.
  • Evaluation pipeline: replays labeled cases against new prompts, models, and thresholds.

Use separate model and prompt versions for generation and judging where practical. Independence does not guarantee correctness, but it reduces correlated failure. Never allow untrusted retrieved text to redefine the judge rubric; delimit it as data.

Step-by-Step Flow

  1. Receive the task and policy. Resolve tenant, domain, acceptable sources, maximum age, and risk tier before retrieval.
  2. Retrieve or query evidence. Preserve stable source IDs and exact spans. Reject unauthorized sources even if semantically relevant.
  3. Generate with attribution. Ask the model to associate factual claims with source IDs. Citation generation helps verification but is not itself proof.
  4. Parse the output. Validate structure and extract atomic claims, quotations, numbers, and citations. Record their source positions.
  5. Check claim coverage. Ensure the decomposition represents all factual content. Unparsed clauses become unverifiable, not silently supported.
  6. Validate citations deterministically. Confirm document IDs exist, spans are exact or normalized matches, and versions match the evidence bundle.
  7. Run semantic verification. Use NLI for broad screening and an LLM judge for ambiguous, multi-hop, or high-impact claims.
  8. Aggregate with severity. Compute transparent metrics and identify the worst decision-driving claim.
  9. Apply the delivery policy. Pass, revise, retrieve again, abstain, or route to a reviewer.
  10. Verify the final text. Any revised response is new generated content and must repeat the checks.
  11. Emit telemetry. Store redacted claim decisions, versions, timing, cost, and reason codes.
  12. Feed evaluation. Add escaped errors and reviewer disagreements to the golden set.

Diagram: Runtime verification sequence

sequenceDiagram
    participant App
    participant RAG
    participant LLM
    participant Detector
    participant Policy
    App->>RAG: query with source policy
    RAG-->>App: versioned evidence
    App->>LLM: query plus evidence
    LLM-->>App: answer plus citations
    App->>Detector: answer and evidence
    Detector->>Detector: decompose and verify
    Detector-->>Policy: claim decisions
    alt all critical claims supported
        Policy-->>App: deliver
    else repairable
        Policy-->>App: retrieve or revise
    else unsafe or unverifiable
        Policy-->>App: abstain or review
    end

The policy consumes evidence-backed decisions, not the generator’s self-reported confidence.

Real Production Example

Assume a customer-support RAG system answers policy questions. Retrieved policy refunds-v17 says premium purchases are refundable for 60 days; it says nothing about shipping. The generated answer claims both a 60-day refund period and free expedited shipping.

The following simplified implementation demonstrates the boundary. It uses dependency injection so production deployments can use an NLI model, an LLM rubric, or both. Timeouts and model calls belong in the adapter, while the policy remains deterministic.

from dataclasses import dataclass
from enum import Enum
from typing import Protocol

class Label(str, Enum):
    SUPPORTED = "supported"
    CONTRADICTED = "contradicted"
    NOT_ESTABLISHED = "not_established"
    UNVERIFIABLE = "unverifiable"

@dataclass(frozen=True)
class Evidence:
    source_id: str
    version: str
    text: str

@dataclass(frozen=True)
class Claim:
    claim_id: str
    text: str
    severity: int = 1

@dataclass(frozen=True)
class Decision:
    claim_id: str
    label: Label
    confidence: float
    evidence_ids: tuple[str, ...]
    reason: str

class Verifier(Protocol):
    def verify(self, claim: Claim, evidence: list[Evidence]) -> Decision: ...

def score(decisions: list[Decision]) -> float:
    verifiable = [d for d in decisions if d.label != Label.UNVERIFIABLE]
    if not verifiable:
        return 0.0
    supported = sum(d.label == Label.SUPPORTED for d in verifiable)
    return supported / len(verifiable)

def route(claims: list[Claim], decisions: list[Decision]) -> str:
    by_id = {d.claim_id: d for d in decisions}
    critical_failure = any(
        claim.severity >= 3
        and by_id[claim.claim_id].label != Label.SUPPORTED
        for claim in claims
    )
    if critical_failure:
        return "REVIEW"
    if any(d.label == Label.CONTRADICTED for d in decisions):
        return "ABSTAIN"
    if score(decisions) < 0.90:
        return "REVISE"
    return "DELIVER"

For the sample answer, claim extraction produces:

[
  {
    "claim_id": "c1",
    "text": "Premium purchases can be refunded within 60 days.",
    "severity": 2
  },
  {
    "claim_id": "c2",
    "text": "Premium members receive free expedited shipping.",
    "severity": 1
  }
]

An NLI verifier should label c1 entailed and c2 neutral or not established. Do not map neutral to contradiction. The policy returns REVISE, and a revision constrained to supported claims removes the shipping statement.

Faithfulness checks

For offline RAG evaluation, store the question, evidence, answer, extracted claims, labels, and expected action. A RAGAS-style scorer can automate decomposition and support classification. Inspect extracted claims during development: a high score is misleading if the extractor omitted the risky clause.

DeepEval faithfulness or hallucination evaluation workflow

Source: DeepEval documentation

NLI and self-check patterns

NLI provides a fast first pass for short, local claims. Calibrate entailment and contradiction thresholds separately; the highest softmax label is not automatically reliable. For complex claims, route uncertain cases to an LLM judge that must quote supporting spans and return a typed label.

Self-checking generates multiple candidate answers or asks the model to critique its answer. Disagreement is useful when no external evidence exists, but consensus does not establish truth: all samples can repeat the same learned misconception. Treat self-consistency as an uncertainty feature, never as ground truth.

Evaluation harness

Run the detector against a fixed dataset in CI, including supported, contradicted, missing-evidence, stale-source, multi-hop, numerical, and adversarial cases. Compare versions on precision, recall, false-negative severity, latency, and cost—not only mean score.

OpenAI Evals repository and evaluation workflow

Source: OpenAI Evals

This example is illustrative. Framework defaults, model behavior, and metric definitions change. Pin versions and retain enough artifacts to reproduce each decision.

Design Decisions

NLI or LLM judge?

Use NLI when claims are short, evidence is local, throughput is high, and you can host or batch a classifier. Use an LLM judge for multi-passage synthesis, domain language, and explanations. A common cascade runs deterministic checks first, NLI second, and an LLM judge only for uncertain or high-severity claims.

Binary or multi-class labels?

Binary supported/unsupported is operationally simple but conflates contradiction, missing evidence, and verifier failure. Multi-class labels produce better remediation and monitoring. You may still map them to a binary gate at the final boundary.

Full coverage or sampling?

Verify every response where one error can cause material harm. Sample in low-risk, high-volume systems when verification cost exceeds risk, but always verify privileged operations, regulated content, numeric commitments, and responses triggered by weak retrieval.

Revise or refuse?

Revision improves usability when unsupported clauses can be removed safely. Refusal is safer when evidence is contradictory, the main claim fails, or regeneration could conceal the incident. Human review fits asynchronous high-value decisions.

Threshold selection

Do not copy 0.85 from a framework example. Choose thresholds using a labeled validation set representative of production. Optimize for risk-weighted false negatives under latency and abstention constraints. Recalibrate whenever the verifier model, prompt, evidence format, or domain distribution changes.

When should I use this?

Use detection Do not treat detection as
Runtime faithfulness / citation checks A substitute for grounding (RAG)
Eval gates before promotion Proof the model “knows” facts
Sampling risky answers for human review Authorization or safety policy alone (guardrails)
Measuring grounded-generation quality A reason to skip structured validation

Comparisons

Approach Needs external evidence Strength Main failure Best role
Citation existence check Yes Deterministic and cheap Existing citation may not support claim First gate
Exact quote/span check Yes Detects fabricated quotes Paraphrases need semantics Citation integrity
NLI classifier Yes Fast, batchable labels Weak on long or multi-hop evidence Broad screening
LLM-as-judge Usually Handles nuanced evidence Cost, drift, correlated errors Escalation
Self-consistency No Uncertainty signal without corpus Consistent falsehoods pass Supplemental signal
Token probability No Available during generation Poor truth calibration Research/feature input
Human review Preferably Handles ambiguity and policy Slow, expensive, inconsistent High-risk escalation

Detection versus prevention is the most important comparison:

Prevention Detection
Changes evidence, prompt, model, or decoding before/during generation Evaluates claims after or alongside generation
Reduces incident probability Measures and gates residual incidents
Includes RAG, tools, abstention prompts, fine-tuning Includes entailment, citations, judges, and review
Cannot guarantee the produced answer is supported Cannot recover facts absent from the evidence

Production reliability requires both. Prevention without detection is unmeasured optimism; detection without prevention creates avoidable cost and abstention.

Common Mistakes

  1. Treating confidence language as probability. “I am certain” is generated text. It is not calibrated evidence.
  2. Calling unsupported claims false. Missing support and contradiction are different labels with different root causes.
  3. Evaluating against all available text. Unauthorized, stale, or postdated sources can make a response appear supported. Use the source policy active at generation time.
  4. Scoring only whole answers. A single dangerous claim disappears inside a generally correct response. Preserve claim-level results.
  5. Trusting citations without checking entailment. A valid document ID can point to irrelevant or contradictory content.
  6. Letting the same prompt both generate and approve. Self-approval creates correlated errors and weak separation of duties.
  7. Using a framework score without inspecting claims. Extraction omissions and judge drift can produce stable but invalid metrics.
  8. Averaging away severity. Ten supported pleasantries cannot offset one wrong account number or dosage.
  9. Revising without re-verification. A second generation can add new unsupported content.
  10. Logging sensitive prompts indiscriminately. Verification traces may contain private documents and user data. Redact and enforce retention.
  11. Ignoring retrieval failures. The generator cannot cite evidence that retrieval omitted. Track retrieval and generation quality separately.
  12. Deploying uncalibrated thresholds. Provider scores and NLI probabilities are not portable across domains.

Where It Breaks Down

Detection has an observability ceiling: it cannot verify what it cannot represent or access. Open-ended predictions, subjective advice, private real-world events, and creative content may have no authoritative evidence. For those tasks, uncertainty communication and human judgment are more appropriate than a binary faithfulness gate.

Long, multi-hop arguments challenge decomposition and entailment. A claim may follow only through several premises, arithmetic, or temporal reasoning. NLI models often mark these neutral, while LLM judges may invent a bridge. Route calculations to deterministic tools and require explicit evidence paths.

Source conflicts are another boundary. Two policy versions may disagree, or an API may update after retrieval. The detector must apply source precedence and effective dates; semantic similarity cannot resolve governance.

Adversarial evidence can instruct an LLM judge to output “supported.” Delimit evidence, use fixed system-level rubrics, strip active content, and test injection cases. Even then, an LLM verifier is not a security boundary.

Language, domain, and modality shifts also degrade accuracy. A verifier calibrated on English support articles may fail on contracts, tables, screenshots, or mixed-language chats. Measure each slice separately and label unsupported modalities unverifiable.

Finally, humans disagree. Legal interpretation and medical nuance may not reduce to entailment. Record reviewer disagreement and define escalation rather than forcing a false objective label.

When NOT to Use Hallucination Detection

Do not add a semantic hallucination detector when deterministic software can answer the question. If the user requests an account balance, query the ledger and render the typed value. Generation plus verification is less reliable than direct computation.

Avoid strict evidence-faithfulness gates for creative writing, brainstorming, role-play, or clearly labeled speculation. The evidence contract does not fit the product. Use content safety and task-specific quality checks instead.

Do not use automated detection as final authority for irreversible medical, legal, financial, or access-control decisions. It can prioritize review and block obvious failures, but qualified humans and deterministic policy systems must own the decision.

Decision tree: Choose the verification path

stateDiagram-v2
    [*] --> Deterministic: Can software compute it?
    Deterministic --> DirectOutput: Yes
    Deterministic --> Evidence: No
    Evidence --> Creative: No authoritative evidence
    Creative --> SafetyChecks: Creative or subjective
    Evidence --> Verify: Evidence available
    Verify --> AutoGate: Low or medium risk
    Verify --> HumanReview: High risk
    DirectOutput --> [*]
    SafetyChecks --> [*]
    AutoGate --> [*]
    HumanReview --> [*]

Prefer direct computation first, evidence verification second, and human authority where consequences exceed detector reliability.

Running in Production

Best Practice

Treat every verifier as a versioned model with its own test set, drift, latency budget, and rollback plan.

Track at least:

  • Claim counts and decomposition coverage
  • Supported, contradicted, not-established, and unverifiable rates
  • Risk-weighted false-negative and false-positive rates on reviewed samples
  • Delivery, revision, abstention, retry, and human-review rates
  • Retrieval coverage and source freshness
  • Verifier latency, timeout, token use, and cost
  • Model, prompt, rubric, threshold, and dataset versions
  • Reviewer overrides and escaped incidents

Use canary releases for verifier changes. Shadow-score production traffic before enforcing a new threshold, compare decisions against the current version, and review disagreement slices. A lower hallucination rate may simply reflect more refusals; monitor utility and task completion alongside safety.

Timeout behavior must be explicit. For high-risk answers, a detector timeout should fail closed to abstention or review. For low-risk content, policy may deliver with a visible caveat, but record the bypass. Never silently treat verifier failure as support.

Cache verification only when the answer, normalized evidence content, source versions, policy, and verifier version all match. Evidence freshness invalidates old decisions. Protect the cache and trace store using the same authorization controls as the underlying documents.

Build feedback loops from confirmed incidents, but avoid training directly on noisy thumbs-down signals. Review and label cases, identify whether retrieval, generation, decomposition, verification, or policy failed, then add focused regression examples. Connect these suites to evaluation and broader LLM evaluation.

Important

A production metric is useful only if it leads to an action. Define owners and runbooks for contradiction spikes, rising unverifiable rates, source-version mismatches, and verifier timeouts.

  • Hallucinations — model causes, failure taxonomy, and prevention layers.
  • RAG — establishes the retrieved evidence used by corpus-grounded detection.
  • RAG Evaluation — measures retrieval context and answer faithfulness together.
  • LLM Evaluation — builds datasets, judges, human review, and regression gates.
  • Guardrails — turns detector decisions into runtime enforcement and fallback behavior.
  • Evaluation — connects quality metrics to release and monitoring processes.

Interview Questions

What is the difference between faithfulness and factual correctness?

Faithfulness asks whether the response follows from the supplied evidence. Factual correctness asks whether it is true according to an authoritative view of the world. A response can faithfully repeat a wrong source or state a true fact that is unsupported by the supplied corpus.

Why decompose an answer into claims?

Claims are independently verifiable and actionable. Answer-level scores hide partial hallucinations and cannot map a failure to evidence. Decomposition also enables severity weighting, targeted revision, and better incident traces.

When would you choose NLI over an LLM judge?

Choose NLI for high-throughput, short premise-hypothesis pairs where cost and predictable latency matter. Choose an LLM judge for complex, multi-passage, or domain-specific reasoning. Calibrate either method on representative labels.

How would you set a faithfulness threshold?

Build a labeled validation set, define costs for escaped errors and unnecessary abstentions, evaluate by risk slice, and select a threshold satisfying the false-negative constraint under latency and utility budgets. Recalibrate after any material verifier change.

Why is self-consistency insufficient?

Multiple generations can consistently reproduce the same false belief. Disagreement indicates uncertainty, but agreement does not prove a claim against external evidence.

How do you prevent the verifier from being prompt-injected?

Treat evidence as untrusted data, separate it from the rubric, delimit and sanitize it, use deterministic checks where possible, constrain output schemas, and test adversarial documents. Do not treat an LLM judge as a security boundary.

What should happen when evidence is missing?

Label the claim not established or unverifiable, then retrieve again, abstain, or request review according to risk. Do not reinterpret missing evidence as either support or contradiction.

How do you evaluate the detector itself?

Use claim-level labels from representative production cases. Measure precision, recall, calibration, severity-weighted false negatives, slice performance, decomposition coverage, latency, and cost. Include reviewer disagreement and adversarial cases.

Key Takeaways

  • Hallucination detection verifies generated claims against an explicit evidence and source-policy boundary.
  • Detection complements prevention; it does not replace RAG, tools, abstention, or better generation.
  • Claim decomposition, citation integrity, semantic verification, and deterministic checks form a practical pipeline.
  • Faithfulness scores are only as valid as claim coverage, evidence quality, verifier calibration, and aggregation policy.
  • Separate supported, contradicted, not established, and unverifiable outcomes.
  • Gate by risk and worst critical claim, not only average score.
  • Version and observe detectors like any other production model.
  • Prefer direct computation over generation when authoritative structured data exists.

FAQs

Can hallucinations be detected from the output alone?

Not reliably. Token probabilities, style features, and self-consistency can indicate uncertainty, but truth requires comparison with evidence or a trusted authority. Fluent falsehoods often look identical to correct text.

Does RAG eliminate hallucinations?

No. RAG supplies evidence and reduces missing-knowledge failures, but the model can ignore, misread, combine, or mis-cite retrieved passages. Detection verifies whether the final claims are actually supported.

Is a low faithfulness score always a model failure?

No. It may indicate retrieval gaps, stale or conflicting sources, incomplete claim extraction, verifier error, or generation failure. Preserve intermediate artifacts to identify the responsible stage.

What is a good hallucination threshold?

There is no portable default. Select it using labeled domain data and explicit risk costs. The same numeric score can mean different things across judges, prompts, models, and datasets.

Should neutral NLI results count as hallucinations?

Treat neutral as not established, not contradicted. A delivery policy may still block it in a corpus-grounded system, but the diagnostic label should remain distinct.

Are citations enough?

No. Validate that the source exists, the cited version was available, the quoted span exists, and the span entails the associated claim. Plausible citation formatting is not evidence.

Can the generator judge itself?

It can provide a supplemental critique, but correlated failures make self-approval weak. Prefer independent prompts or models, deterministic checks, and external evidence. High-risk decisions still need stronger authority.

How does detection work for streaming responses?

Buffer claims or clauses and verify before committing them to the user. Strict systems may delay the entire answer. Lower-risk systems can stream provisional text but must clearly handle later retraction; that UX is often worse than modest buffering.

How do I handle multi-turn conversations?

Maintain a claim ledger with source versions and verification status. Do not treat previous assistant messages as ground truth. Re-verify inherited claims when sources, policies, or time-sensitive facts change.

Is human review a perfect fallback?

No. Reviewers disagree and can miss subtle errors. Give them claim-evidence pairs, clear rubrics, source provenance, and escalation paths, then measure inter-rater agreement and overrides.

References

Further Reading

Next Topics

Learning Path

Continue Learning

Related Guides

Related Tools

ToolCategoryPurposeWebsiteBest For
LangChain
PopularOpen SourceAPI
frameworksFramework for building LLM-powered applications and workflows.langchain.comRAG systems
LlamaIndex
Open SourceAPI
frameworksData framework for connecting LLMs to private and structured data.llamaindex.aiRAG over documents