Inferensys

Prompt

Post-Generation Fact Audit Prompt

A practical prompt playbook for using Post-Generation Fact Audit Prompt in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user, required context, and when not to use this prompt.

This prompt is designed for observability pipelines and production monitoring systems that need to audit a complete model response against its source context. The primary job-to-be-done is automated, systematic verification: you have a generated answer and the exact context it was supposed to use, and you need a machine-readable report confirming which claims are supported, which are fabricated, and how severe each finding is. The ideal user is an AI reliability engineer, a platform developer, or an MLOps practitioner embedding this audit as a post-generation gate before a response reaches a user or a compliance log. You should use this prompt when the cost of an undetected hallucination is high—such as in regulated industries, customer-facing accuracy guarantees, or internal decision-support tools—and when you can tolerate the latency of an asynchronous audit step.

To use this prompt effectively, you must provide two concrete inputs: the full model response to audit, and the complete source context that was available to the model at generation time. The prompt performs a claim-by-claim decomposition, mapping each atomic statement in the response back to the evidence. It then produces a structured output including a hallucination rate, a severity classification for each unsupported claim (e.g., minor, major, critical), and specific correction targets. This is not a real-time correction loop; it is a post-hoc audit. Do not use this prompt inside a synchronous user-facing request path where sub-second latency is required. Instead, run it asynchronously, log the results, and trigger alerts or downstream correction workflows based on the audit findings.

There are clear boundaries where this prompt is the wrong tool. If you need to prevent hallucination at generation time rather than detect it afterward, use a Context-Only Answer Constraint Prompt instead. If you need to immediately correct a flagged response and return it to a user, pair this audit with a Grounded Answer Regeneration Prompt in a retry harness. If your source context is a large, multi-document retrieval set with conflicting information, consider running a Source Conflict Resolution Prompt first, then auditing the reconciled answer. Finally, if you lack a reliable ground-truth context—for example, auditing a model's free-form creative writing or open-domain knowledge—this prompt will produce unreliable results because it cannot distinguish between correct world knowledge and hallucination without a provided evidence baseline. In high-risk domains such as healthcare, finance, or legal, always route audit findings through a Human-in-the-Loop Fact Review Prompt before taking action on the corrections.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Post-Generation Fact Audit Prompt delivers reliable value and where it creates more risk than it solves. Use these cards to decide if this prompt belongs in your observability pipeline.

01

Good Fit: Production Observability Pipelines

Use when: you have a steady stream of model outputs and their source context flowing through a monitoring system. The prompt excels at systematic, claim-by-claim auditing at scale. Guardrail: pair with a sampling strategy—audit a percentage of traffic rather than every response to manage latency and cost.

02

Good Fit: Regression Testing Before Model Updates

Use when: you are migrating models or changing RAG retrieval parameters and need to measure factual accuracy impact. The structured hallucination rate and severity classification give you a comparable metric across versions. Guardrail: run against a fixed golden dataset of 50-200 known cases, not ad-hoc samples.

03

Bad Fit: Real-Time User-Facing Correction

Avoid when: you need to fix a hallucinated answer before the user sees it. This prompt is designed for post-hoc audit and reporting, not low-latency correction loops. Guardrail: use the Grounded Answer Regeneration Prompt or Retry Prompt for Ungrounded Statements for inline repair instead.

04

Bad Fit: Short or Single-Claim Responses

Avoid when: the model output is a single sentence, a classification label, or a yes/no answer. The claim extraction step produces unreliable results on very short texts with no internal structure. Guardrail: gate the audit prompt behind a minimum output length check (e.g., >50 tokens) and route short outputs to a simpler verification path.

05

Required Inputs: Source Context Is Mandatory

Risk: running this prompt without the original source context that the model used produces meaningless results. The audit cannot distinguish hallucination from correct external knowledge. Guardrail: enforce that the [SOURCE_CONTEXT] placeholder is populated and non-empty before invoking the prompt. Log and alert on missing context.

06

Operational Risk: Audit Drift Over Time

Risk: the prompt's severity classification thresholds may drift as your product's tolerance for factual errors changes or as new failure patterns emerge. Guardrail: review audit reports monthly and recalibrate severity definitions. Maintain the prompt under version control with changelog entries when thresholds shift.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for auditing a model response against its source context, producing a structured hallucination report suitable for observability pipelines.

This template is designed to be wired into a post-generation validation harness. After your primary model produces a response, this prompt instructs a secondary audit model to systematically cross-check every factual claim against the provided source context. The output is a structured JSON report that includes a hallucination rate, severity classifications, and specific correction targets, making it directly ingestible by monitoring dashboards, alerting systems, or downstream repair loops.

text
You are a meticulous fact-auditor. Your task is to analyze a model-generated response against a provided source context. Perform a systematic, claim-by-claim audit and produce a structured report.

## INPUT
**Source Context:**
[SOURCE_CONTEXT]

**Model Response to Audit:**
[MODEL_RESPONSE]

## AUDIT INSTRUCTIONS
1. **Extract Claims:** Decompose the Model Response into a list of discrete, verifiable factual claims. Ignore opinions, stylistic phrasing, and purely structural sentences.
2. **Verify Each Claim:** For each claim, determine its relationship to the Source Context:
   - **SUPPORTED:** The claim is directly stated in or can be trivially inferred from the Source Context.
   - **UNSUPPORTED:** The claim introduces new information not found in the Source Context.
   - **CONTRADICTED:** The claim directly conflicts with information in the Source Context.
3. **Classify Severity:** For UNSUPPORTED and CONTRADICTED claims, assign a severity:
   - **CRITICAL:** The claim changes a core fact, entity, number, or timeline.
   - **MINOR:** The claim is a non-material detail or plausible but unverified elaboration.
4. **Calculate Hallucination Rate:** (Number of UNSUPPORTED claims + Number of CONTRADICTED claims) / Total Number of Claims.

## CONSTRAINTS
- Do not use external knowledge. Base your audit strictly on the provided Source Context.
- If the Source Context is empty or insufficient to verify a claim, classify it as UNSUPPORTED with a note.
- If the Model Response is empty or contains no factual claims, report a hallucination rate of 0 and an empty claims list.

## OUTPUT_SCHEMA
You must respond with a single JSON object conforming to this structure:
{
  "audit_result": {
    "total_claims": <integer>,
    "supported_claims": <integer>,
    "unsupported_claims": <integer>,
    "contradicted_claims": <integer>,
    "hallucination_rate": <float between 0.0 and 1.0>,
    "claims": [
      {
        "claim_text": "<exact text of the claim from the response>",
        "verdict": "SUPPORTED | UNSUPPORTED | CONTRADICTED",
        "severity": "NONE | CRITICAL | MINOR",
        "source_evidence": "<exact quote from Source Context or 'NONE FOUND'>",
        "correction_target": "<suggested correction or null if SUPPORTED>"
      }
    ],
    "summary": "<one-sentence summary of the audit findings>"
  }
}

To adapt this template, replace [SOURCE_CONTEXT] with the retrieved documents or ground-truth data provided to the primary model, and [MODEL_RESPONSE] with the text you need to audit. For high-risk domains, ensure the OUTPUT_SCHEMA is validated by your application layer before the report is acted upon. If the audit model itself produces malformed JSON, use a separate output repair prompt to fix the structure before parsing. For production observability, log the hallucination_rate and severity counts as metrics, and trigger an alert if the rate exceeds a predefined threshold, such as 0.1.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Post-Generation Fact Audit Prompt. Each placeholder must be populated before the audit prompt is called. Missing or malformed inputs will cause the audit to fail silently or produce unreliable hallucination scores.

PlaceholderPurposeExampleValidation Notes

[MODEL_OUTPUT]

The complete model-generated text to audit for factual accuracy

The Acme 3000 was released in 2021 and supports 4K resolution at 120fps. It is the market leader in North America.

Required. Must be non-empty string. Truncate at 32K tokens if longer. Strip trailing whitespace before passing.

[SOURCE_CONTEXT]

The ground-truth evidence against which claims are verified

Product spec: Acme 3000, released Q3 2022, supports 4K at 60fps. Market share report: Acme holds 12% NA share, behind BetaCorp at 34%.

Required. Must be non-empty string. If multiple sources, concatenate with source labels. Null context triggers immediate escalation without audit.

[AUDIT_GRANULARITY]

Controls whether audit operates at sentence, claim, or entity level

claim

Required. Enum: sentence, claim, entity. Defaults to claim if omitted. Entity mode requires [ENTITY_TYPES] to be populated.

[ENTITY_TYPES]

List of entity classes to extract and verify when [AUDIT_GRANULARITY] is entity

["date", "quantity", "product_name", "market_claim"]

Required only when [AUDIT_GRANULARITY] is entity. Must be valid JSON array of strings. Empty array treated as no entity filter.

[SEVERITY_THRESHOLD]

Minimum severity level for including a finding in the report

minor

Required. Enum: critical, major, minor, all. Critical flags only fabricated core facts. Major includes unsupported quantitative claims. Minor includes imprecise but not fabricated details.

[OUTPUT_SCHEMA_VERSION]

Schema version for the structured audit report format

2.1

Required. String. Currently supports 2.0 and 2.1. Version mismatch triggers schema validation error before audit begins.

[MAX_CLAIMS]

Upper bound on number of claims to extract and audit

50

Optional. Integer. Defaults to 100 if omitted. Set lower for latency-sensitive pipelines. Claims beyond this limit are noted in report metadata as unaudited.

[RETRY_CONTEXT]

Previous audit results and correction history when this is a re-audit after regeneration

null

Optional. Object or null. If present, must include prior_audit_id, prior_hallucination_rate, and corrected_sections array. Null on first audit attempt.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Post-Generation Fact Audit Prompt into an observability or monitoring pipeline.

The Post-Generation Fact Audit Prompt is designed to operate as a post-hoc validation step within an AI observability pipeline, not as a real-time user-facing feature. It should be invoked after a primary model response is generated and before the response is delivered to the user or logged as final. The harness must provide the audit prompt with the complete original response and the exact source context that was available to the primary model. Without strict context isolation—ensuring the audit model sees only the same evidence the primary model had—the audit loses its diagnostic value and may flag correct external knowledge as hallucination.

Wire the prompt into an asynchronous validation worker that consumes from a response queue. The worker should: (1) deserialize the primary response and its grounding context; (2) format the audit prompt with [RESPONSE], [CONTEXT], and [AUDIT_SCHEMA]; (3) call a separate, potentially cheaper or faster model for the audit step; (4) parse the structured audit report; and (5) write the audit result to an observability store alongside the original response. Implement a retry budget of 2 for audit parsing failures—if the audit model returns malformed JSON, retry with a stricter schema instruction before escalating. Log both the raw audit output and the parsed report for traceability.

For production monitoring, attach the audit report's hallucination_rate and severity_distribution fields as metrics to your existing observability platform (e.g., Datadog, Grafana, or a custom dashboard). Set alert thresholds based on rolling windows: a spike in critical severity claims or a sustained hallucination_rate above a defined baseline should trigger an on-call notification. Store the per-claim audit details in a queryable log for offline pattern analysis. Do not use the audit prompt to automatically block or rewrite responses unless you have a human-in-the-loop review step for high-severity findings; the audit model itself can hallucinate, and automated suppression based on a second model's judgment creates a new failure mode. Instead, use the audit output to prioritize manual review queues and feed correction examples back into your primary prompt engineering cycle.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the structured audit report produced by the Post-Generation Fact Audit Prompt. Use this contract to validate the model's output before downstream consumption.

Field or ElementType or FormatRequiredValidation Rule

audit_id

string (UUID v4)

Must parse as valid UUID v4. Reject if missing or malformed.

audit_timestamp

string (ISO 8601)

Must parse as valid ISO 8601 datetime. Reject if unparseable or in the future beyond a 5-minute clock skew tolerance.

original_response_id

string

Must match the ID of the response being audited. Reject if null or empty.

total_claims_extracted

integer

Must be a non-negative integer. Reject if negative, null, or non-integer. Must equal the length of the claims array.

claims

array of objects

Must be a JSON array. Reject if missing, null, or empty when total_claims_extracted > 0. Each element must conform to the claim object schema.

claims[].claim_id

string

Must be unique within the claims array. Reject if duplicate or empty.

claims[].claim_text

string

Must be a non-empty string containing the verbatim claim from the original response. Reject if empty or whitespace-only.

claims[].verdict

string (enum)

Must be one of: SUPPORTED, UNSUPPORTED, CONTRADICTED, UNCERTAIN. Reject on any other value.

claims[].source_evidence

array of strings

Required when verdict is SUPPORTED or CONTRADICTED. Each string must be a direct quote from the provided source context. Reject if empty array when required.

claims[].severity

string (enum)

Must be one of: CRITICAL, HIGH, MEDIUM, LOW. CRITICAL applies to fabricated numbers, dates, names, or legal/medical claims. Reject on invalid enum value.

claims[].correction_target

string or null

Required when verdict is UNSUPPORTED or CONTRADICTED. Must be a corrected statement grounded in source context. Allow null when verdict is SUPPORTED.

hallucination_rate

number (float, 0.0 to 1.0)

Must be a float between 0.0 and 1.0 inclusive. Calculated as unsupported_claims / total_claims. Reject if outside range or non-numeric.

critical_finding_count

integer

Must be a non-negative integer. Must equal the count of claims with severity CRITICAL. Reject on mismatch.

audit_summary

string

Must be a non-empty string summarizing key findings. Reject if empty or whitespace-only.

requires_human_review

boolean

Must be true if critical_finding_count > 0 or hallucination_rate exceeds the configured threshold. Reject if non-boolean.

PRACTICAL GUARDRAILS

Common Failure Modes

Post-generation fact audits fail in predictable ways. These are the most common production failure modes and the guardrails that prevent them.

01

Claim Extraction Misses Compound Statements

What to watch: The audit prompt treats a sentence with multiple factual claims as a single unit, passing it when one part is supported and another is fabricated. Guardrail: Add an explicit instruction to decompose compound sentences into atomic claims before verification, and require per-claim pass/fail scoring.

02

Audit Accepts Plausible-Sounding Fabrications

What to watch: The model performing the audit hallucinates during verification, confirming a fabricated claim because it sounds reasonable or matches the model's own parametric knowledge rather than the provided context. Guardrail: Constrain the audit prompt to verify claims exclusively against the provided source context, with an explicit rule that parametric knowledge must not override context evidence.

03

Severity Classification Collapses to Binary

What to watch: Every flagged claim gets marked as high severity, making it impossible to prioritize corrections or decide between auto-retry and human escalation. Guardrail: Define a severity rubric with concrete criteria: critical (fabricated entity or number), major (unsupported causal claim), minor (imprecise but not false). Require the audit output to include severity justification.

04

Context Boundary Confusion

What to watch: The audit prompt fails to distinguish between claims grounded in provided context, claims that require external knowledge, and claims that are reasonable inferences. This produces false positives when the model flags legitimate synthesis as hallucination. Guardrail: Add a claim classification layer: supported-by-context, supported-by-inference (with inference chain), unsupported, and contradicted-by-context. Only the last two are true failures.

05

Audit Report Drift Under High Claim Volume

What to watch: When the source response contains many claims, the audit prompt loses discipline after the first few verifications, skipping claims, merging them, or producing inconsistent severity judgments. Guardrail: Structure the output schema as a fixed array of claim-audit objects with required fields. Add a count validation step that compares the number of extracted claims to the number of audit entries and triggers a retry on mismatch.

06

Correction Targets Are Vague or Unactionable

What to watch: The audit identifies a hallucination but the correction target is a generic instruction like 'remove the unsupported claim' rather than a specific replacement grounded in context. Guardrail: Require each correction target to include the exact text span to replace, the replacement text drawn from context, and a null replacement when the claim should be removed entirely with no substitute.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Post-Generation Fact Audit Prompt before shipping to production. Each criterion targets a specific failure mode in claim extraction, evidence matching, severity classification, or report structure. Run these checks against a golden dataset of 20-50 known-correct and known-hallucinated response pairs.

CriterionPass StandardFailure SignalTest Method

Claim Extraction Completeness

All discrete factual claims in [MODEL_RESPONSE] are extracted with no omissions and no merged claims

Missing claims or multiple facts combined into a single claim entry

Compare extracted claim count against human-annotated ground truth; require recall >= 0.95

Claim-to-Evidence Mapping Accuracy

Each extracted claim is mapped to the correct [SOURCE_CONTEXT] passage with exact span offsets

Claims mapped to wrong source passage or offset range does not contain the supporting evidence

Validate span offsets against source text; require precision >= 0.90 on mapping alignment

Hallucination Detection Sensitivity

All unsupported claims are flagged with hallucination=true and assigned a severity classification

Fabricated claim marked as supported or hallucination field left null for unverifiable claims

Run against dataset with known fabrications; require detection recall >= 0.92

Severity Classification Consistency

Severity labels follow the defined taxonomy: CRITICAL for fabricated entities/dates, HIGH for unsupported quantities, MEDIUM for inferred but unverified claims, LOW for minor paraphrasing drift

Same type of hallucination receives different severity labels across audit runs

Run audit 3 times on same input; require severity label agreement >= 0.95 across runs

Correction Target Specificity

Each flagged claim includes a specific correction_target field with the exact text span to replace and suggested grounded alternative or abstention marker

Correction target is vague, missing, or suggests replacement text not grounded in [SOURCE_CONTEXT]

Check that correction_target.span matches claim boundaries and correction_target.suggested_text is substring of source or null for abstention

Hallucination Rate Calculation Correctness

hallucination_rate = (hallucinated_claims / total_claims) computed accurately with both numerator and denominator reported

Rate miscalculated, denominator excludes claims, or rate reported without raw counts

Parse output fields; verify arithmetic matches extracted claim counts; require exact match

Report Structure Schema Compliance

Output matches [OUTPUT_SCHEMA] exactly: all required fields present, no extra fields, correct types, valid enum values

Missing required field, wrong type, extra undeclared field, or invalid enum value in severity or status fields

Validate output against JSON Schema; require zero schema violations

Abstention Handling for Insufficient Context

When [SOURCE_CONTEXT] contains no relevant evidence for a claim, the claim is flagged with evidence_found=false and hallucination=true without fabricating a correction

Model invents supporting evidence from training data or marks unsupported claim as supported when context is empty

Test with empty or irrelevant [SOURCE_CONTEXT]; require hallucination=true for all claims and correction_target.suggested_text=null

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a small sample of 10-20 responses. Remove the severity classification and hallucination rate calculation to keep the output simple. Focus on claim extraction and binary supported/unsupported flags. Use a lightweight JSON schema without required fields for the audit report.

code
Audit the following response against the provided context.
For each factual claim, mark it as [SUPPORTED] or [UNSUPPORTED].
Do not calculate rates or severity.

Context: [CONTEXT]
Response: [RESPONSE]

Watch for

  • Over-auditing stylistic choices as factual claims
  • Missing claims that are implied rather than stated
  • Treating inferences as unsupported when they are reasonable summaries
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.