This prompt is designed for factuality teams and RAG system builders who need to decompose a model's generated text into a set of discrete, auditable factual claims. The core job-to-be-done is post-generation verification: you have a block of output from an LLM, and before it reaches a user, a database, or a downstream system, you must know exactly which statements are supported by your source material and which are unsupported. The ideal user is an engineer or ML operator building a production pipeline where hallucination detection is a hard requirement, not a nice-to-have. You should use this prompt when you have a clear source context (retrieved chunks, a source document, or a verified knowledge base) and you need a structured, machine-readable report that pairs each extracted claim with its grounding status.
Prompt
Factual Claim Extraction and Hallucination Flagging Prompt

When to Use This Prompt
Define the job-to-be-done, the ideal user, and the hard constraints that determine when this prompt is the right tool and when it will fail.
Do not use this prompt when you lack a defined source of truth. If you cannot provide a [SOURCE_CONTEXT] that contains the evidence against which claims will be checked, the prompt will either flag everything as ungrounded or hallucinate its own grounding assessments. This prompt is also not a substitute for a human fact-checker in high-stakes domains like healthcare, legal, or finance; its output is a structured artifact for review, not a final verdict. It is a poor fit for creative or subjective text where 'factuality' is ill-defined, such as marketing copy, brainstorming sessions, or narrative fiction. Finally, avoid this prompt if your primary goal is to fix the output; this prompt extracts and flags claims. Use a separate repair prompt from the Output Repair and Validation pillar to strip or correct the flagged content.
The output of this prompt is a JSON array of claim objects, each containing the claim text, a grounding status, and the matched source excerpt. This structure is designed to be consumed by an automated evaluation harness. You should wire this prompt into a pipeline that logs the grounding report, routes ungrounded claims for human review if they exceed a risk threshold, and blocks fully ungrounded outputs from being published. The next step after reading this section is to copy the prompt template, adapt the [SOURCE_CONTEXT] and [RISK_LEVEL] placeholders to your domain, and integrate it with a validation step that checks for false negatives—claims the model failed to extract at all.
Use Case Fit
Where this prompt works and where it does not. Factual claim extraction and hallucination flagging is a high-precision audit workflow, not a general-purpose fact-checker. It requires structured input, a defined source of truth, and a clear downstream action for flagged claims.
Good Fit: RAG Output Auditing
Use when: you have a generated response and the exact set of retrieved context chunks that were provided to the model. The prompt excels at mapping each claim back to a source or flagging it as unsupported. Guardrail: always pass the complete, unmodified retrieved context alongside the output. Partial context guarantees false positives.
Good Fit: Pre-Publication Review
Use when: a human editor needs a structured diff of what is supported versus what the model invented before content goes live. The prompt produces an auditable report rather than silently modifying text. Guardrail: integrate the output into a review UI that highlights flagged claims inline, not a fully automated removal pipeline.
Bad Fit: Open-Domain Fact Checking
Avoid when: you expect the model to verify claims against its own training data or general world knowledge. This prompt only compares claims against provided source material. Guardrail: if external verification is needed, route to a separate web-search or knowledge-base retrieval step before invoking this prompt.
Bad Fit: Real-Time Streaming Output
Avoid when: you need to flag hallucinations on partial, in-progress tokens during streaming generation. This prompt requires a complete output to extract and evaluate discrete claims. Guardrail: buffer the full response before running extraction, or use a separate span-level confidence estimator for streaming guardrails.
Required Inputs
Risk: running the prompt without the source document or retrieved context produces meaningless results. The model cannot audit its own output against nothing. Guardrail: make the source context a required field in your API harness. Reject requests that omit it. Include metadata about which source each chunk came from for multi-document audits.
Operational Risk: False Negatives
Risk: the prompt may fail to extract a claim entirely, meaning a hallucinated statement passes through unflagged. This is especially dangerous for subtle fabrications like invented dates or slightly altered statistics. Guardrail: implement a recall-oriented eval that measures how many known fabricated claims the prompt catches. Pair with a secondary, simpler keyword-based check for high-risk fields like numbers and dates.
Copy-Ready Prompt Template
A reusable prompt template for extracting factual claims from model output and flagging which claims are supported by source evidence versus hallucinated.
This prompt template is designed to be dropped into a post-generation validation step in your RAG pipeline or content generation system. It takes the model's raw output and the source context that was provided to the model, extracts every discrete factual assertion, and pairs each with a grounding status. The template uses square-bracket placeholders that you replace with your actual inputs, schemas, and constraints before sending it to the model. Copy the block below and adapt the placeholders to match your application's data model and risk tolerance.
textYou are a factuality auditor. Your task is to extract every discrete factual claim from the provided model output and determine whether each claim is supported by the provided source context. ## INPUT ### MODEL OUTPUT [OUTPUT_TEXT] ### SOURCE CONTEXT [SOURCE_CONTEXT] ## INSTRUCTIONS 1. Extract every discrete factual assertion from the MODEL OUTPUT. A factual assertion is any statement that could be true or false, including: - Claims about events, dates, people, organizations, or locations - Quantitative claims, statistics, or measurements - Statements about relationships, causes, or effects - Attributions to specific sources or authorities 2. For each extracted claim, determine its grounding status by comparing it against the SOURCE CONTEXT: - **GROUNDED**: The claim is directly supported by explicit evidence in the source context. - **PARTIALLY_GROUNDED**: Some but not all elements of the claim are supported by the source context. - **UNGROUNDED**: The claim cannot be verified from the source context. This includes claims that may be true but lack supporting evidence. - **CONTRADICTED**: The claim directly conflicts with evidence in the source context. 3. For GROUNDED and PARTIALLY_GROUNDED claims, include the exact source text that supports the claim. 4. For UNGROUNDED claims, indicate whether the claim appears plausible but unverifiable or likely fabricated. 5. Do not evaluate the truth of claims against your own knowledge. Only compare against the provided SOURCE CONTEXT. ## OUTPUT SCHEMA Return a JSON object with this exact structure: { "claims": [ { "claim_id": "string (unique identifier, e.g., C1, C2)", "claim_text": "string (the exact factual assertion from the output)", "grounding_status": "GROUNDED | PARTIALLY_GROUNDED | UNGROUNDED | CONTRADICTED", "source_evidence": "string or null (exact quote from source context that supports the claim)", "fabrication_likelihood": "string or null (for UNGROUNDED claims: LIKELY_FABRICATED | PLAUSIBLE_UNVERIFIABLE | UNKNOWN)", "notes": "string or null (brief explanation of the grounding determination)" } ], "summary": { "total_claims": "number", "grounded_count": "number", "partially_grounded_count": "number", "ungrounded_count": "number", "contradicted_count": "number", "overall_reliability": "HIGH | MEDIUM | LOW | CRITICAL" } } ## CONSTRAINTS - Extract ALL factual claims. Do not skip claims that seem minor or obvious. - Do not treat opinions, recommendations, or speculative language as factual claims unless they assert something verifiable. - If the MODEL OUTPUT contains no factual claims, return an empty claims array with appropriate summary counts. - If the SOURCE CONTEXT is empty or missing, mark all claims as UNGROUNDED with fabrication_likelihood set to UNKNOWN. - Preserve the exact wording of claims from the MODEL OUTPUT. Do not paraphrase. - [ADDITIONAL_CONSTRAINTS] ## RISK LEVEL [RISK_LEVEL]
Adapting the template: Replace [OUTPUT_TEXT] with the model-generated content you need to audit. Replace [SOURCE_CONTEXT] with the retrieved documents, source text, or context chunks that were provided to the generating model. Use [ADDITIONAL_CONSTRAINTS] to add domain-specific rules—for example, in healthcare you might add 'Flag any claim involving a diagnosis, medication, or procedure for mandatory human review regardless of grounding status.' Set [RISK_LEVEL] to HIGH for regulated domains where false negatives are unacceptable, which should trigger stricter grounding requirements and mandatory human review of UNGROUNDED claims. For lower-risk applications, you can relax the fabrication_likelihood field or simplify the output schema. Before deploying, run this prompt against a golden dataset of known grounded and hallucinated outputs to calibrate your grounding thresholds and measure false negative rates.
Prompt Variables
Required inputs for the Factual Claim Extraction and Hallucination Flagging Prompt. Each variable must be populated before the prompt is assembled and sent. Missing or malformed inputs are the most common cause of false negatives in hallucination detection.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[MODEL_OUTPUT] | The complete text generated by the model that needs to be audited for factual claims and potential hallucinations. | The new policy reduces latency by 40% and was announced by CTO Jane Smith at the 2024 summit. | Must be a non-empty string. Truncated outputs should be flagged upstream before extraction. Validate length > 0. |
[SOURCE_CONTEXT] | The ground-truth evidence provided to the model during generation. This is the retrieval result, document, or input data the model was supposed to use. | Policy 2024-03: Latency improvements of 35-42% expected after deployment. Announced internally on 2024-01-15. | Must be a non-empty string. If multiple sources were used, concatenate with source markers. Null or empty context makes all claims unverifiable. |
[SOURCE_METADATA] | Optional structured metadata about each source document, including document ID, title, date, and retrieval score. Used to enrich the attribution matrix. | {"doc_id": "POL-2024-03", "title": "Q1 Latency Policy", "date": "2024-01-15", "score": 0.92} | Must be valid JSON if provided. Null allowed. If present, each source referenced in [SOURCE_CONTEXT] should have a corresponding metadata entry. |
[EXTRACTION_GRANULARITY] | Controls whether the prompt extracts sentence-level claims, clause-level claims, or atomic fact triples. Affects output verbosity and downstream processing cost. | atomic | Must be one of: sentence, clause, atomic. Default to atomic for highest precision. Sentence-level extraction will miss compound claims within a single sentence. |
[CONFIDENCE_THRESHOLD] | The minimum confidence score a claim must have to be classified as grounded. Claims below this threshold are flagged for human review. | 0.7 | Must be a float between 0.0 and 1.0. Values below 0.5 produce high false-positive rates. Values above 0.9 produce high false-negative rates. Recommend 0.7 as starting default. |
[OUTPUT_SCHEMA] | The expected JSON schema for the extraction output. Defines the structure for claims, grounding status, source mapping, and flags. | {"claims": [{"claim_text": "...", "grounding_status": "...", "source_ref": "...", "confidence": 0.0}]} | Must be valid JSON Schema or a plain-text description of expected fields. If null, the prompt uses its default schema. Schema mismatch between this variable and the prompt's internal instructions causes parse failures. |
[ALLOW_PARTIAL_MATCH] | Boolean flag controlling whether claims that partially match source evidence are classified as grounded or flagged for review. | Must be true or false. When true, partial matches are marked grounded with a partial_match flag. When false, partial matches are marked ungrounded. False is safer for regulated use cases. | |
[MAX_CLAIMS] | Upper bound on the number of claims extracted. Prevents runaway extraction on very long model outputs and controls token cost. | 50 | Must be a positive integer. If the model output contains more claims than this limit, the prompt should prioritize high-confidence extractions and note truncation. Set to null for no limit, but monitor token usage. |
Implementation Harness Notes
How to wire the Factual Claim Extraction and Hallucination Flagging Prompt into a production application with validation, retries, logging, and human review gates.
This prompt is designed to operate as a post-generation validation step in a RAG pipeline or content generation workflow. It should be called after the primary model produces its output, receiving both the generated text and the source context that was provided to the generation step. The harness must supply both [INPUT_TEXT] (the model's output to audit) and [SOURCE_CONTEXT] (the retrieved chunks, documents, or evidence the model was instructed to use). Without both inputs, the extraction prompt cannot perform grounding verification and will produce unreliable results.
Wire the prompt into an asynchronous validation queue rather than blocking the primary response path. After the generation step completes, publish the output and source context to a validation worker that calls this prompt. Configure the worker with a strict JSON schema validator that enforces the expected output structure: an array of claim objects, each containing claim_text, source_reference, grounding_status (one of grounded, partially_grounded, ungrounded), and evidence_excerpt. Reject and retry any response that fails schema validation. Use a maximum of two retry attempts with exponential backoff before escalating to a human review queue. Log every validation run with the prompt version, model used, input lengths, claim count, and grounding status distribution for observability.
For high-risk domains such as healthcare, legal, or financial applications, add a mandatory human review gate for any output where the proportion of ungrounded claims exceeds 5% or where any single claim is flagged as ungrounded with high confidence. Route these cases to a review interface that displays the original output, the extracted claims, and the source context side by side. Do not automatically strip or modify the output based on this prompt's results in regulated workflows—always require human confirmation before the content reaches users or databases. For lower-risk applications, you may configure an automated policy to remove ungrounded claims and regenerate the affected sections, but always log the original output and the removal decisions for auditability.
Expected Output Contract
Defines the exact JSON structure, field types, and validation rules for the factual claim extraction and hallucination flagging prompt output. Use this contract to build a downstream parser, validator, or database loader.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
claims | Array of objects | Must be a JSON array. If no factual claims are found, return an empty array. Reject if missing or not an array. | |
claims[].claim_id | String | Must match pattern | |
claims[].statement | String | Must be a complete, self-contained factual assertion. Minimum 10 characters. Must not be a question, opinion marker, or instruction. Reject empty or null. | |
claims[].source_grounding | Enum: | Must be one of the three allowed enum values. | |
claims[].evidence | Array of objects | Must be an array. If | |
claims[].evidence[].source_id | String | Must match a | |
claims[].evidence[].quote | String | Must be a verbatim substring from the source text associated with | |
claims[].confidence | Number (0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. |
Common Failure Modes
Factual claim extraction and hallucination flagging fails in predictable ways. These are the most common production failure modes and the guardrails that catch them before they reach users or databases.
False Negatives: Missed Hallucinations
What to watch: The prompt fails to flag a fabricated claim because the model confuses plausibility with grounding. This is especially common with domain-specific assertions that sound authoritative but lack source support. Guardrail: Pair the extraction prompt with a secondary verification step that requires explicit source quotation for every claim. Run spot-checks on a golden dataset of known hallucinations to calibrate sensitivity.
False Positives: Grounded Claims Flagged as Hallucinated
What to watch: The prompt over-flags legitimate claims as unsupported because it applies overly strict matching between claim text and source text. Paraphrased or inferred-but-reasonable statements get caught in the net. Guardrail: Implement a confidence threshold that distinguishes exact-match grounding from semantic-match grounding. Route borderline cases to human review rather than auto-stripping them.
Claim Fragmentation and Incomplete Extraction
What to watch: The prompt extracts atomic claims but misses compound assertions, splitting a single factual statement into fragments that lose context or merging distinct claims into one unverifiable blob. Guardrail: Define a claim schema with explicit boundaries—one verifiable proposition per claim. Add an eval check that counts extracted claims against expected claim density for the output length.
Source-Attribution Drift Across Multi-Document Contexts
What to watch: When multiple source documents are provided, the prompt misattributes a claim to the wrong source or flags it as hallucinated because it checked against the wrong document. Guardrail: Require the prompt to output a source-document identifier alongside each claim's grounding status. Validate attribution accuracy with a spot-check that confirms the quoted evidence actually appears in the cited document.
Temporal and Numeric Grounding Failures
What to watch: Dates, statistics, and numeric values are the most frequently hallucinated data types, yet the prompt treats them with the same grounding rigor as qualitative claims. A fabricated revenue figure passes because the model doesn't apply numeric-specific verification. Guardrail: Add a dedicated numeric-claim verification path that requires exact value matching against source data. Flag any numeric claim where the source value differs by any amount, not just by order of magnitude.
Prompt Drift Under Long or Complex Source Material
What to watch: As source documents grow longer or more technical, the prompt's extraction discipline degrades. The model starts summarizing instead of extracting discrete claims, or it skips claims buried in dense paragraphs. Guardrail: Chunk long source material before extraction and run the prompt per-chunk. Merge claim lists with deduplication logic. Monitor claim extraction completeness with a recall metric against human-annotated reference extractions.
Evaluation Rubric
Use this rubric to test the Factual Claim Extraction and Hallucination Flagging Prompt before shipping. Each criterion targets a specific failure mode in production factuality pipelines.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Claim Completeness | Every discrete factual assertion in [INPUT_TEXT] appears in the extracted claims list | A verifiable fact from the input is missing from the output claims array | Diff the input text against extracted claims using a human-annotated golden set of 20 assertions |
Source Grounding Accuracy | Every claim in the output has a grounding_status of grounded, ungrounded, or partially_grounded that matches human judgment | A claim marked grounded has no supporting evidence in [SOURCE_CONTEXT] or a claim marked ungrounded has clear source support | Spot-check 50 random claims against source context; require >=95% agreement with human labelers |
Hallucination Flag Precision | All claims flagged as hallucinated are genuinely unsupported by [SOURCE_CONTEXT] | A claim is flagged hallucinated but the source context contains verbatim or paraphrased support | Review all hallucinated-flagged claims manually; false positive rate must be <5% |
Hallucination Flag Recall | All genuinely unsupported claims receive a hallucination flag | A claim invented by the model appears with grounding_status: grounded or no hallucination flag | Insert 10 known fabricated claims into test input; verify all 10 are flagged |
Evidence Citation Format | Every grounded claim includes a source_quote field with verbatim text from [SOURCE_CONTEXT] and a source_location field | A grounded claim has null, empty, or paraphrased source_quote instead of verbatim source text | Validate source_quote strings exist in [SOURCE_CONTEXT] via exact substring match; fail if any quote is absent |
Confidence Score Calibration | Confidence scores correlate with actual verifiability: grounded claims score >=0.8, ungrounded claims score <=0.4 | A hallucinated claim receives confidence >=0.7 or a well-sourced claim receives confidence <=0.3 | Bin claims by grounding_status and check mean confidence per bin against thresholds |
Output Schema Validity | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed | Output is missing required fields, contains extra fields, or has type mismatches (e.g., string where array expected) | Validate output against JSON Schema; fail on any schema violation |
Null Handling for Missing Evidence | Claims with no source support have source_quote: null and source_location: null rather than hallucinated citations | An ungrounded claim contains a fabricated source_quote or a non-null source_location | Filter for ungrounded claims; assert source_quote is null and source_location is null for all |
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 frontier model call. Skip structured output enforcement and accept markdown or plain-text claim lists. Focus on whether the model can separate factual assertions from opinion and commentary.
Simplify the output schema to a flat list:
codeFor each claim return: - claim_text - grounding_status: [GROUNDED | UNGROUNDED | PARTIAL] - source_quote (if grounded)
Watch for
- The model merging multiple claims into one bullet
- False negatives where real claims are missed because they're embedded in longer sentences
- Over-flagging of hedging language as ungrounded when the source supports the hedge

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