This prompt is a precision instrument for quality engineers and platform teams who need to gate a prompt's release on its factual accuracy. Its core job is to take a model's output and a set of verified ground-truth references, then produce a structured, machine-readable hallucination report. The ideal user is someone integrating this check into a CI/CD pipeline as a blocking gate, preventing a prompt from being promoted from staging to production if it fabricates unsupported claims. This is essential for workflows where hallucination carries direct business risk, such as customer-facing RAG applications, regulated document summarization, or any system where the model must not invent facts.
Prompt
Hallucination Rate Gate Prompt

When to Use This Prompt
Defines the exact scenario for using the Hallucination Rate Gate Prompt and clarifies when it is the wrong tool for the job.
The prompt is designed with a specific assumption: you already have a candidate output and a curated set of reference material. It is not a general-purpose quality scorer or a chatbot evaluator. Do not use it to assess creativity, tone, or helpfulness. Do not use it when you lack a ground-truth source to verify against, as the prompt's entire logic depends on aligning claims to evidence. It is also not a substitute for a full RAG evaluation; it focuses narrowly on the factual accuracy of a single generated text against a known set of documents, not on the retrieval step itself.
Before using this prompt, ensure your workflow can provide the required inputs: a clear [MODEL_OUTPUT] and a [REFERENCE_MATERIAL] that contains the complete set of admissible facts. The prompt works best when the reference material is a closed set of documents, such as a specific knowledge base article or a set of legal clauses. If the model is allowed to use general world knowledge, you must explicitly define the boundary between acceptable general knowledge and forbidden fabrication within the [CONSTRAINTS] block. The next section provides the exact prompt template you will need to wire this gate into your release process.
Use Case Fit
Where the Hallucination Rate Gate Prompt delivers reliable value and where it introduces operational risk. Use these cards to decide if this prompt fits your QA pipeline before integrating it into a release gate.
Good Fit: Ground-Truth References Exist
Use when: you have a curated golden dataset with verified, source-backed answers for each test input. The prompt compares extracted claims against these references. Avoid when: ground truth is missing, outdated, or itself unverified—the gate will produce misleading pass rates.
Bad Fit: Subjective or Creative Outputs
Avoid when: the prompt under test generates marketing copy, poetry, brainstorming results, or open-ended analysis where factual accuracy isn't the primary quality dimension. Risk: the hallucination gate will flag legitimate creative variation as fabrication, producing false positives that block valid releases.
Required Input: Claim-Annotated References
What to watch: the prompt needs both the model output and a reference document with atomic, verifiable claims. Guardrail: pre-process reference material into a structured claim set before running the gate. If claim extraction from references is itself unreliable, gate results become untrustworthy.
Operational Risk: Severity Threshold Calibration
Risk: a poorly calibrated severity classifier treats minor imprecision the same as dangerous fabrication, causing unnecessary release blocks or, worse, training teams to ignore gate failures. Guardrail: define severity tiers with clear examples, require human review for high-severity findings, and track false-positive rates over time.
Operational Risk: Reference Drift Over Time
Risk: ground-truth references become stale as product facts, policies, or documentation change. The gate will flag correct new information as hallucination. Guardrail: version-lock reference sets to the prompt version under test, run reference freshness checks before each gate execution, and treat reference updates as a gate configuration change requiring its own review.
Bad Fit: Real-Time or Streaming Outputs
Avoid when: the prompt produces streaming tokens or real-time responses where full output isn't available for batch claim extraction. Risk: partial outputs break the claim extraction step, producing incomplete or misleading hallucination reports. Guardrail: use this gate only on complete, final outputs in batch evaluation pipelines.
Copy-Ready Prompt Template
A reusable prompt that extracts claims from an AI-generated output, verifies each claim against ground-truth references, and produces a structured hallucination report with per-claim status, fabrication rate, and severity classification.
This prompt template is the core instruction set for the Hallucination Rate Gate. It takes an AI-generated [OUTPUT] and a set of [GROUND_TRUTH_REFERENCES], extracts every factual claim, aligns each claim to the evidence, and classifies the result. The output is a machine-readable hallucination report that your CI/CD harness can consume to enforce a maximum fabrication rate before promotion. Use this template as the evaluation step in your release gate pipeline, not as a one-off manual check.
textYou are a factual accuracy auditor. Your task is to evaluate an AI-generated output against provided ground-truth references and produce a structured hallucination report. ## INPUT ### AI-Generated Output to Audit [OUTPUT] ### Ground-Truth References [GROUND_TRUTH_REFERENCES] ### Constraints - Maximum acceptable fabrication rate: [MAX_FABRICATION_RATE] - Severity classification rules: [SEVERITY_RULES] - Output schema: [OUTPUT_SCHEMA] ## INSTRUCTIONS 1. **Claim Extraction**: Extract every discrete factual claim from the AI-generated output. A claim is any statement that can be verified as true or false against the references. Include the exact text span and its position in the output. 2. **Evidence Alignment**: For each claim, search the ground-truth references for supporting or contradicting evidence. Record the exact reference text and location that supports or contradicts the claim. 3. **Verification Status**: Classify each claim as one of: - `VERIFIED`: Claim is directly supported by reference evidence. - `CONTRADICTED`: Claim is directly contradicted by reference evidence. - `UNVERIFIABLE`: Claim cannot be confirmed or denied using available references. - `FABRICATED`: Claim appears to be invented with no basis in references and no qualifying language. 4. **Severity Classification**: For each FABRICATED or CONTRADICTED claim, assign a severity level using [SEVERITY_RULES]. 5. **Fabrication Rate Calculation**: Calculate the fabrication rate as: (number of FABRICATED claims) / (total number of claims). 6. **Gate Decision**: Compare the fabrication rate to [MAX_FABRICATION_RATE]. If the rate exceeds the threshold, mark the gate as FAILED. Otherwise, mark as PASSED. ## OUTPUT Produce a JSON object conforming exactly to [OUTPUT_SCHEMA]. Do not include commentary outside the JSON structure.
Adapt this template by replacing each square-bracket placeholder with concrete values from your evaluation harness. [OUTPUT] receives the AI-generated text under test. [GROUND_TRUTH_REFERENCES] should contain the authoritative source material, formatted as structured text with location markers. [MAX_FABRICATION_RATE] is your release gate threshold, typically a decimal between 0.0 and 1.0. [SEVERITY_RULES] defines how you classify the impact of each fabrication, such as 'CRITICAL: safety or financial impact, HIGH: materially misleading, MEDIUM: minor factual error, LOW: stylistic or trivial.' [OUTPUT_SCHEMA] should be a JSON Schema object describing the exact structure your harness expects. Wire this prompt into an evaluation runner that executes it against every candidate output before promotion. If your domain is regulated or high-risk, add a human review step for any output where the fabrication rate is non-zero, even if it passes the numeric gate.
Prompt Variables
Required inputs for the Hallucination Rate Gate Prompt. Each placeholder must be populated before evaluation to ensure reliable claim extraction, evidence alignment, and rate threshold enforcement.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[MODEL_OUTPUT] | The generated text to evaluate for hallucination | The capital of France is Paris. The Eiffel Tower was built in 1889. | Required. Must be non-empty string. Reject if null or whitespace-only. Max 32K tokens for cost control. |
[GROUND_TRUTH_SOURCES] | Reference documents or facts used to verify claims | [{"source_id": "doc1", "text": "Paris is the capital of France."}, {"source_id": "doc2", "text": "The Eiffel Tower was completed in 1889."}] | Required. Must be valid JSON array with source_id and text fields. Reject if empty array or malformed JSON. |
[CLAIM_EXTRACTION_SCHEMA] | JSON Schema defining the structure for extracted claims | {"type": "object", "properties": {"claims": {"type": "array", "items": {"type": "object", "properties": {"claim_text": {"type": "string"}, "claim_span": {"type": "object"}}}}}} | Required. Must parse as valid JSON Schema. Validate with schema validator before prompt assembly. |
[VERIFICATION_THRESHOLD] | Minimum confidence score for a claim to be considered verified | 0.85 | Required. Must be float between 0.0 and 1.0. Reject values outside range. Default 0.80 if not specified. |
[HALLUCINATION_RATE_GATE] | Maximum acceptable fabrication rate before the prompt fails the gate | 0.05 | Required. Must be float between 0.0 and 1.0. Represents 5% max hallucination rate. Reject if negative or above 1.0. |
[SEVERITY_CLASSIFICATION_MAP] | Mapping of hallucination types to severity levels | {"contradiction": "critical", "unsupported": "high", "exaggeration": "medium", "minor_imprecision": "low"} | Required. Must be valid JSON object. Validate all severity values against allowed enum: critical, high, medium, low, info. |
[OUTPUT_FORMAT] | Desired structure for the hallucination report | json | Required. Must be one of: json, jsonl, csv. Reject unknown formats. JSON is default and recommended for downstream parsing. |
[MAX_CLAIMS_PER_RUN] | Upper bound on claims extracted to control cost and latency | 50 | Optional. Must be positive integer if provided. Null allowed. Default 100 if null. Enforce ceiling to prevent runaway extraction on long outputs. |
Implementation Harness Notes
How to wire the Hallucination Rate Gate Prompt into an automated CI/CD pipeline with claim extraction, evidence alignment, and threshold enforcement.
The Hallucination Rate Gate Prompt is not a standalone chat interaction; it is a programmatic evaluation step designed to run inside a testing harness. The prompt expects a structured input containing the model's generated output and the corresponding ground-truth reference. The harness is responsible for preparing this input, invoking the LLM, parsing the structured hallucination report, and enforcing the defined rate thresholds. This section covers the integration points, validation logic, and failure handling required to make this gate reliable in an automated release pipeline.
To implement the gate, first build a claim extraction and alignment pre-processor. Before calling the gate prompt, use a separate extraction prompt or a deterministic parser to split the generated output into discrete, verifiable claims. Pair each claim with the relevant evidence span from the ground-truth reference. The gate prompt's [CLAIMS_WITH_EVIDENCE] placeholder should receive a JSON array of objects, each with a claim_id, claim_text, and evidence_text field. The harness must then parse the LLM's JSON response, which should conform to a strict schema: a list of verdicts with claim_id, verdict (one of SUPPORTED, CONTRADICTED, UNVERIFIABLE, FABRICATED), and reasoning. Validate this output immediately. If the JSON is malformed, retry up to two times with a repair prompt that includes the raw output and the expected schema. If parsing still fails, fail the gate with a HARNESS_ERROR status.
The core enforcement logic lives in the threshold evaluator. After successful parsing, calculate the hallucination rate as (FABRICATED claims / total claims) * 100. Compare this rate against the [MAX_HALLUCINATION_RATE] threshold provided in the prompt's constraints. Additionally, check for CONTRADICTED claims, which may trigger a separate, lower threshold. Log every evaluation run with a unique eval_id, the prompt version, the model version, the input hash, the full verdict array, and the calculated rates. This log becomes your audit trail for release decisions. For high-risk domains, route any gate failure or UNVERIFIABLE claim cluster to a human review queue before blocking the release. Never auto-promote a prompt when the hallucination rate exceeds the threshold; the gate's output should be a boolean passed field and a structured report that downstream deployment scripts can consume.
When integrating into a CI/CD pipeline, treat this gate as a blocking quality check in the staging environment. Run it against a curated golden dataset of at least 50 input-output pairs with verified ground-truth references. Cache the LLM responses to avoid cost fluctuations during repeated runs. If the gate fails, the pipeline must halt promotion and surface the hallucination report to the release manager. Avoid the temptation to lower the threshold to let a failing prompt through; instead, use the per-claim verdicts to debug whether the failure is due to retrieval gaps, ambiguous grounding, or model behavior drift. The next step after a gate failure should be a targeted prompt repair or evidence improvement cycle, not a threshold adjustment.
Expected Output Contract
Fields, format, and validation rules for the JSON response produced by the Hallucination Rate Gate Prompt. Use this contract to build a parser, validator, or CI/CD gate harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
output_id | string (UUID v4) | Must parse as valid UUID v4. Reject if missing or malformed. | |
evaluation_timestamp | string (ISO 8601 UTC) | Must parse as valid ISO 8601 datetime in UTC. Reject if future-dated beyond 5-minute clock skew tolerance. | |
total_claims_extracted | integer >= 0 | Must be a non-negative integer. Must equal the count of items in the claims array. Reject on mismatch. | |
claims | array of objects | Must be a JSON array. Reject if null, missing, or not an array. Allow empty array only if total_claims_extracted is 0. | |
claims[].claim_id | string | Must be unique within the claims array. Reject on duplicate claim_id values. | |
claims[].claim_text | string | Must be a non-empty string. Reject if null, empty, or whitespace-only. | |
claims[].verification_status | enum: [VERIFIED, UNVERIFIED, CONTRADICTED, UNSUPPORTED] | Must be one of the four enum values exactly. Reject on any other value or case mismatch. | |
claims[].evidence_source | string or null | Required when verification_status is VERIFIED or CONTRADICTED. Must be null when status is UNSUPPORTED. Reject on violation. | |
claims[].severity | enum: [CRITICAL, HIGH, MEDIUM, LOW] | Must be one of the four enum values exactly. CRITICAL reserved for claims where fabrication would cause user harm or regulatory risk. Reject on invalid enum. | |
fabrication_rate | number (float, 0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. Must equal (count of UNSUPPORTED + CONTRADICTED claims) / total_claims_extracted. Reject if computed value differs by more than 0.001. | |
gate_result | enum: [PASS, FAIL, REVIEW] | Must be one of the three enum values exactly. PASS when fabrication_rate <= configured threshold. FAIL when above. REVIEW when severity distribution triggers manual escalation. Reject on invalid enum. | |
threshold_applied | number (float, 0.0 to 1.0) | Must match the configured gate threshold for this run. Reject if value differs from expected threshold by more than 0.001. |
Common Failure Modes
Hallucination rate gates fail in predictable ways. These are the most common failure modes when measuring factual accuracy against ground-truth references, and the guardrails that prevent them from reaching production.
Claim Extraction Misses Implicit Assertions
What to watch: The claim extraction step only catches explicit factual statements and misses implied claims, presuppositions, and background assertions embedded in the output. A response saying 'the system processes 10K requests per second' contains the implicit claim that the system exists and processes requests at all. Guardrail: Pair extraction with a completeness check that asks the model to list all entities and relationships referenced, then verify each against evidence. Log extraction recall by comparing claim counts across prompt versions on golden outputs.
Evidence Alignment Uses Wrong Granularity
What to watch: The verifier matches claims to evidence at the wrong level of detail. A claim about a specific configuration parameter gets matched to a document that mentions the parameter name but doesn't confirm the value, producing a false verification. Guardrail: Require span-level citation with exact text offsets, not document-level matching. Add a sufficiency check that asks whether the cited span alone would convince a domain expert. Flag any verification where the evidence span is shorter than the claim it supposedly supports.
Rate Thresholds Mask Systematic Failure Patterns
What to watch: An aggregate hallucination rate of 3% passes the gate, but all failures cluster in a specific domain, entity type, or output section. The gate gives a green light while a whole category of responses is unreliable. Guardrail: Decompose the rate by category, entity type, claim type, and output section. Set per-category thresholds that are stricter than the aggregate threshold. Fail the gate if any category exceeds its individual rate limit, even if the overall rate passes.
Ground-Truth References Contain Stale or Wrong Data
What to watch: The reference dataset used for verification is outdated, incomplete, or contains factual errors. The gate flags correct model outputs as hallucinations because the ground truth is wrong, or passes fabricated claims because the reference also contains the fabrication. Guardrail: Version-lock reference datasets with timestamps and provenance. Run a consistency audit on the reference data before each gate execution. Track 'reference-corrected' vs. 'model-corrected' dispute rates and escalate when dispute rate exceeds 5%.
Severity Classification Collapses Everything to Binary
What to watch: The gate treats a hallucinated date format as equivalent to a hallucinated safety-critical instruction. Low-severity fabrications inflate the rate and trigger rollbacks for cosmetic issues, or high-severity fabrications hide inside an acceptable aggregate rate. Guardrail: Implement a three-tier severity taxonomy: cosmetic (formatting, phrasing), material (changes meaning but not outcome), and critical (changes decision, safety, or compliance status). Set separate thresholds per tier. Critical hallucinations at any rate above zero fail the gate unconditionally.
Verification Model Hallucinates the Verification Itself
What to watch: The LLM judge used for claim verification fabricates evidence matches, invents source spans, or confirms claims based on its own parametric knowledge rather than the provided reference text. The gate reports low hallucination rates while the verifier itself is hallucinating. Guardrail: Run a meta-verification pass on a sample of verifier outputs. Check that every cited evidence span actually exists in the reference text. Track the verifier's own hallucination rate and fail the gate if the verifier hallucination rate exceeds 1%. Use a second, independent model for meta-verification.
Evaluation Rubric
Criteria for testing the Hallucination Rate Gate Prompt's own output quality before relying on it in a release pipeline. Use these tests to verify that the gate prompt correctly identifies, classifies, and scores hallucinations against ground-truth references.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Claim Extraction Completeness | All verifiable claims in [INPUT_TEXT] are extracted with no omissions | Extracted claims list misses a factual statement present in the source text | Compare extracted claims against a human-annotated golden set of claims for 20 diverse inputs |
Evidence Alignment Accuracy | Each extracted claim is mapped to the correct [GROUND_TRUTH] passage with span-level precision | Claim mapped to wrong evidence passage or evidence span does not support the claim | Verify claim-evidence pairs against pre-labeled alignment dataset; measure precision and recall |
Hallucination Classification Correctness | Contradicted, unsupported, and fabricated claims are correctly labeled per the defined taxonomy | Fabricated claim labeled as supported or contradicted claim labeled as unsupported | Run against 50 known hallucination cases with ground-truth labels; require >95% classification accuracy |
Fabrication Rate Calculation | Reported fabrication rate matches manual count of fabricated claims divided by total claims | Fabrication rate off by more than 2 percentage points from ground truth | Cross-check computed rate against programmatic calculation from labeled claim set |
Severity Classification Consistency | High-severity hallucinations (fabricated numbers, names, dates) are never classified as low | A fabricated statistic or entity name receives a low severity rating | Test with 10 inputs containing known high-severity fabrications; require 100% high-severity flagging |
Output Schema Compliance | JSON output matches [OUTPUT_SCHEMA] with all required fields present and correctly typed | Missing required field, wrong type, or extra unexpected fields in output | Validate output against JSON Schema; reject any output that fails structural validation |
Threshold Enforcement Correctness | Gate returns pass=false when fabrication rate exceeds [THRESHOLD] and pass=true when below | Gate passes an input with fabrication rate above threshold or fails one below threshold | Run 30 inputs with known fabrication rates spanning threshold boundary; require 100% correct pass/fail decisions |
Refusal Handling | When [INPUT_TEXT] is empty or unverifiable, gate returns appropriate error or abstention signal | Gate fabricates claims or returns pass/fail on empty or nonsense input | Submit empty string, whitespace-only, and gibberish inputs; verify error response or abstention flag |
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 but remove strict schema enforcement. Use a simpler output format like a markdown table instead of structured JSON. Focus on getting the claim extraction and verification logic right before adding harness complexity.
Simplify the prompt template:
- Replace
[OUTPUT_SCHEMA]with a plain markdown table specification - Remove
[SEVERITY_CLASSIFICATION]rules and use a simple binary flag - Skip
[EVIDENCE_ALIGNMENT]checks and just ask for a confidence score - Use a small hand-picked set of 5-10 examples instead of a full golden dataset
Watch for
- Claims being extracted but not individually verified against evidence
- The model conflating "likely true" with "verified against source"
- Inconsistent severity labeling when you later add classification rules
- Overly verbose explanations that make it hard to count hallucination rates

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