Inferensys

Prompt

Pre-Release Answer Fact-Check Gate Prompt

A practical prompt playbook for implementing a final quality barrier that checks RAG answers for unsupported claims, contradictions, and citation validity before they reach a user.
QA engineer performing AI quality assurance on laptop, test results visible, casual technical debugging session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the specific job-to-be-done, the ideal user, and the operational boundaries for the Pre-Release Answer Fact-Check Gate Prompt.

This prompt is the final automated quality barrier before a generated answer is delivered to a user. It is designed for release managers and QA engineers who need a single, composite checkpoint that runs multiple hallucination and integrity checks in one pass. The prompt inspects a candidate answer against its source evidence and produces a structured go/no-go recommendation. Use it when a wrong answer carries high risk—such as in customer-facing support, clinical documentation, or legal research—and you need an auditable, automated decision before human review or final release. This is not a prompt for generating answers; it is a prompt for verifying them.

The ideal user is an AI pipeline operator who already has a generated answer and its source context. The prompt requires three inputs: the user's original question, the candidate answer, and the retrieved evidence used to generate that answer. It then executes a battery of checks, including unsupported claim detection, contradiction identification, and citation validity verification. The output is a structured JSON report with a pass or fail recommendation and a detailed failure log. This allows you to programmatically block, flag, or route answers based on a consistent, machine-readable signal.

Do not use this prompt as a substitute for retrieval quality or answer generation logic. It assumes the evidence provided is the complete and correct set of sources; it will not detect retrieval failures where the right document was never fetched. It is also not a replacement for human review in regulated domains—treat the pass recommendation as a filter that reduces review burden, not as a final sign-off. For high-stakes workflows, always route pass outputs to a human review queue and escalate fail outputs for immediate remediation. The prompt works best as the last step in a RAG pipeline, positioned after answer generation but before the response is surfaced to the user.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Pre-Release Answer Fact-Check Gate Prompt fits into a production RAG pipeline and where it creates more risk than it removes.

01

Good Fit: Final Release Gate

Use when: you need a single, composite check as the last step before an answer reaches a user. The prompt runs multiple hallucination checks (unsupported claims, contradictions, citation validity) in one pass and outputs a go/no-go recommendation. Guardrail: position this gate after all other generation and repair steps, not as the only quality check.

02

Bad Fit: Real-Time Chat

Avoid when: latency budgets are under 500ms or the user is waiting synchronously. This composite prompt performs multiple verification passes and adds significant inference time. Guardrail: use lightweight, single-check prompts (e.g., sentence-level grounding) for synchronous flows and reserve this gate for async or batch release pipelines.

03

Required Inputs

Risk: running the gate without complete inputs produces false negatives or useless reports. Guardrail: ensure the prompt always receives the full generated answer, all retrieved source passages with document IDs, the original user question, and any citation map produced during generation. Missing any input should trigger an automatic block, not a pass.

04

Operational Risk: Gate Bypass

Risk: teams disable the gate after a few false positives, leaving no protection in place. Guardrail: log every gate decision with the full failure report. Track pass/block rates, false positive ratios, and override events. Require a documented reason for every manual override so the gate improves rather than disappears.

05

Operational Risk: Cascading Failures

Risk: if the gate model is unavailable or times out, the entire answer pipeline stalls. Guardrail: implement a circuit breaker with a configurable fallback policy (block, flag, or pass with warning). Never default to silent pass on gate failure in high-stakes domains.

06

Not a Replacement for Eval

Risk: treating the gate as the only factual accuracy check creates a single point of failure. Guardrail: run this gate as part of a layered defense that includes offline eval pipelines, human spot checks, and upstream retrieval quality monitors. The gate catches what slips through, not everything that could go wrong.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A composite gate prompt that runs unsupported claim detection, contradiction checks, and citation validity verification in a single pass, producing a structured go/no-go recommendation.

This prompt template acts as a final quality gate before an AI-generated answer reaches a user. It is designed to be used as a post-generation, pre-release audit step in a RAG pipeline. The prompt instructs the model to act as an auditor, systematically comparing a candidate answer against provided source evidence. It enforces three critical checks: identifying claims the evidence does not support, flagging direct contradictions, and validating that any inline citations genuinely back the statements they are attached to. The output is a structured JSON report that your application can parse to automatically block, flag, or release the answer.

text
You are a final-answer quality gate auditor. Your job is to inspect a candidate answer against provided source evidence and determine whether it is safe to release to a user. You must run three checks: (1) unsupported claims, (2) contradictions with source evidence, and (3) citation validity if citations are present. You must then produce a go/no-go recommendation with a structured failure report.

---

## USER QUESTION
[USER_QUESTION]

## CANDIDATE ANSWER
[CANDIDATE_ANSWER]

## SOURCE EVIDENCE
[SOURCE_EVIDENCE]

---

## AUDIT INSTRUCTIONS

### Check 1: Unsupported Claims
Extract every factual claim from the Candidate Answer. For each claim, determine if it is directly supported by the Source Evidence. A claim is supported only if the evidence explicitly states it or it is a trivial logical deduction from the evidence. Mark each claim as SUPPORTED or UNSUPPORTED. For unsupported claims, quote the exact claim text and explain why the evidence does not support it.

### Check 2: Contradictions
Compare each factual claim in the Candidate Answer against the Source Evidence. Identify any claim that directly contradicts what the evidence states. A contradiction occurs when the answer asserts something that the evidence explicitly denies or states differently. For each contradiction, quote the contradicting claim and the conflicting source passage.

### Check 3: Citation Validity
If the Candidate Answer contains inline citations, verify each one. For each citation, check whether the cited source passage genuinely supports the specific claim it is attached to. Flag any citation that is fabricated, misattributed, or attached to a claim the source does not make.

### Final Recommendation
Based on the three checks above, produce a single recommendation:
- **GO**: No unsupported claims, no contradictions, and all citations are valid. The answer is safe to release.
- **NO_GO**: One or more critical failures detected. The answer must be blocked or sent for human review.
- **CONDITIONAL_GO**: Minor issues detected that do not affect factual accuracy. The answer may be released with caveats logged.

---

## OUTPUT FORMAT
Return a valid JSON object with this exact structure:
{
  "recommendation": "GO | NO_GO | CONDITIONAL_GO",
  "summary": "Brief explanation of the recommendation",
  "unsupported_claims": [
    {
      "claim_text": "Exact claim from the answer",
      "status": "UNSUPPORTED",
      "reason": "Why the evidence does not support this claim"
    }
  ],
  "contradictions": [
    {
      "claim_text": "Exact contradicting claim from the answer",
      "source_passage": "Conflicting passage from the evidence",
      "explanation": "How the claim contradicts the source"
    }
  ],
  "citation_issues": [
    {
      "citation": "The citation as it appears in the answer",
      "attached_claim": "The claim the citation is attached to",
      "issue": "Description of the validity problem"
    }
  ]
}

If no issues are found for a check, return an empty array for that field.

To adapt this template, replace the three bracketed placeholders with your runtime data: [USER_QUESTION] should contain the original user query, [CANDIDATE_ANSWER] should contain the full generated answer you intend to audit, and [SOURCE_EVIDENCE] should contain the concatenated retrieved passages that were used to generate that answer. For best results, ensure the source evidence includes document identifiers or chunk IDs that can be referenced in citations. If your answer generation step does not produce inline citations, the citation validity check will simply return an empty array, and the gate will still function for unsupported claim and contradiction detection.

When integrating this into a production harness, treat the recommendation field as the primary signal for your release logic. A NO_GO should block the answer and either trigger a retry with different evidence, fall back to a safe canned response, or escalate to a human review queue. A CONDITIONAL_GO should log the issues and potentially surface a warning to the end-user. Always validate that the model's output conforms to the specified JSON schema before acting on the recommendation; a malformed response should default to NO_GO to avoid releasing unaudited content. For high-stakes domains like healthcare or finance, route all CONDITIONAL_GO results to human review rather than releasing them automatically.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Pre-Release Answer Fact-Check Gate Prompt. Each placeholder must be populated before the prompt is assembled and sent. Missing or malformed inputs are the most common cause of false negatives in automated gating.

PlaceholderPurposeExampleValidation Notes

[GENERATED_ANSWER]

The full text of the answer that must pass the fact-check gate before release

The primary cause of the outage was a failed deployment of the payment service at 14:22 UTC.

Must be a non-empty string. Truncate if longer than the model's context window minus other inputs. Check for null or whitespace-only strings before assembly.

[SOURCE_EVIDENCE]

The retrieved passages, documents, or context chunks that the answer claims to be based on

[{doc_id: 'INC-2024-03', passage: 'Deployment of payment service v2.4.1 began at 14:15 UTC and failed with error code E-502.'}]

Must be a valid JSON array of objects with at least doc_id and passage fields. Reject if empty array. Validate JSON parse before prompt assembly. Each passage must be a non-empty string.

[CITATION_MAP]

Mapping from citation markers in the answer to specific source evidence entries

[{citation_id: '[1]', doc_id: 'INC-2024-03', passage_index: 0}]

Must be a valid JSON array. Each citation_id in the map must appear in the GENERATED_ANSWER text. Each doc_id must exist in SOURCE_EVIDENCE. Reject if citations reference non-existent sources.

[FAILURE_SEVERITY_THRESHOLD]

The minimum severity level that triggers a NO-GO recommendation

CRITICAL

Must be one of: CRITICAL, MAJOR, MINOR, or ALL. CRITICAL gates on unsupported factual claims only. MAJOR includes contradictions. MINOR includes missing citations. ALL flags everything. Validate against enum before use.

[REQUIRED_CITATION_COVERAGE]

The minimum percentage of factual claims that must have at least one citation

0.9

Must be a float between 0.0 and 1.0. A value of 0.9 means 90% of claims need citations. Use 0.0 to disable citation coverage checks. Validate range and type before prompt assembly.

[OUTPUT_SCHEMA]

The exact JSON schema the gate must return, including go/no-go decision and failure report structure

See output contract definition

Must be a valid JSON Schema object. Include required fields: decision, failures, summary. Validate schema parse before prompt assembly. Schema mismatch is the top cause of post-processing failures in automated pipelines.

[ADDITIONAL_POLICY_RULES]

Domain-specific rules that override default fact-check behavior, such as allowed inference types or terminology exceptions

Allow paraphrasing of technical error codes without citation. Treat timestamps within 5 minutes as equivalent.

Optional. If provided, must be a non-empty string. Rules must not contradict the core instruction to ground claims in evidence. Review for policy conflicts before assembly. Null allowed if no custom rules.

PROMPT PLAYBOOK

Implementation Harness Notes

Wire the Pre-Release Answer Fact-Check Gate Prompt as a deterministic, final-step guardrail in your answer pipeline.

This prompt is designed to be the last automated check before a generated answer reaches a user. It should be called after the primary answer generation step and any post-generation repair or citation formatting steps. The gate receives the final candidate answer and the complete set of source evidence used to generate it. Its output is a structured JSON object containing a recommendation (GO, CONDITIONAL_GO, or NO_GO) and a detailed failure_report. The prompt is deterministic given its inputs, meaning that for the same answer and evidence, it will produce the same recommendation. Do not retry this prompt on a NO_GO without first changing the answer or the provided evidence; doing so will only waste inference resources and delay the inevitable human review.

To wire this into an application, call the model with response_format set to json_object or use a structured output mode that enforces the expected schema. On receiving the response, validate the JSON structure before acting on the recommendation. If the recommendation is NO_GO, route the entire answer payload—including the generated text, source evidence, and the full audit report—to a human review queue. Do not show the answer to the user. If the recommendation is CONDITIONAL_GO, log the specific issues found in the failure report and consider surfacing a confidence note or caveat to the end user alongside the answer. For high-throughput systems, implement a circuit breaker: if more than a configurable percentage of answers (e.g., 5%) receive a NO_GO within a rolling time window, pause automated releases and alert the operations team. This protects users from systemic failures in retrieval or generation.

Every audit result must be logged with the answer ID, the recommendation, and the counts of each failure type (unsupported claims, contradictions, invalid citations) for observability and trend analysis. Use these logs to build dashboards that track hallucination rates over time, by source, or by query type. When a NO_GO occurs, the human reviewer should have access to the full audit report to quickly identify which claims failed and why. After human remediation, the corrected answer can be re-submitted to the gate for a final check before release. Avoid the temptation to lower the gate's strictness to reduce NO_GO rates; instead, fix the upstream generation or retrieval issues that are causing the failures.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the exact fields, types, and validation rules for the structured JSON output of the Pre-Release Answer Fact-Check Gate Prompt. Use this contract to parse the model response and implement automated pass/fail gating.

Field or ElementType or FormatRequiredValidation Rule

gate_decision

enum: ["PASS", "BLOCK"]

Must be exactly PASS or BLOCK. If any check fails, decision must be BLOCK.

overall_confidence_score

number (0.0 to 1.0)

Must be a float between 0.0 and 1.0. Represents aggregate confidence across all checks.

failure_report

array of objects

Must be an array. Can be empty if gate_decision is PASS. Each object must conform to the failure_item schema.

failure_item.failure_type

enum: ["UNSUPPORTED_CLAIM", "CONTRADICTION", "INVALID_CITATION", "MISSING_CITATION", "FABRICATED_SOURCE"]

Must be one of the specified enum values. Used for routing and metric aggregation.

failure_item.severity

enum: ["CRITICAL", "HIGH", "MEDIUM", "LOW"]

Must be one of the specified enum values. CRITICAL failures should independently trigger a BLOCK.

failure_item.offending_text

string

Must be an exact, verbatim substring from the generated answer under review. Null or empty string is invalid for a failure.

failure_item.source_evidence_quote

string or null

If failure_type is CONTRADICTION or INVALID_CITATION, must contain the conflicting source text. Otherwise, can be null.

failure_item.rationale

string

Must be a non-empty string explaining why the failure was flagged, referencing specific evidence or the lack thereof.

PRACTICAL GUARDRAILS

Common Failure Modes

The Pre-Release Answer Fact-Check Gate is a composite prompt that runs multiple checks in a single pass. These are the most common ways it breaks in production and how to guard against them.

01

Composite Instruction Bleed

Risk: When multiple verification tasks (unsupported claims, contradictions, citation validity) are packed into one prompt, the model may confuse the output schemas, apply the wrong standard to a check, or skip a verification step entirely. Guardrail: Assign each check a distinct, labeled section in the output schema. Use explicit section headers and require the model to populate every section, even if empty. Validate structural completeness before interpreting results.

02

False Negatives on Paraphrased Support

Risk: The gate flags a claim as unsupported because the source evidence uses different wording, even though the meaning is faithfully preserved. This causes good answers to be blocked unnecessarily. Guardrail: Include explicit instructions that semantic equivalence counts as support. Add few-shot examples showing paraphrased claims marked as 'supported' with a rationale explaining the semantic match. Calibrate with a golden set of paraphrased claims.

03

Citation Format Mismatch

Risk: The answer uses citation formats (e.g., [Doc 3]) that do not match the evidence identifiers provided in the prompt (e.g., source_id: 'doc_3'). The gate incorrectly reports valid citations as invalid because it cannot resolve the reference. Guardrail: Normalize citation formats before the gate runs. Pass a mapping table of citation aliases to source IDs. Instruct the gate to resolve citations using the provided mapping before judging validity.

04

Go/No-Go Threshold Drift

Risk: The gate's final recommendation becomes inconsistent across runs. A borderline answer with one minor unsupported detail may receive 'go' in one run and 'no-go' in another, eroding trust in the automated gate. Guardrail: Define explicit, quantitative thresholds in the prompt (e.g., 'No-go if any claim is classified as fabrication or if more than 2 claims are unsupported'). Use a separate deterministic rule on the structured output to make the final decision, rather than relying on the model's free-text recommendation.

05

Context Window Truncation

Risk: The full answer plus all retrieved evidence plus the composite gate instructions exceed the model's context window. The model silently drops evidence passages from the end, then flags claims as unsupported because the supporting evidence was truncated. Guardrail: Measure token counts before invoking the gate. If the combined input exceeds the safe limit, either split the verification into multiple passes over subsets of evidence or use a longer-context model. Log a warning if truncation is detected.

06

Overly Conservative Abstention

Risk: The gate becomes too strict, flagging every hedged or probabilistic statement as unsupported. Answers that appropriately express uncertainty are blocked, forcing the system into silence even when it has useful, qualified information. Guardrail: Distinguish between 'unsupported fabrication' and 'appropriately qualified inference' in the gate instructions. Provide examples of acceptable hedged language (e.g., 'The evidence suggests...', 'Based on the available documents...') that should pass the gate when grounded.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Pre-Release Answer Fact-Check Gate Prompt before deploying it as a production guardrail. Each criterion targets a specific failure mode that can allow hallucinated or unsupported answers to reach users.

CriterionPass StandardFailure SignalTest Method

Unsupported Claim Detection

All claims in [ANSWER] not grounded in [CONTEXT] are flagged in the failure report with exact text spans

The gate returns go/no-go: 'go' when an unsupported factual assertion is present in the answer

Run 20 answers with known unsupported claims; verify 100% are flagged and receive 'no-go'

Contradiction Detection

Every statement in [ANSWER] that directly contradicts [CONTEXT] appears in the failure report with the conflicting source passage quoted

A contradiction is present but the report lists zero contradictions or mislabels it as supported

Inject 10 answer-context pairs with deliberate contradictions; verify all contradictions are caught and correctly attributed

Citation Validity Check

Every citation in [ANSWER] is verified against [CONTEXT]; fabricated citations or citations attached to unsupported claims are flagged

A citation to a real document is accepted even though the cited passage does not support the attached claim

Provide answers with 5 valid and 5 invalid citation-claim pairs; confirm all invalid pairs are flagged

Go/No-Go Decision Accuracy

The gate outputs 'go' only when zero unsupported claims, zero contradictions, and zero invalid citations are detected

The gate outputs 'go' when any failure category has unresolved findings

Run 50 golden answer-context pairs with known ground-truth labels; measure false-go rate (target: 0%)

Failure Report Completeness

The failure report includes: claim text, failure type, source passage (if applicable), and severity for every detected issue

The report omits required fields or lists issues without specifying the exact claim text that failed

Parse 30 failure reports; validate schema completeness and field population for every flagged issue

Multi-Check Execution

All three checks (unsupported claims, contradictions, citation validity) execute and produce results in a single pass

One check category silently returns empty results while another correctly identifies failures

Submit answers with failures in all three categories simultaneously; verify all three appear in the report

Edge Case: Fully Supported Answer

The gate returns 'go' with an empty or explicitly null failure report when the answer is fully grounded

A fully supported answer triggers a false positive flag or returns 'no-go'

Run 15 answers where every claim is directly supported by [CONTEXT]; verify 100% receive 'go'

Edge Case: Empty Context

The gate returns 'no-go' when [CONTEXT] is empty or null, with failure type 'insufficient evidence'

The gate returns 'go' or crashes when [CONTEXT] is empty

Submit requests with null and empty string [CONTEXT]; verify consistent 'no-go' with appropriate failure reason

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base composite prompt but reduce the output schema to a single go/no-go field and a free-text summary. Skip the structured failure report. Use a single model call with all checks inline.

code
[SYSTEM]
You are a final answer reviewer. Review the [ANSWER] against the [SOURCE_EVIDENCE].
Return JSON: {"approved": boolean, "summary": "string"}

Watch for

  • The model approving answers with minor unsupported claims because the schema is too loose
  • No separation between contradiction checks and citation checks, so failures blend together
  • Skipping the evidence sufficiency gate means you may approve answers built on empty context
Prasad Kumkar

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.