This prompt is designed for RAG system builders and content verification teams who need to programmatically verify whether a generated answer is factually consistent with its source documents. It produces a structured consistency report that classifies every claim in the answer as supported, unsupported, or contradicted by the provided evidence. Use this when you need an automated judge to catch hallucinations before outputs reach users, when you are building evaluation pipelines for groundedness metrics, or when you need audit trails showing exactly which claims trace back to which source passages.
Prompt
Factual Consistency Check Against Source Prompt Template

When to Use This Prompt
A practical guide for RAG system builders and content verification teams on when and how to deploy the Factual Consistency Check prompt in production pipelines.
This prompt assumes you already have a generated answer and the source documents it should be grounded in. It does not generate answers, retrieve documents, or make subjective quality judgments about writing style. The ideal user is an AI engineer or evaluation lead who has already built a RAG pipeline and needs a reliable, structured consistency check that can run at scale—either as a pre-release gate in CI/CD or as a continuous monitoring layer in production. The output is designed to be machine-readable, making it suitable for automated alerting, dashboarding, and downstream retry or escalation logic.
Do not use this prompt when you need to generate answers, retrieve documents, or assess subjective qualities like tone, helpfulness, or style. It is also not a replacement for human review in high-stakes domains such as healthcare, legal, or finance—where factual errors carry regulatory or safety consequences. In those contexts, this prompt should feed a human review queue rather than serve as the final arbiter. For workflows requiring pairwise comparison of multiple outputs, use the Pairwise Groundedness Comparison Prompt instead. For sentence-level annotation suitable for training data curation, pair this with the Sentence-Level Grounding Verification Prompt to add granularity to your evaluation pipeline.
Use Case Fit
Where the Factual Consistency Check prompt delivers reliable value and where it introduces risk. Use these cards to decide if this prompt belongs in your evaluation pipeline or if you need a different approach.
Good Fit: RAG Answer Verification
Use when: you have a generated answer and the exact source documents provided to the model. The prompt excels at aligning claims to evidence when the context window is self-contained. Guardrail: Always pass the full, unmodified retrieved context—not a summary—to prevent the judge from hallucinating about what the source contains.
Bad Fit: Open-Domain Fact Checking
Avoid when: you expect the prompt to verify claims against the model's internal knowledge or the open web. Without provided source documents, the judge cannot reliably distinguish between a correct fact and a hallucination. Guardrail: Use a retrieval step to gather candidate evidence before invoking this prompt, or route to a human review queue for claims without a provided source.
Required Inputs
What you must provide: a complete generated answer and the full set of source documents from which it was derived. Missing or truncated sources will cause false positives in hallucination detection. Guardrail: Implement a pre-check that validates both input fields are non-empty and that source length matches retrieval logs before calling the judge.
Operational Risk: Judge Hallucination
What to watch: the LLM judge itself can hallucinate about what the source documents contain, especially when sources are long or dense. The judge may flag a claim as unsupported when the evidence is present but was overlooked. Guardrail: Run a spot-check where you manually verify a sample of flagged claims. If judge precision drops below your threshold, add a verification step or switch to a sentence-level grounding approach.
Latency and Cost Sensitivity
What to watch: processing long answers against multiple source documents consumes significant tokens and time. This prompt is not suitable for real-time guardrails in user-facing chat. Guardrail: Use this prompt in async evaluation pipelines, batch processing, or CI/CD gates. For synchronous use, set a strict timeout and fall back to a simpler pass/fail gate prompt.
Ambiguity Handling
What to watch: claims that are partially supported or rely on reasonable inference from the source can produce inconsistent scores across runs. The judge may flip between 'supported' and 'unsupported' for the same input. Guardrail: Define a clear policy for inference and implication in your prompt instructions. For high-stakes use cases, route ambiguous claims to human review rather than accepting a binary label.
Copy-Ready Prompt Template
A copy-paste ready prompt for evaluating the factual consistency of a generated answer against provided source documents.
This is the core prompt template for the Factual Consistency Check. It instructs the model to act as an evaluator, comparing a generated answer against a set of source documents. The prompt is designed to produce a structured JSON report, making it suitable for direct integration into an automated evaluation harness. Before using it, ensure you have a clear [ANSWER] to evaluate and a set of [SOURCE_DOCUMENTS] that should contain all the information needed to verify the answer.
textYou are a meticulous AI auditor. Your task is to evaluate the factual consistency of a [ANSWER] against the provided [SOURCE_DOCUMENTS]. For each distinct factual claim in the [ANSWER], determine its relationship to the [SOURCE_DOCUMENTS] and classify it into one of the following categories: - **SUPPORTED:** The claim is directly stated in or can be logically inferred from the sources. Cite the specific source passage(s). - **UNSUPPORTED:** The claim is not found in the sources. This is a potential hallucination. - **CONTRADICTED:** The claim directly conflicts with information in the sources. This is a critical error. # OUTPUT_SCHEMA Return your evaluation as a single JSON object with the following structure: { "overall_consistency_score": "HIGH" | "MEDIUM" | "LOW", "summary": "A one-sentence summary of the evaluation.", "claims": [ { "claim_text": "The exact factual claim from the answer.", "status": "SUPPORTED" | "UNSUPPORTED" | "CONTRADICTED", "source_reference": "Quote the supporting or contradicting text from [SOURCE_DOCUMENTS], or null if UNSUPPORTED.", "explanation": "A brief explanation of the reasoning for the classification." } ] } # CONSTRAINTS - Analyze every sentence in the [ANSWER] for factual claims. - If a claim is SUPPORTED, you MUST provide a direct quote from the [SOURCE_DOCUMENTS] as the `source_reference`. - If a claim is UNSUPPORTED, the `source_reference` field must be `null`. - Do not make judgments about the quality or style of the writing, only its factual consistency. # INPUTS <source_documents> [SOURCE_DOCUMENTS] </source_documents> <answer> [ANSWER] </answer>
To adapt this template, replace the [SOURCE_DOCUMENTS] and [ANSWER] placeholders with your data. For production systems, you can further constrain the [OUTPUT_SCHEMA] to match your application's data model exactly. If the source documents are long, consider pre-processing them to extract only the most relevant passages to fit within the model's context window. The overall_consistency_score provides a quick, high-level signal that can be used for pass/fail gating in a CI/CD pipeline, while the detailed claims array is invaluable for debugging and error analysis.
Prompt Variables
Required inputs for the Factual Consistency Check prompt. Each variable must be populated before the prompt is assembled and sent. Missing or malformed inputs are the most common cause of evaluation failure.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ANSWER] | The generated text to evaluate for factual consistency against source material | The Apollo 11 mission launched on July 16, 1969, and landed on the moon four days later. | Required. Must be non-empty string. Truncate if longer than model context window minus source length. Prefer sentence-level segmentation for downstream annotation. |
[SOURCE_DOCUMENTS] | One or more reference documents containing the ground-truth evidence | DOCUMENT 1: Apollo 11 launched on July 16, 1969, from Kennedy Space Center. The lunar module Eagle landed on July 20, 1969. | Required. Must contain at least one document. Each document must have a unique identifier. Empty or whitespace-only sources cause false hallucination flags. Validate document boundaries are clearly delimited. |
[DOCUMENT_IDS] | Unique identifiers for each source document, used in the output to trace claims to evidence | ["NASA-APOLLO-11-TIMELINE", "SMITHSONIAN-LUNAR-MODULE"] | Required if multiple documents provided. Must be a list matching the count and order of [SOURCE_DOCUMENTS]. Null allowed for single-document evaluation. Validate ID uniqueness. |
[EVALUATION_CRITERIA] | The definition of what constitutes supported, unsupported, and contradicted for this evaluation run | Supported: claim directly stated in source. Unsupported: claim not found in source. Contradicted: claim conflicts with source. | Required. Must define at least three categories. Use explicit boundary examples if evaluators disagree on edge cases. Validate that criteria are mutually exclusive. |
[SEVERITY_THRESHOLD] | The minimum hallucination severity level that triggers a failure flag in automated pipelines | CONTRADICTED | Optional. Accepts enum values: MINOR_IMPRECISION, UNSUPPORTED, CONTRADICTED, CRITICAL_FABRICATION. Defaults to UNSUPPORTED if not specified. Validate against allowed enum. Null means no automated gating. |
[OUTPUT_SCHEMA] | The expected structure for the consistency report, typically a JSON schema or field specification | {"claim": string, "grounding_status": enum, "source_evidence": string | null, "document_id": string | null, "severity": enum} | Required for structured output pipelines. Must be a valid JSON schema or field definition. Validate that schema includes grounding_status field. Schema mismatch with downstream parser is a common integration failure. |
[FEW_SHOT_EXAMPLES] | Calibrated examples showing correct grounding judgments for edge cases | Example: Claim 'The mission cost $25B' with source stating '$25.4B' should be marked MINOR_IMPRECISION not CONTRADICTED. | Optional but strongly recommended for production. Must include at least one supported, one unsupported, and one contradicted example. Validate examples match [EVALUATION_CRITERIA] definitions. Few-shot drift is a known failure mode when criteria change but examples don't. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score required before a grounding judgment is considered reliable enough for automated action | 0.85 | Optional. Float between 0.0 and 1.0. Judgments below threshold should route to human review. Null means all judgments proceed automatically. Validate range. Low thresholds combined with no human review create uncaught hallucination risk. |
Implementation Harness Notes
How to wire the factual consistency check into an application or evaluation pipeline with validation, retries, and human review gates.
The Factual Consistency Check prompt is designed to run as a post-generation evaluation step in a RAG pipeline or content verification workflow. It should be called after a primary model generates an answer, receiving both the generated text and the source documents as inputs. The prompt returns a structured JSON report classifying each claim as supported, unsupported, or contradicted, which your application can then use to decide whether to surface the answer, flag it for review, or trigger a regeneration loop. This prompt is not a real-time guardrail—it is an asynchronous evaluator that adds latency proportional to the length of the generated text and the number of source passages provided.
Wire the prompt into your application by placing it behind a validation layer that checks the output schema before downstream consumption. The expected output is a JSON object with a claims array, where each element contains claim_text, grounding_status (one of supported, unsupported, contradicted), source_passage_id, and rationale. Implement a schema validator using Pydantic, Zod, or JSON Schema that rejects responses missing required fields or containing invalid enum values. If validation fails, retry once with the same inputs and a stronger format instruction appended to the prompt. Log all validation failures and retry attempts for observability. For high-stakes domains like healthcare or legal review, route any output where grounding_status is contradicted or where more than 10% of claims are unsupported to a human review queue before the answer reaches the end user. Model choice matters: use a model with strong instruction-following and JSON output capabilities, such as GPT-4o, Claude 3.5 Sonnet, or equivalent. Avoid smaller models that may hallucinate the grounding assessment itself, defeating the purpose of the check.
For evaluation pipelines, batch this prompt across a golden dataset of known grounded and hallucinated answer pairs to measure precision and recall of hallucination detection. Store each run's output alongside the ground truth labels to compute metrics over time. If you are using this prompt in a CI/CD gate for prompt releases, set a minimum recall threshold for hallucination detection—typically 0.90 or higher—and block deployment if the threshold is not met. Avoid running this check on every single user query in production without caching or sampling; the token cost scales with both input length and output verbosity. Instead, sample a percentage of traffic for continuous monitoring and run full evaluations during pre-release testing. The next step after implementing this harness is to build a dashboard that tracks grounding scores over time, alerting on drift so you know when your generation model or retrieval pipeline needs attention.
Expected Output Contract
Structured output schema for the factual consistency check. Use this contract to validate the LLM response before downstream consumption.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
consistency_report | object | Top-level object must be present and parseable as valid JSON. | |
consistency_report.overall_score | string enum: fully_consistent, partially_consistent, inconsistent | Must match one of the three enum values exactly. Reject any other string. | |
consistency_report.claims | array of objects | Array must contain at least one claim object. Empty array is a failure signal for non-empty inputs. | |
consistency_report.claims[].claim_text | string | Must be a non-empty string extracted or paraphrased from the [GENERATED_ANSWER]. Null or whitespace-only strings are invalid. | |
consistency_report.claims[].verdict | string enum: supported, unsupported, contradicted | Must match one of the three enum values. Reject any other string. | |
consistency_report.claims[].source_evidence | string or null | If verdict is supported or contradicted, must contain a direct quote or paraphrase from [SOURCE_DOCUMENTS]. If unsupported, must be null. | |
consistency_report.claims[].confidence | number | Must be a float between 0.0 and 1.0 inclusive. Values outside this range trigger a schema validation failure. | |
consistency_report.claims[].reasoning | string | Must provide a non-empty explanation linking the claim, evidence, and verdict. Required for auditability. |
Common Failure Modes
Factual consistency checks fail in predictable ways. These are the most common production failure modes and the guardrails that catch them before they reach users.
False Negatives on Implicit Claims
What to watch: The judge marks a claim as unsupported because the source states it implicitly rather than verbatim. For example, 'The patient was afebrile' is marked unsupported when the source says 'Temperature: 98.6°F.' Guardrail: Include explicit examples of valid inference in your rubric. Add a calibration set with implicit claims scored by humans, and tune the prompt to distinguish between reasonable inference and fabrication.
Source-Answer Alignment Drift
What to watch: The judge compares claims against the wrong passage when multiple sources are provided, especially with similar content. A claim supported by Source B gets flagged as unsupported because the judge checks against Source A. Guardrail: Require the prompt to cite the specific source passage ID for each claim before scoring. Use a two-pass approach: first align claims to passages, then verify grounding within each aligned pair.
Overly Permissive Partial Match Scoring
What to watch: The judge marks a claim as 'supported' when only part of it is grounded. 'The system processes 10,000 requests per second with 99.9% uptime' gets a pass because the source mentions 10,000 RPS but says nothing about uptime. Guardrail: Decompose compound claims into atomic sub-claims before scoring. Add a 'partially supported' category with explicit criteria, and flag any claim containing both grounded and ungrounded elements for human review.
Numerical Precision Mismatch
What to watch: The judge accepts approximate matches as exact, or rejects valid rounding. 'Revenue grew 15%' is flagged when the source says '14.7% growth,' or 'approximately 15%' is accepted as matching a source that says 'exactly 15.3%.' Guardrail: Define tolerance bands explicitly in the prompt. Specify when rounding is acceptable and when exact values are required. For financial or clinical contexts, require exact matches and flag any deviation.
Temporal Context Collapse
What to watch: The judge ignores temporal qualifiers and marks claims as supported when the source data is stale. A claim about 'current quarterly revenue' is verified against last year's report without detecting the time mismatch. Guardrail: Require the prompt to extract and compare temporal metadata from both the claim and the source. Add explicit checks for date ranges, reporting periods, and freshness. Flag any claim where source timestamp exceeds a defined staleness threshold.
Negation and Polarity Reversal
What to watch: The judge misses negation and scores a contradicted claim as supported. 'The treatment did not reduce symptoms' is marked as consistent with a source stating 'the treatment reduced symptoms' because the judge skips the negation word. Guardrail: Add explicit negation-handling instructions to the prompt. Require the judge to identify and highlight polarity markers before comparing claims to sources. Include negation-heavy examples in few-shot demonstrations.
Evaluation Rubric
Use this rubric to test whether the Factual Consistency Check prompt produces reliable, repeatable judgments before deploying it in a production RAG or content verification pipeline. Each row targets a specific failure mode observed in groundedness evaluation.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Claim Extraction Completeness | All factual claims in [GENERATED_ANSWER] are extracted with no omissions and no invented claims. | Extracted claims list misses a verifiable factual statement present in the answer, or includes a claim not stated in the answer. | Run prompt on 20 golden answers with pre-annotated claim lists. Measure recall >= 0.95 and precision >= 0.95 against human annotations. |
Supported Claim Classification | Claims fully supported by [SOURCE_DOCUMENTS] are classified as 'supported' with a direct evidence citation. | A claim with clear verbatim or paraphrase support in sources is marked 'unsupported' or 'contradicted'. | Test on 30 claims pre-labeled as supported by human reviewers. Require accuracy >= 0.90 and every supported classification includes a valid citation string. |
Unsupported Claim Detection | Claims with no supporting evidence in [SOURCE_DOCUMENTS] are classified as 'unsupported' with no hallucinated citation. | An unsupported claim receives a fabricated citation, or is incorrectly marked 'supported' with irrelevant evidence. | Test on 30 claims pre-labeled as unsupported. Require unsupported classification rate >= 0.90 and zero fabricated citations in the evidence field. |
Contradiction Identification | Claims directly contradicted by [SOURCE_DOCUMENTS] are classified as 'contradicted' with the conflicting evidence cited. | A contradicted claim is marked 'supported' or 'unsupported' instead of 'contradicted', or the conflicting passage is not identified. | Test on 20 claim-evidence pairs where the source explicitly contradicts the claim. Require contradiction detection accuracy >= 0.85. |
Citation Format Validity | Every citation in the output references a real passage in [SOURCE_DOCUMENTS] using the specified [CITATION_FORMAT]. | Citation string does not match any source passage, uses wrong format, or is missing for a supported/contradicted claim. | Parse all citations from 50 outputs. Verify each citation string exists in source documents via exact or fuzzy match. Require 100% citation validity. |
Confidence Score Calibration | Confidence scores correlate with verification difficulty: ambiguous claims receive lower confidence than clear matches. | Confidence scores are uniformly high regardless of evidence quality, or low-confidence claims lack explanation of uncertainty. | Compare confidence scores against human-rated difficulty on 40 claims. Require Spearman correlation >= 0.7 between model confidence and human difficulty ratings. |
Output Schema Compliance | Every output strictly matches [OUTPUT_SCHEMA] with all required fields present and correctly typed. | Missing required fields, wrong types, extra fields, or malformed JSON that fails schema validation. | Validate 100 outputs against [OUTPUT_SCHEMA] using a JSON schema validator. Require 100% schema compliance rate. |
Abstention on Unverifiable Input | When [GENERATED_ANSWER] contains no factual claims or [SOURCE_DOCUMENTS] is empty, the output indicates inability to assess rather than hallucinating results. | Empty or non-factual input produces fabricated claims, confidence scores, or spurious classifications. | Test with 10 empty-source and 10 non-factual-answer inputs. Require appropriate abstention message and zero fabricated claims in all cases. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single source document and a short generated answer. Drop the strict JSON output requirement initially and ask for a plain-text structured report. Focus on getting the claim extraction and support classification logic right before adding schema enforcement.
Watch for
- The model merging "supported" and "partially supported" into one category
- Overly broad claim extraction that treats opinions as factual claims
- Missing contradiction detection when the answer inverts source meaning

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us