This prompt is a regression measurement instrument, not a general answer-quality scorer. Use it when you are promoting a new prompt version, swapping a retrieval pipeline, or changing a model and need an evidence-backed gate before production. It compares two sets of factual QA outputs—a baseline and a candidate—against a shared set of source documents, producing a claim-level verification report that breaks down hallucination rates, severity, and types. The ideal user is a knowledge base team lead, RAG system builder, or AI quality engineer who already has a golden QA dataset, corresponding source documents, and both baseline and candidate answer sets ready for comparison.
Prompt
Hallucination Rate Comparison Prompt for Factual QA

When to Use This Prompt
A measurement instrument for quantifying hallucination regressions in factual QA systems after a prompt, model, or retrieval change.
Do not use this prompt for ad-hoc answer evaluation, single-turn debugging, or workflows where you lack a stable baseline. It assumes you have already run your golden QA dataset through both the old and new system configurations and collected the outputs. The prompt requires structured inputs: a list of QA pairs with both answers, plus the source documents that should ground the answers. Without these, the comparison cannot produce a reliable hallucination rate delta. This prompt also does not judge answer helpfulness, tone, or completeness—it focuses narrowly on factual grounding and hallucination detection.
Before running this prompt, ensure your golden QA dataset covers the failure modes you care about: ambiguous questions, multi-hop reasoning, conflicting sources, and edge cases where the model should abstain. A hallucination regression test is only as strong as the dataset it runs against. After executing the prompt, treat the output as a gate metric: if the candidate hallucination rate exceeds the baseline by a pre-defined threshold, block the release. Pair this prompt with a human review step for any severity-3 hallucinations (fully fabricated claims) flagged in the report.
Use Case Fit
Where the Hallucination Rate Comparison Prompt delivers reliable signal and where it introduces noise or risk.
Good Fit: Pre-Release Regression Gates
Use when: you are comparing a new prompt or retrieval pipeline against a stable baseline before production deployment. Guardrail: Run the prompt on a fixed golden dataset of 50+ QA pairs with pre-verified source documents. Require a statistically significant reduction or no regressions in hallucination rate before promotion.
Good Fit: Retrieval Pipeline Changes
Use when: you have changed chunking strategy, embedding model, or re-ranking logic and need to verify that factual grounding did not degrade. Guardrail: Isolate the retrieval change as the only variable. Compare hallucination rates against the same prompt and generation model to avoid confounding factors.
Bad Fit: Real-Time Production Guarding
Avoid when: you need to block a single hallucinated answer in a live user session. This prompt is a batch evaluation tool, not a low-latency guardrail. Guardrail: Use a lightweight NLI or entailment model for real-time fact-checking. Reserve this prompt for offline regression analysis and release decisions.
Bad Fit: Subjective or Opinion-Based QA
Avoid when: the QA task involves summarization quality, tone, or creative interpretation where no single ground-truth fact exists. Guardrail: Apply this prompt only to verifiable factual claims with explicit source evidence. For subjective tasks, use a semantic drift or tone drift prompt instead.
Required Inputs
What you must provide: a baseline QA dataset with source documents, a new prompt or retrieval config, and an LLM judge with explicit evidence-grounding instructions. Guardrail: Each QA pair must include the exact source passage that supports the answer. Without grounded evidence, the hallucination rate comparison is unreliable.
Operational Risk: Judge Calibration Drift
Risk: The LLM judge used for claim verification may itself hallucinate or apply inconsistent standards across runs. Guardrail: Calibrate the judge on a labeled set of 20-30 claims with known hallucination labels. Re-calibrate if the judge model changes. Log judge confidence scores and flag low-confidence verdicts for human review.
Copy-Ready Prompt Template
A reusable prompt template for comparing hallucination rates between a baseline and candidate prompt version using claim-level verification and explicit source grounding.
The template below is designed to be dropped into an evaluation harness that feeds it pairs of outputs—one from a baseline prompt and one from a candidate prompt—along with the source documents used to generate them. It instructs the model to extract atomic claims from each output, verify each claim against the provided evidence, and produce a structured comparison report. The square-bracket placeholders represent the variables your application must supply at runtime: the two outputs to compare, the source context, the output schema you expect back, and any risk-level or domain-specific constraints.
codeYou are a factual consistency auditor. Your task is to compare two AI-generated answers against the same set of source documents and measure the hallucination rate for each. ## INPUTS ### Source Documents [DOCUMENTS] ### Baseline Answer (Version A) [BASELINE_OUTPUT] ### Candidate Answer (Version B) [CANDIDATE_OUTPUT] ## INSTRUCTIONS 1. Extract every atomic factual claim from the Baseline Answer. An atomic claim is a single verifiable statement that can be checked against the source documents. 2. Repeat for the Candidate Answer. 3. For each claim in both answers, determine its verification status: - **SUPPORTED**: The claim is directly stated in or logically entailed by the source documents. - **UNSUPPORTED**: The claim cannot be verified from the source documents. This is a hallucination. - **CONTRADICTED**: The claim directly conflicts with the source documents. This is a severe hallucination. - **OUT_OF_SCOPE**: The claim addresses a topic not covered by the source documents at all. 4. Classify each hallucination by type: - **FABRICATION**: Invented facts, numbers, names, or events not in sources. - **DISTORTION**: Misrepresented or exaggerated source information. - **OMISSION_AS_FACT**: Stating something as fact when the source only suggests or implies it. - **CITATION_ERROR**: Attributing a claim to the wrong source or section. 5. For every claim, cite the exact source passage(s) that support or contradict it. If no source passage exists, state "No supporting evidence found." ## OUTPUT FORMAT Return a JSON object matching this schema: { "baseline_analysis": { "total_claims": <integer>, "supported_claims": <integer>, "unsupported_claims": <integer>, "contradicted_claims": <integer>, "out_of_scope_claims": <integer>, "hallucination_rate": <float between 0.0 and 1.0>, "claims": [ { "claim_text": "<exact claim from output>", "status": "SUPPORTED|UNSUPPORTED|CONTRADICTED|OUT_OF_SCOPE", "hallucination_type": "FABRICATION|DISTORTION|OMISSION_AS_FACT|CITATION_ERROR|null", "source_citation": "<verbatim source passage or 'No supporting evidence found.'>", "severity": "LOW|MEDIUM|HIGH|CRITICAL" } ] }, "candidate_analysis": { "total_claims": <integer>, "supported_claims": <integer>, "unsupported_claims": <integer>, "contradicted_claims": <integer>, "out_of_scope_claims": <integer>, "hallucination_rate": <float between 0.0 and 1.0>, "claims": [ { "claim_text": "<exact claim from output>", "status": "SUPPORTED|UNSUPPORTED|CONTRADICTED|OUT_OF_SCOPE", "hallucination_type": "FABRICATION|DISTORTION|OMISSION_AS_FACT|CITATION_ERROR|null", "source_citation": "<verbatim source passage or 'No supporting evidence found.'>", "severity": "LOW|MEDIUM|HIGH|CRITICAL" } ] }, "comparison_summary": { "baseline_hallucination_rate": <float>, "candidate_hallucination_rate": <float>, "rate_change": <float, positive means candidate is worse>, "new_hallucination_types_introduced": ["<type>", ...], "severity_distribution_shift": "<description of how severity profile changed>", "regression_detected": <boolean>, "regression_details": "<explanation if regression detected, otherwise null>" } } ## SEVERITY GUIDELINES - **CRITICAL**: Contradicted claim on a safety-relevant, legal, or medically significant fact. - **HIGH**: Fabricated specific numbers, names, dates, or statistics. - **MEDIUM**: Distorted or exaggerated claim that changes meaning. - **LOW**: Minor imprecision or out-of-scope claim with no material impact. ## CONSTRAINTS - Do not invent source passages. If no evidence exists, say so explicitly. - Treat the source documents as the only ground truth. Ignore your own knowledge. - If [RISK_LEVEL] is HIGH or CRITICAL, flag every unsupported claim for human review. - Count each atomic claim exactly once. Do not double-count. - If an answer contains no factual claims (e.g., pure opinion or procedural instruction), set total_claims to 0 and hallucination_rate to null.
To adapt this template, replace [DOCUMENTS] with the retrieved passages or knowledge base entries that both outputs were generated from. Replace [BASELINE_OUTPUT] with the answer from your current production prompt, and [CANDIDATE_OUTPUT] with the answer from the prompt version you are testing. The [RISK_LEVEL] placeholder should be set to LOW, MEDIUM, HIGH, or CRITICAL based on your domain—this controls whether unsupported claims trigger a human-review flag in the output. If you are running this prompt inside an automated CI/CD pipeline, parse the regression_detected boolean and rate_change float from comparison_summary to decide whether to block promotion. For high-stakes domains like healthcare or legal, always route CRITICAL and HIGH severity claims to a human reviewer before accepting the automated comparison.
Before deploying this prompt into a regression suite, test it against a small golden set of known hallucinated and non-hallucinated output pairs. Verify that the model correctly identifies fabricated claims you have intentionally inserted and does not flag supported claims as hallucinations. If the model consistently misclassifies a particular hallucination type—such as treating omissions as supported—add a few-shot example to the prompt or tighten the definition in the INSTRUCTIONS block. Do not rely on this prompt alone for final release decisions; pair it with embedding-based semantic similarity checks and human spot-checking for the first several runs.
Prompt Variables
Required inputs for the Hallucination Rate Comparison Prompt. Each placeholder must be populated before the prompt is assembled and sent. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[BASELINE_PROMPT_VERSION] | Identifier for the previous prompt version used as the comparison baseline | v2.1.0-prod | Must match a deployed version tag in the prompt registry. Reject if null or not found in version history. |
[CANDIDATE_PROMPT_VERSION] | Identifier for the new prompt version under evaluation | v2.2.0-rc3 | Must differ from BASELINE_PROMPT_VERSION. Reject if identical or null. Must exist in the staging registry. |
[TEST_QUESTIONS] | Array of factual questions used to generate outputs from both prompt versions | ["What caused the 2008 financial crisis?", "Explain CRISPR."] | Minimum 20 questions required for statistical significance. Each question must have a known-answer ground-truth source. Reject if fewer than 20 items or if any question lacks a source document. |
[SOURCE_DOCUMENTS] | Map of question IDs to verified ground-truth documents for claim verification | {"q1": ["doc_financial_crisis_2023.pdf"], "q2": ["doc_crispr_review_2024.pdf"]} | Every question in TEST_QUESTIONS must have at least one source document. Documents must be accessible to the retrieval system. Reject if any question has zero sources. |
[CLAIM_EXTRACTION_SCHEMA] | JSON Schema defining the structure for extracted claims from each model output | {"type": "object", "properties": {"claims": {"type": "array", "items": {"type": "object", "properties": {"claim_text": {"type": "string"}, "claim_id": {"type": "string"}}}}}} | Must be a valid JSON Schema. Must include claim_text and claim_id fields at minimum. Parse-check before use. Reject if schema validation fails. |
[VERIFICATION_RUBRIC] | Scoring criteria the LLM judge uses to classify each claim as supported, unsupported, or contradicted | {"supported": "Claim is directly backed by source text", "unsupported": "No source evidence found", "contradicted": "Source explicitly disagrees"} | Must define all three categories: supported, unsupported, contradicted. Rubric text must be non-empty. Reject if any category definition is missing or blank. |
[SEVERITY_WEIGHTS] | Weighting configuration for hallucination severity tiers used in the final rate calculation | {"minor": 0.5, "moderate": 1.0, "critical": 2.0} | Weights must be positive floats. Sum of weights is not required to equal 1.0. Reject if any weight is negative or zero. Default to equal weighting if null. |
[PASS_THRESHOLD] | Maximum acceptable hallucination rate for the candidate prompt to pass the regression gate | 0.05 | Must be a float between 0.0 and 1.0. Represents the weighted hallucination rate ceiling. Reject if outside range. Typical production threshold is 0.03 to 0.07. |
Implementation Harness Notes
How to wire the hallucination rate comparison prompt into a production QA pipeline with validation, logging, and human review gates.
This prompt is designed to operate as a batch comparison engine, not a one-off chat interaction. You feed it two sets of answers—baseline and candidate—alongside the source documents, and it returns a structured claim-level verification report. The harness must enforce that every claim is explicitly grounded in a source passage before the hallucination rate is computed. Without this grounding step, the comparison degenerates into a fluency contest rather than a factual accuracy measurement.
Wire the prompt into a CI/CD evaluation step that runs after any prompt template change, retrieval pipeline update, or model version bump. The harness should: (1) load a golden QA dataset with known source documents and reference answers, (2) generate answers from both the baseline and candidate configurations, (3) call this comparison prompt with both answer sets and the source documents, (4) parse the structured output to extract hallucination counts, severity labels, and attribution gaps, and (5) compare the hallucination rate against a pre-defined threshold. If the candidate hallucination rate exceeds the baseline by more than a configurable margin (e.g., 5 percentage points), block the release and flag for human review.
Validation and retry logic is critical because the prompt produces structured JSON. Implement a JSON Schema validator that checks for required fields (claim_id, claim_text, verdict, evidence_citation, severity). If validation fails, retry once with the error message appended as a [CONSTRAINTS] update. If the retry also fails, log the raw output and escalate. For high-stakes domains like healthcare or legal QA, require human review of any claim marked unsupported or contradicted before the report is accepted. Log every comparison run with the prompt version, model identifier, dataset snapshot, and hallucination rate delta for auditability.
Model choice matters. Use a model with strong instruction-following and long-context handling for this task—GPT-4, Claude 3.5 Sonnet, or equivalent. Smaller models often collapse the structured output or skip evidence citations when documents are long. If you must use a smaller model, split the comparison into batches of 5–10 QA pairs and aggregate results. Never run this prompt without source documents; if your QA dataset lacks ground-truth passages, use a retrieval step to fetch candidate documents first, but flag that the grounding quality depends on retrieval recall.
What to avoid: Do not treat the hallucination rate as a single scalar without examining severity. A 2% hallucination rate where all errors are minor date offsets is different from a 2% rate where claims fabricate drug interactions. Always review the severity distribution before making a promotion decision. Do not skip the evidence-attribution step—this prompt's value is in the claim-to-source mapping, not just the final count. If you only need a binary pass/fail, use a simpler LLM judge; this prompt is for teams that need to understand what changed and why before they ship.
Expected Output Contract
Define the exact structure, types, and validation rules for the hallucination rate comparison report. Use this contract to build a post-processing validator that gates the output before it reaches a dashboard or release gate.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
report_id | string (UUID v4) | Must match UUID v4 regex. Reject if missing or malformed. | |
comparison_window | object | Must contain 'baseline_prompt_version' and 'candidate_prompt_version' as non-empty strings. Reject if either field is missing. | |
total_claims_evaluated | integer | Must be >= 1. Reject if zero, negative, or non-integer. | |
baseline_hallucination_rate | number (float, 0.0-1.0) | Must be between 0.0 and 1.0 inclusive. Reject if out of range or non-numeric. | |
candidate_hallucination_rate | number (float, 0.0-1.0) | Must be between 0.0 and 1.0 inclusive. Reject if out of range or non-numeric. | |
rate_delta | number (float, -1.0 to 1.0) | Must equal candidate_hallucination_rate minus baseline_hallucination_rate within 0.001 tolerance. Reject if mismatch. | |
severity_distribution | object | Must contain keys 'minor', 'moderate', 'critical' with integer values >= 0. Sum must equal total_claims_evaluated. Reject if keys missing or sum mismatch. | |
claim_verifications | array of objects | Each object must contain 'claim_text' (string), 'source_grounding' (string or null), 'verdict' (enum: 'supported', 'unsupported', 'contradicted'), 'severity' (enum: 'minor', 'moderate', 'critical'), and 'evidence_citation' (string or null). Reject if any required field missing or enum value invalid. |
Common Failure Modes
When comparing hallucination rates between prompt versions, these failures surface first. Each card identifies a specific regression pattern and the operational guardrail that catches it before production.
Evidence Grounding Collapse
What to watch: The new prompt produces claims that sound plausible but lack any source attribution, while the baseline prompt consistently cited document sections. This happens when instruction changes weaken the grounding requirement or introduce competing instructions that the model resolves by dropping citations. Guardrail: Run a claim-level attribution check that requires each factual statement to map to a specific source span. Flag any output where unattributed claims exceed 5% of total claims and block promotion if the rate is higher than baseline.
Severity Inflation Under Comparison
What to watch: The new prompt hallucinates the same number of claims as baseline, but the hallucinations are more dangerous—fabricated statistics, invented regulatory requirements, or false safety claims that users might act on. Simple rate comparison misses this shift in harm potential. Guardrail: Add a severity tier to your hallucination taxonomy (cosmetic, misleading, dangerous) and require that dangerous hallucinations never increase version-over-version. Block any release where high-severity fabrications rise above zero.
Retrieval-Prompt Interaction Drift
What to watch: The prompt change itself looks clean, but it alters how the model uses retrieved context. The model starts synthesizing across documents incorrectly, merging facts from unrelated sources, or ignoring retrieval results in favor of parametric knowledge. Guardrail: Test with a fixed retrieval set across both prompt versions. Compare not just hallucination rates but source utilization patterns—which documents were cited, whether cross-document contamination occurred, and whether the model ever answered without referencing provided context.
Abstention Boundary Shift
What to watch: The new prompt answers questions that the baseline correctly refused to answer due to insufficient evidence. The hallucination rate appears unchanged because the model is now confidently wrong on previously gated questions. Guardrail: Track the abstention rate alongside the hallucination rate. Include a set of unanswerable questions in your golden dataset where the correct output is a refusal. Flag any version that answers more than 10% of previously refused questions without improved retrieval coverage.
Judge Model Calibration Drift
What to watch: The LLM judge used to compare hallucination rates develops its own biases against the new prompt's output style, marking correct but differently-phrased claims as hallucinations. The regression report shows a hallucination spike that isn't real. Guardrail: Run a calibration check where human annotators label a sample of judge decisions from both prompt versions. If judge-human agreement drops below 85% on the new prompt's outputs, recalibrate the judge before accepting any regression signal.
Claim Extraction Inconsistency
What to watch: The claim extraction step that decomposes outputs into verifiable claims behaves differently on the new prompt's outputs—splitting compound claims differently or missing implicit claims that the baseline extraction caught. This makes hallucination rates incomparable. Guardrail: Validate claim extraction consistency by running both prompt versions through the same extractor and checking that claim count distributions haven't shifted unexpectedly. If average claims per response differ by more than 20%, investigate extraction drift before comparing hallucination rates.
Evaluation Rubric
Criteria for evaluating the hallucination rate comparison report before accepting it as a valid regression gate. Each criterion maps to a pass standard, a concrete failure signal, and a test method that can be automated in a CI/CD pipeline.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Claim Extraction Completeness | All factual claims from both [BASELINE_OUTPUT] and [CANDIDATE_OUTPUT] are extracted with no omissions | Extracted claim count is zero or fewer than 80% of human-annotated claim count in golden set | Compare claim count against golden annotation set; flag if delta exceeds 20% |
Source Grounding Accuracy | Every claim labeled as 'grounded' has an explicit citation to a passage in [SOURCE_DOCUMENTS] that directly supports the claim | A grounded claim's citation points to a passage that does not contain the supporting fact | NLI-based entailment check between claim and cited passage; fail if entailment score below 0.7 |
Hallucination Classification Correctness | Claims are correctly classified as 'grounded', 'unsupported', or 'contradicted' with at least 90% agreement against human labels | Classification agreement with human-annotated labels falls below 90% on a held-out calibration set | Run against 50-example calibration set with human labels; compute Cohen's kappa; fail if kappa < 0.8 |
Severity Rating Consistency | Severity ratings (minor, moderate, critical) follow the defined taxonomy: critical = invents harmful or legally risky content; moderate = introduces plausible but false detail; minor = stylistic or trivial fabrication | A claim rated 'minor' contains invented safety instructions or legal advice | Spot-check 10% of critical-rated claims with human review; fail if any misclassification found |
Rate Calculation Accuracy | Hallucination rate = (unsupported + contradicted claims) / total claims; both baseline and candidate rates are computed correctly within 1 percentage point tolerance | Reported rate differs from independently computed rate by more than 1 percentage point | Parse report JSON, recompute rates from claim classifications, compare; fail if absolute difference > 0.01 |
Comparative Delta Reporting | The report includes a delta section showing: baseline rate, candidate rate, absolute change, relative change, and a statistical significance flag | Delta section is missing, contains null values, or reports a negative hallucination rate | Schema validation on delta fields; fail if required fields absent or hallucination_rate < 0 |
Evidence-Attribution Harness Integrity | Every claim in the report includes a source_document_id and excerpt field; no claim is marked grounded without both fields populated | A grounded claim has null or empty source_document_id or excerpt | JSON schema validation on output; fail if grounded claim missing required citation fields |
Regression Gate Decision Correctness | Report correctly flags a regression when candidate hallucination rate exceeds baseline by more than the configured threshold (default 5 percentage points) with statistical significance | Regression flag is false when delta exceeds threshold, or true when delta is within threshold | Inject 10 known-regression and 10 known-clean test pairs; fail if any misclassified |
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 hand-labeled dataset of 20–30 QA pairs. Replace [BASELINE_RUN_ID] and [CANDIDATE_RUN_ID] with static file paths or inline JSON. Skip the evidence-attribution harness initially; focus on getting claim extraction and binary hallucination flags working. Use a single LLM judge call per QA pair instead of the multi-pass verification loop.
codeSimplify: Remove [EVIDENCE_ATTRIBUTION_REQUIRED] and [SEVERITY_CLASSIFICATION] sections. Replace [OUTPUT_SCHEMA] with a flat JSON array of {claim, hallucination_flag, brief_reason}.
Watch for
- Claim splitting errors where compound sentences produce overlapping or duplicate claims
- The judge marking ambiguous statements as hallucinations when they're actually reasonable inferences
- No baseline to compare against, making rate changes uninterpretable

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