Inferensys

Prompt

RAG Hallucination Detection via Evidence Check Prompt

A practical prompt playbook for using RAG Hallucination Detection via Evidence Check Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the operational context, ideal user, and boundaries for deploying a systematic hallucination audit in a RAG pipeline.

This prompt is designed for verification teams and RAG pipeline operators who need a systematic, repeatable audit of generated answers against their source documents, not a one-off spot check. The core job-to-be-done is to prevent hallucinated or unsupported information from reaching end-users by inserting a structured verification layer after answer synthesis but before the response is returned. The ideal user is an engineer or operator responsible for output quality in a production system where factual accuracy is non-negotiable, such as in legal research, medical literature review, or financial compliance. The required context is a fully generated answer and the exact set of source passages used during retrieval-augmented generation; without both, the prompt cannot perform its function.

Use this prompt when you need to decompose a generated answer into discrete factual statements and classify each as supported, contradicted, or unsupported by the provided evidence. It is appropriate for workflows where a false positive (flagging a correct paraphrase as a hallucination) is less damaging than a false negative (missing a fabricated claim), but you must still calibrate its strictness. This prompt belongs in a post-generation verification layer, wired as a synchronous check or an asynchronous audit step. It is particularly valuable when you are iterating on retrieval quality or model behavior and need a consistent measurement of factual grounding over time, rather than relying on spot-checking or aggregate user feedback.

Do not use this prompt as a substitute for retrieval quality improvements or as a real-time guardrail in latency-sensitive chat applications where the added inference time would degrade user experience. It is also not designed for cases where the source documents themselves contain conflicting information—use a contradiction detection prompt for that upstream task. If your application requires legal or clinical certification of accuracy, this prompt's output should be treated as a preliminary audit that requires human review before any binding decision. The next step after reading this section is to copy the prompt template, adapt the output schema to your logging infrastructure, and run it against a golden dataset of known hallucinations and correct answers to establish your pass/fail thresholds before production deployment.

PRACTICAL GUARDRAILS

Use Case Fit

Where the RAG Hallucination Detection via Evidence Check Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt fits your verification pipeline before integrating it.

01

Good Fit: Post-Generation Audit Workflows

Use when: you have a complete generated answer and the full set of retrieved source documents available. The prompt excels at comparing final output against evidence after generation, not during it. Guardrail: always pass the original retrieved chunks alongside the generated answer—never rely on the model's memory of what sources said.

02

Bad Fit: Real-Time Streaming Generation

Avoid when: you need hallucination detection during token-by-token streaming. This prompt requires the complete answer and evidence set to perform span-level comparison. Guardrail: use this prompt as an async post-processing step after generation completes, not as an inline filter during streaming.

03

Required Inputs: Answer, Sources, and Ground Truth Mapping

What you must provide: the full generated answer text, the complete set of retrieved source documents with identifiers, and optionally a claim decomposition if the answer is long. Guardrail: if source documents lack stable identifiers (chunk IDs, paragraph numbers), the prompt cannot produce traceable hallucination flags—add identifiers before calling this prompt.

04

Operational Risk: Over-Flagging Paraphrased Support

What to watch: the model may flag legitimate paraphrasing as hallucination when the generated answer rephrases source content without copying verbatim. This produces false-positive hallucination flags that erode trust. Guardrail: include few-shot examples distinguishing acceptable paraphrase from unsupported fabrication, and run eval tests measuring false-positive rate against human-annotated paraphrase pairs.

05

Operational Risk: Missed Hallucinations from Implicit Reasoning

What to watch: the model may fail to flag hallucinations that combine facts from multiple sources in unsupported ways, or that draw implicit conclusions not stated in any single source. Guardrail: pair this prompt with a separate cross-document contradiction check and an explicit 'inference detection' step that flags claims requiring multi-source synthesis without explicit support.

06

Scale Consideration: Cost-Per-Verification Budgeting

What to watch: running this prompt on every generated answer multiplies token costs by processing both the answer and all retrieved sources through the model again. Guardrail: implement a triage step that only runs evidence check on high-risk answers—those with low retrieval scores, conflicting sources, or user-reported issues—rather than verifying every output indiscriminately.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for detecting hallucinations in RAG outputs by checking each claim against provided evidence, with explicit instructions to prevent over-flagging legitimate paraphrasing.

This prompt template is designed to be dropped directly into your verification pipeline. It takes a generated answer and the source documents used to produce it, then outputs a structured JSON report flagging unsupported claims, identifying the specific spans of text that lack evidence, and documenting what evidence is missing. The prompt includes explicit guardrails against the common failure mode of flagging paraphrased or reworded support as hallucination, which is critical for maintaining user trust in your RAG system's verification layer.

text
You are an expert fact-checker evaluating a generated answer against provided source documents. Your task is to identify claims in the answer that are not supported by the evidence.

## INPUT

**Generated Answer:**
[GENERATED_ANSWER]

**Source Documents:**
[SOURCE_DOCUMENTS]

## INSTRUCTIONS

1. Decompose the generated answer into discrete, verifiable claims.
2. For each claim, search the source documents for supporting evidence.
3. A claim is SUPPORTED if the source documents contain the same factual information, even if the wording differs. Paraphrasing, synonym use, and rewording do NOT constitute hallucination.
4. A claim is UNSUPPORTED only if the source documents lack the factual content entirely, contradict it, or provide insufficient information to verify it.
5. For each unsupported claim, identify the exact text span in the generated answer and explain what evidence is missing.
6. If the source documents are insufficient to verify a claim but do not contradict it, mark it as INSUFFICIENT_EVIDENCE rather than UNSUPPORTED.

## OUTPUT SCHEMA

Return a JSON object with the following structure:
{
  "overall_assessment": {
    "total_claims": <integer>,
    "supported_claims": <integer>,
    "unsupported_claims": <integer>,
    "insufficient_evidence_claims": <integer>,
    "hallucination_ratio": <float between 0 and 1>
  },
  "claims": [
    {
      "claim_id": <integer>,
      "claim_text": "<exact text from answer>",
      "answer_span": "<character offsets or quote>",
      "verdict": "SUPPORTED | UNSUPPORTED | INSUFFICIENT_EVIDENCE",
      "supporting_source": "<quote from source documents or null>",
      "source_location": "<document identifier and section or null>",
      "missing_evidence_description": "<what evidence would be needed or null>",
      "confidence": "HIGH | MEDIUM | LOW"
    }
  ]
}

## CONSTRAINTS

- Do NOT flag a claim as unsupported solely because the source uses different words. Semantic equivalence counts as support.
- If multiple source documents address the same claim, cite the strongest supporting source.
- If sources contradict each other on a claim, note the contradiction and mark the claim as UNSUPPORTED with an explanation.
- Assign LOW confidence to any verdict where the evidence is ambiguous or incomplete.
- If the generated answer contains no verifiable factual claims, return an empty claims array with appropriate overall_assessment values.

To adapt this prompt for your pipeline, replace [GENERATED_ANSWER] with the full text output from your RAG system and [SOURCE_DOCUMENTS] with the retrieved passages, including document identifiers and section metadata. The output schema is designed for direct parsing into your verification database. If your RAG system uses chunk IDs or paragraph indices, add those to the source_location field for precise provenance tracking. For high-stakes domains like healthcare or legal, add a [RISK_LEVEL] parameter that adjusts the confidence thresholds and requires human review for any UNSUPPORTED verdicts.

Before deploying, test this prompt against a golden dataset that includes both genuine hallucinations and correctly paraphrased support. The most common failure mode is over-flagging—marking reworded but accurate statements as unsupported. If your eval shows high false-positive rates, reinforce the paraphrasing instruction by adding few-shot examples showing acceptable rewording versus actual fabrication. For production use, always log the full prompt response alongside the original answer and sources to enable retrospective audit and prompt iteration.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Validate each before sending to prevent silent failures, hallucinated citations, and mismatched evidence in production RAG verification pipelines.

PlaceholderPurposeExampleValidation Notes

[CLAIM_LIST]

Array of discrete, atomic claims extracted from the generated answer requiring verification

["Acme Corp revenue grew 22% YoY", "The acquisition closed in Q3 2023"]

Must be a non-empty array. Each claim must be a single verifiable assertion. Reject compound claims containing multiple facts. Validate array length >= 1 before prompt assembly.

[RETRIEVED_EVIDENCE]

Source documents or passages retrieved from the knowledge base to check claims against

["source_id: doc-451, text: Acme 10-K shows revenue increased 22% to $4.2B...", "source_id: doc-782, text: The merger completed on September 15, 2023..."]

Must contain source_id and text fields per evidence object. Validate that evidence array is not empty. If retrieval returns zero results, set to explicit empty array and expect [NO_EVIDENCE_FOUND] output behavior.

[EVIDENCE_METADATA]

Provenance information for each evidence chunk including source title, date, and authority level

{"doc-451": {"title": "Acme 2023 10-K Filing", "date": "2024-02-15", "authority": "primary"}}

Must be a valid JSON object keyed by source_id matching [RETRIEVED_EVIDENCE] entries. Date field required for recency checks. Authority field must use controlled vocabulary: primary, secondary, or tertiary. Reject if source_ids do not match evidence array.

[OUTPUT_SCHEMA]

Expected JSON structure for hallucination detection results including claim-level verdicts and evidence gaps

{"claim_id": "string", "verdict": "supported|contradicted|insufficient_evidence|no_evidence_found", "matched_evidence_ids": ["string"], "unsupported_span": "string|null", "explanation": "string"}

Must be a valid JSON Schema or example structure. Validate that verdict field uses only the four allowed enum values. unsupported_span must be null when verdict is supported. matched_evidence_ids must be empty array when verdict is no_evidence_found.

[CONFIDENCE_THRESHOLD]

Minimum confidence score required to auto-accept a supported verdict without human review

0.85

Must be a float between 0.0 and 1.0. Claims scoring below this threshold route to human review queue. Validate that threshold is not set to 0.0 in production, which disables review gating. Null allowed only when human review is disabled with explicit approval.

[DOMAIN_CONTEXT]

Domain-specific terminology, entity definitions, and acceptable paraphrase patterns to reduce false hallucination flags

"Acme Corp" refers to Acme Corporation (NYSE: ACME). "Q3" refers to fiscal quarter ending September 30. Revenue figures may be reported as "top line" or "sales" in source documents.

Must be a non-empty string when verifying domain-specific content. Validate that entity definitions cover all named entities in [CLAIM_LIST]. Missing domain context causes over-flagging of legitimate paraphrases as hallucinations. Reject empty string for financial, medical, or legal domains.

[HALLUCINATION_SEVERITY_LEVELS]

Severity classification rules for detected hallucinations to prioritize review queues

{"critical": "fabricated numbers or dates", "high": "misattributed source or quote", "medium": "paraphrase drift changing meaning", "low": "minor detail omission"}

Must define at least three severity levels with clear criteria. Validate that severity labels map to downstream routing rules. Critical hallucinations should trigger immediate review escalation. Null allowed only when all hallucinations receive equal priority treatment.

[MAX_PARAPHRASE_DISTANCE]

Semantic similarity threshold below which paraphrased support is accepted as equivalent rather than flagged as unsupported

0.92

Must be a float between 0.0 and 1.0. Lower values increase false negatives (missed hallucinations). Higher values increase false positives (over-flagging paraphrases). Validate against calibration dataset before production deployment. Default 0.90 if not specified.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when detecting hallucinations via evidence checks and how to guard against it in production.

01

Paraphrased Support Flagged as Hallucination

What to watch: The model incorrectly flags a claim as unsupported because the evidence expresses the same fact using different words, synonyms, or sentence structures. This over-flagging destroys user trust and creates a flood of false positives. Guardrail: Add explicit instructions and few-shot examples that define semantic equivalence, not just keyword overlap. Include a 'paraphrase match' category in the output schema and test with a golden set of reworded true claims.

02

Silent Evidence Fabrication

What to watch: The model cites a source that does not exist, attributes a quote to the wrong document, or invents a supporting passage that sounds plausible but is absent from the provided context. This is the most dangerous failure mode because it produces confident-looking, verifiable falsehoods. Guardrail: Require the model to quote the exact evidence span verbatim. Implement a post-generation string-match validator that checks whether every quoted string actually appears in the source documents before the output is surfaced.

03

Context Window Truncation Causing False Negatives

What to watch: When evidence is placed in the middle or end of a long context window, the model may fail to attend to it and incorrectly report 'no evidence found.' This 'lost-in-the-middle' problem is a well-known failure mode for long-context retrieval. Guardrail: Re-rank and place the most relevant evidence chunks at the very beginning and very end of the prompt. For critical claims, run a second verification pass with the evidence isolated to confirm the initial result.

04

Over-Reliance on Source Authority Cues

What to watch: The model defers to a source because it sounds authoritative (e.g., academic tone, official-sounding domain) even when the content is factually wrong or outdated. Conversely, it may dismiss a correct source that appears informal. Guardrail: Instruct the model to evaluate the evidence content itself, not the perceived authority of the source. Strip or normalize source metadata in the prompt to blind the model to domain names and author credentials during the matching step.

05

Ambiguous Claims Matched to Irrelevant Evidence

What to watch: A claim with multiple interpretations is matched to evidence that supports a different interpretation, producing a false positive verification. The model fails to disambiguate the claim's meaning before searching for support. Guardrail: Add a pre-verification step that rewrites the claim to resolve ambiguity or explicitly lists the possible interpretations. Require the evidence check to state which specific interpretation is being verified before declaring support.

06

Temporal Drift Between Claim and Evidence

What to watch: A claim about a current state is matched against evidence that was true six months ago but is now outdated. The model reports 'supported' without checking the recency of the evidence relative to the claim's timeframe. Guardrail: Include explicit recency constraints in the prompt (e.g., 'Evidence must be dated within the last 30 days to support a claim about the current quarter'). Require the output to include the evidence publication date and a recency validity flag.

IMPLEMENTATION TABLE

Evaluation Rubric

How to test output quality before shipping. Run these checks against a golden dataset of at least 50 answer-source pairs with known hallucination labels.

CriterionPass StandardFailure SignalTest Method

Hallucination Recall

= 95% of known hallucinations flagged

Flagged < 90% of labeled unsupported spans

Run against golden dataset; compute recall over hallucinated spans

Hallucination Precision

= 85% of flags are true hallucinations

25% of flags are paraphrased support mislabeled as hallucination

Manual review of 50 flagged spans; compute precision

Supported Span Non-Flag Rate

<= 5% of supported spans incorrectly flagged

10% of grounded claims marked as hallucination

Run against golden dataset; measure false-positive rate on supported spans

Missing Evidence Gap Documentation

Every hallucination flag includes a specific gap description

Flags returned without [MISSING_EVIDENCE] field or with empty string

Schema validation: assert [MISSING_EVIDENCE] is non-empty for every flag

Source Span Citation Accuracy

= 95% of cited source spans exist in the provided documents

Citation references paragraph ID or chunk index not present in source set

Exact-match check of all cited [SOURCE_LOCATOR] values against document index

Output Schema Compliance

100% of outputs parse against the expected JSON schema

Missing required fields, wrong types, or unparseable JSON

Automated schema validation on all test outputs; reject on first failure

Over-Flagging Threshold

Paraphrased support flagged in <= 5% of supported cases

Consistently flags reworded source statements as unsupported

Adversarial test set with paraphrased support; measure flag rate

Null Evidence Handling

Returns explicit NO_EVIDENCE_FOUND when retrieval returns zero results

Returns hallucination flags with fabricated source references or empty citations

Test with empty retrieved context; assert output contains NO_EVIDENCE_FOUND status

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a small set of 5-10 [CLAIM]-[EVIDENCE] pairs. Remove strict output schema requirements initially—accept a simple JSON object with verdict and explanation fields. Use a single retrieved document as the evidence source to isolate behavior. Run manually and inspect outputs for hallucination flag accuracy before adding automation.

Watch for

  • Over-flagging: the model marking paraphrased support as hallucination because wording differs from source
  • Under-flagging: missing unsupported claims that sound plausible but lack evidence
  • Inconsistent verdict labels across runs (e.g., 'unsupported' vs 'no_evidence' vs 'hallucination')
  • Model fabricating source quotes when evidence is insufficient
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.