This prompt is designed for RAG and generation quality teams who need to systematically identify unsupported claims in model outputs before they reach end users. The primary job-to-be-done is automated hallucination detection: given a piece of generated text and its source evidence, the prompt flags specific segments that contain claims not grounded in the provided context. The ideal user is an AI engineer or quality lead building a production guardrail, not an end user casually checking a single response. You need the original generated output, the exact retrieval context or source documents used, and a predefined risk level taxonomy before you can use this prompt effectively.
Prompt
Hallucination Risk Flagging Prompt

When to Use This Prompt
Define the job, the user, and the operational constraints for the Hallucination Risk Flagging Prompt.
Do not use this prompt when you lack access to the grounding evidence. It cannot detect hallucinations from the generated text alone—it requires source documents to compare against. It is also not a replacement for human review in high-stakes domains like healthcare or legal compliance, where unsupported claims carry regulatory risk. The prompt works best as a filter in an automated pipeline where flagged outputs are routed for human review or blocked entirely. It is not designed for real-time chat correction, creative writing evaluation, or fact-checking against world knowledge the model may possess outside the provided context.
Before deploying, define your risk level taxonomy clearly. A three-tier system such as GROUNDED, UNCERTAIN, and HALLUCINATION is common, but you may need finer gradations like PARTIALLY_SUPPORTED or CONTRADICTED. The prompt's value comes from consistent, constrained output that downstream systems can act on without parsing ambiguity. Pair this prompt with a validation layer that rejects any risk label outside your approved vocabulary. Start with a golden test set of known grounded and hallucinated examples to calibrate your thresholds before production use.
Use Case Fit
Where the Hallucination Risk Flagging Prompt delivers reliable results and where it introduces operational risk. Use these cards to decide if this prompt fits your pipeline before you integrate it.
Strong Fit: RAG Answer Validation
Use when: you need to flag unsupported claims in a generated answer against a provided set of retrieved documents. Guardrail: Always pass the exact source chunks used for generation as the grounding evidence. Do not rely on the model's parametric knowledge to verify itself.
Poor Fit: Open-Domain Fact-Checking
Avoid when: the prompt must verify claims against the entire internet or an unspecified knowledge base. Risk: The model will hallucinate sources or mark true statements as unsupported. Guardrail: Pair this prompt with a retrieval step. Never use it as a standalone fact-checker without explicit evidence.
Required Input: Grounding Evidence
What to watch: The prompt fails silently if the [GROUNDING_EVIDENCE] placeholder is empty or contains irrelevant text. Guardrail: Implement a pre-flight check that rejects empty evidence arrays and logs a warning if the evidence is shorter than the generated claim it is supposed to verify.
Operational Risk: False Negatives on Paraphrases
What to watch: The model may flag a factually correct paraphrase as a hallucination if the wording differs significantly from the source. Guardrail: Add a few-shot example demonstrating that semantic equivalence counts as supported. Monitor the unsupported rate during A/B tests to detect drift.
Operational Risk: Over-Confidence on Ambiguity
What to watch: The model may assign a low risk score to a claim that is only partially supported by the evidence. Guardrail: Require the output schema to include a rationale field. If the rationale is empty or circular, escalate the claim for human review.
Integration Pattern: Pre-Commit Hook
Use when: you need to block a generated response from reaching the user if it contains high-risk hallucinations. Guardrail: Run this prompt as a synchronous check before the final output is committed. If the risk_level is high, discard the response and trigger a retry or fallback message.
Copy-Ready Prompt Template
A reusable prompt template for flagging hallucination risks in generated text against provided grounding evidence.
The following prompt template is designed to be copied directly into your prompt management system or codebase. It instructs the model to act as a strict hallucination auditor, comparing a generated output segment against a set of source documents. The model is forced to choose from a constrained vocabulary of risk levels, ensuring that downstream automation can reliably parse and act on the result without encountering unexpected labels.
textYou are a strict hallucination auditor. Your task is to compare a generated [OUTPUT_SEGMENT] against the provided [GROUNDING_EVIDENCE] and assign a hallucination risk level. You must classify the output into exactly one of the following risk levels: - NO_RISK: All claims in the output are directly and unambiguously supported by the evidence. - LOW_RISK: The output contains minor paraphrasing or summarization that does not alter the factual meaning. - HIGH_RISK: The output contains a claim, entity, date, or figure that is not present in the evidence or directly contradicts it. - UNVERIFIABLE: The output makes a claim that cannot be confirmed or denied using the provided evidence alone. [GROUNDING_EVIDENCE]: """ [EVIDENCE_TEXT] """ [OUTPUT_SEGMENT]: """ [SEGMENT_TEXT] """ [CONSTRAINTS]: - If the output is a direct quote from the evidence, it is NO_RISK. - If the output synthesizes multiple pieces of evidence correctly, it is NO_RISK. - If the output adds a plausible but unsupported detail (e.g., a date or name), it is HIGH_RISK. - Do not use external knowledge. Base your decision strictly on the [GROUNDING_EVIDENCE] provided. Return a single JSON object with the following keys: - "risk_level": string (one of NO_RISK, LOW_RISK, HIGH_RISK, UNVERIFIABLE) - "rationale": string (a brief, specific explanation citing the evidence or noting its absence) - "flagged_span": string (the exact substring from the [OUTPUT_SEGMENT] that triggered the risk level, or null if NO_RISK)
To adapt this template, replace the [EVIDENCE_TEXT] and [SEGMENT_TEXT] placeholders with your actual data. For production use, ensure that the [OUTPUT_SCHEMA] is enforced by your application's parsing layer, not just by the prompt. If the model returns a risk_level outside the constrained set, the response should be rejected and retried. In high-stakes domains like healthcare or finance, a HIGH_RISK or UNVERIFIABLE flag must trigger a human review step before the output reaches an end user. Start by testing this prompt against a golden dataset of known hallucinations and factual statements to calibrate your tolerance for false positives and false negatives.
Prompt Variables
Required and optional inputs for the Hallucination Risk Flagging Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[GENERATED_TEXT] | The full model output that needs to be audited for hallucination risk. | The product launch was delayed due to a supplier issue in Q3. | Required. Must be a non-empty string. Truncate if longer than the model's context window minus other inputs. |
[GROUNDING_EVIDENCE] | The source material or retrieved context the generated text should be based on. | Supplier report dated 2024-08-15: 'Shipment X delayed by 2 weeks.' | Required. Must be a non-empty string. If no evidence exists, set to 'NO_EVIDENCE_PROVIDED' and expect high-risk flags. |
[RISK_LEVELS] | A constrained list of risk levels the model must choose from. | ["VERIFIED", "UNCERTAIN", "CONTRADICTED", "UNSUPPORTED"] | Required. Must be a valid JSON array of strings. Do not include more than 5 levels to maintain classification reliability. |
[OUTPUT_SCHEMA] | The exact JSON schema the model must use to return its findings. | { "type": "object", "properties": { "segments": { "type": "array", "items": { "type": "object", "properties": { "text": {"type": "string"}, "risk": {"type": "string", "enum": ["VERIFIED", "UNCERTAIN", "CONTRADICTED", "UNSUPPORTED"]}, "evidence_ref": {"type": "string"} }, "required": ["text", "risk", "evidence_ref"] } } }, "required": ["segments"] } | Required. Must be a valid JSON Schema object. Validate with a schema parser before prompt assembly. The 'risk' enum must match [RISK_LEVELS]. |
[SEGMENTATION_STRATEGY] | Instruction for how to split the generated text into auditable segments. | sentence | Optional. Defaults to 'sentence'. Accepted values: 'sentence', 'paragraph', 'claim'. Invalid values will cause unpredictable segmentation. |
[ABSTENTION_RULES] | Rules for when the model should refuse to classify a segment. | If evidence is ambiguous, mark as UNCERTAIN. If no evidence exists, mark as UNSUPPORTED. | Optional. If null, the model may guess. Provide explicit rules to control abstention behavior and reduce false positives. |
Implementation Harness Notes
How to wire the Hallucination Risk Flagging Prompt into a production RAG or generation quality pipeline.
This prompt is designed to sit directly after a generation step in a RAG or content-creation pipeline. Its job is to receive a piece of generated text and its corresponding grounding evidence, then return a structured risk assessment. The implementation harness must guarantee that the evidence passed to the prompt is the exact set of documents or context chunks used during generation, not a post-hoc retrieval. Any mismatch between the generation context and the verification context will produce unreliable risk scores.
The harness should enforce a strict contract: the model's output must be a valid JSON object matching the defined schema, including the risk_level enum (LOW, MEDIUM, HIGH, CRITICAL) and a list of flagged_segments. Implement a validation layer that rejects any response that doesn't parse as JSON or contains an out-of-vocabulary risk_level. For CRITICAL or HIGH risk outputs, the harness should automatically route the content to a human review queue and block it from being served to an end-user. For MEDIUM risk, log the output and the flagged segments for offline audit without blocking the pipeline. Use a model with strong instruction-following and JSON mode capabilities (such as gpt-4o or claude-3.5-sonnet) and set temperature=0 to maximize deterministic, repeatable evaluations.
To prevent silent failures, build an evaluation harness that runs this prompt against a golden dataset of generated statements paired with evidence. The dataset must include clear-cut factual statements (expecting LOW risk), statements with minor inferred details (expecting MEDIUM), and completely unsupported claims (expecting HIGH or CRITICAL). Track false negatives—where an unsupported claim is marked LOW—as a critical product metric. A common failure mode is the model accepting a plausible-sounding but unsupported statement as factual because it aligns with the model's own pre-training knowledge. Mitigate this by explicitly instructing the model to only consider the provided evidence, and run regular adversarial tests with statements that are true in the world but absent from the provided context.
For high-throughput systems, consider batching multiple statement-evidence pairs into a single prompt call to reduce API overhead, but be aware that longer contexts can degrade the model's attention to each individual pair. Implement a retry layer with exponential backoff for API failures, but do not retry on validation failures—a malformed output should be logged as an error and escalated immediately. Finally, store every risk assessment alongside the generation ID, evidence hash, and model version to create an audit trail that supports debugging, compliance reviews, and prompt regression testing over time.
Common Failure Modes
Hallucination risk flagging fails in predictable ways. These are the most common production failure modes and the guardrails that catch them before they reach downstream systems.
False Positives on Factual Statements
What to watch: The prompt flags well-grounded, source-supported statements as high risk because the model overcorrects for uncertainty. This erodes trust and creates noisy alerts. Guardrail: Calibrate against a golden dataset of known-factual claims. Require explicit evidence absence before flagging, not just low confidence. Add a 'likely grounded' tier between 'confirmed' and 'unsupported.'
False Negatives on Fabricated Details
What to watch: The model assigns low risk to fluent, plausible-sounding claims that have no grounding in the provided evidence. This is the classic hallucination that slips through because the prose reads well. Guardrail: Require explicit citation mapping for every factual claim before risk assessment. If a claim cannot be mapped to a specific source span, default to high risk regardless of fluency.
Risk Level Drift Across Long Outputs
What to watch: Early output segments receive accurate risk labels, but later segments drift toward overly permissive or overly conservative ratings as the model loses context coherence. Guardrail: Chunk long outputs and assess risk per segment independently. Use a consistent risk rubric at each assessment point. Log risk distribution across segments to detect drift patterns.
Enum Leakage and Out-of-Vocabulary Risk Labels
What to watch: The model invents risk labels outside the constrained vocabulary, such as 'maybe risky' or 'needs review' instead of the predefined tier names. This breaks downstream routing logic. Guardrail: Validate every risk label against the allowed enum set. Reject and retry any output containing out-of-vocabulary labels. Use strict schema enforcement, not loose guidance.
Context Boundary Confusion
What to watch: The model treats its own generated content as grounding evidence, creating circular validation where hallucinations self-justify. This is especially dangerous in multi-turn or agentic workflows. Guardrail: Strictly separate evidence context from generated content in the prompt structure. Label source material explicitly. Instruct the model to only reference provided evidence spans, never its own prior outputs.
Over-Flagging of Low-Stakes Content
What to watch: The prompt flags minor stylistic choices, paraphrasing variations, or widely-known facts as risks, creating alert fatigue that causes teams to ignore real hallucinations. Guardrail: Define a materiality threshold. Only flag claims that would change decisions, violate policy, or mislead users if incorrect. Test against a set of intentionally low-stakes variations to measure false flag rate.
Evaluation Rubric
Use this rubric to test the Hallucination Risk Flagging Prompt before production deployment. Each criterion targets a known failure mode. Run these tests against a golden dataset of grounded and ungrounded claims.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Grounded Claim Flagging | All claims with direct [SOURCE_TEXT] evidence are flagged as NO_RISK or LOW_RISK | Factual, cited statements are incorrectly flagged as HIGH_RISK or CRITICAL (false positive) | Run prompt on 20 grounded claims; assert risk_level is never HIGH_RISK or CRITICAL |
Unsupported Claim Detection | All claims not present in [SOURCE_TEXT] are flagged as HIGH_RISK or CRITICAL | Fabricated or unsupported claims receive NO_RISK or LOW_RISK (false negative) | Run prompt on 20 unsupported claims; assert risk_level is always HIGH_RISK or CRITICAL |
Partial Evidence Handling | Claims partially supported by [SOURCE_TEXT] are flagged as MEDIUM_RISK or HIGH_RISK with specific missing evidence noted in risk_reason | Partially supported claims are flagged as NO_RISK or the risk_reason field is empty or generic | Run prompt on 15 partially supported claims; assert risk_level is MEDIUM_RISK or higher and risk_reason is non-empty and specific |
Risk Reason Specificity | risk_reason field cites the specific unsupported segment, not a generic statement | risk_reason contains vague language like 'some claims are unsupported' without quoting the segment | Parse risk_reason field; assert it contains a direct quote or reference to the unsupported text segment |
Output Schema Compliance | Output is valid JSON matching [OUTPUT_SCHEMA] with all required fields present and risk_level in [NO_RISK, LOW_RISK, MEDIUM_RISK, HIGH_RISK, CRITICAL] | Output is missing required fields, risk_level is not in the enum, or JSON is malformed | Validate output against [OUTPUT_SCHEMA] using a JSON Schema validator; assert no validation errors |
Abstention on Ambiguous Input | When [SOURCE_TEXT] is insufficient to verify any claims, risk_level is CRITICAL and risk_reason indicates insufficient evidence | Prompt hallucinates a risk assessment or assigns LOW_RISK when no evidence exists | Run prompt with empty or irrelevant [SOURCE_TEXT]; assert risk_level is CRITICAL and risk_reason mentions insufficient evidence |
Multi-Claim Segmentation | Each independent claim in [INPUT] receives its own risk assessment in the flagged_segments array | Multiple claims are merged into a single assessment or some claims are silently dropped | Input 5 distinct claims; assert flagged_segments array length equals 5 and each segment has a unique risk_level and risk_reason |
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
Start with the base prompt and a small set of risk labels. Use [RISK_LEVELS] as a simple array like ["LOW", "MEDIUM", "HIGH"]. Skip strict JSON schema enforcement initially—accept any structured output that includes the risk level and a short justification. Run 20–30 examples manually and note where the model flags factual statements as hallucinations or misses unsupported claims.
Watch for
- Over-flagging: the model marks well-known facts as HIGH risk because they aren't in the provided context
- Under-flagging: confident-sounding fabrications slip through with LOW risk
- Inconsistent justification format making it hard to compare results across runs

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