Inferensys

Prompt

Evidence Grounding Trace Audit Prompt

A practical prompt playbook for using Evidence Grounding Trace Audit Prompt in production AI workflows.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
PROMPT PLAYBOOK

When to Use This Prompt

A diagnostic tool for RAG developers and quality engineers to audit a single production trace for evidence faithfulness by mapping every factual claim to its source.

This prompt is a precision diagnostic tool for RAG developers and quality engineers who need to audit a single production trace for evidence faithfulness. It maps every factual claim in the model's final output to specific retrieved passages or source documents, flags unsupported statements, and identifies citation errors. Use this when a trace shows a suspicious answer, a user reports a hallucination, or you are running a spot check on grounding quality. This prompt assumes you already have a reconstructed trace containing the user query, retrieved context chunks with source identifiers, and the final model output.

This prompt does not replace automated evaluation pipelines; it is a deep-inspection instrument for one session at a time. Do not use it for bulk hallucination scoring across thousands of traces—it is too expensive and verbose for that. Do not use it when the trace is missing retrieval spans or source identifiers, because the audit cannot ground claims without evidence. Do not use it to judge answer quality, tone, or completeness; its only job is to verify whether factual statements are supported by the retrieved context. If you need aggregate metrics, pair this with an LLM judge or evaluation harness that samples traces and applies this prompt as a spot-check step.

Before running this prompt, ensure your trace includes the user query, a list of retrieved context chunks with unique source IDs, and the final model output. If your RAG pipeline re-ranks or summarizes chunks before generation, include the final context window contents, not the raw retrieval results. The prompt will produce a claim-by-claim grounding report. After receiving the output, review any unsupported claims manually, cross-check flagged citation errors against the original sources, and decide whether the trace indicates a retrieval gap, a generation failure, or a citation formatting bug. Use the findings to tighten retrieval, adjust system instructions, or add citation post-processing.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Evidence Grounding Trace Audit Prompt works and where it does not. This prompt is designed for deep-dive quality audits of a single RAG trace, not for real-time guardrails or bulk analysis.

01

Good Fit: Post-Hoc RAG Quality Audits

Use when: you need to audit a single production trace for factual faithfulness after the response is generated. The prompt excels at mapping each claim to specific retrieved passages and flagging unsupported statements. Guardrail: Run this prompt on a sampled subset of traces (e.g., low-confidence responses or user-reported issues) rather than every request to control cost.

02

Bad Fit: Real-Time Guardrails

Avoid when: you need to block a hallucinated response before it reaches the user. This prompt requires the full trace—including the final output—to perform its analysis, so it cannot act as a pre-generation safety net. Guardrail: Pair this audit prompt with a lightweight, pre-generation claim-checking step or a deterministic schema validator for real-time protection.

03

Required Inputs: Complete Trace Data

What to watch: The prompt cannot function without the full trace context, including the user query, retrieved passages with metadata, and the final generated output. Missing retrieval scores or truncated documents will produce an incomplete or misleading audit. Guardrail: Validate trace completeness before invoking the prompt. If the trace is missing spans, route to a trace reconstruction prompt first.

04

Operational Risk: High Token Consumption

What to watch: Auditing a single trace can consume a large context window because the prompt must ingest the full output and all retrieved passages. This makes it expensive for bulk analysis. Guardrail: Use this prompt for targeted investigations, not continuous monitoring. For aggregate metrics, pre-compute grounding scores and use a summarization prompt for trends.

05

Operational Risk: Auditor Model Bias

What to watch: The model running this audit prompt may share similar biases or blind spots as the model that generated the original response, potentially missing subtle hallucinations. Guardrail: Use a different model family for the auditor than the generator when possible, and periodically calibrate the audit prompt against human-annotated grounding labels.

06

Good Fit: Pre-Release Regression Gates

Use when: you are evaluating a new RAG pipeline or prompt version against a golden dataset of traces. The structured claim-by-claim report provides measurable precision and recall metrics for grounding. Guardrail: Integrate the harness's precision/recall scores into your CI/CD pipeline as a release gate, blocking deployment if grounding scores regress below a defined threshold.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-use prompt for auditing a single production trace to verify that every factual claim is grounded in retrieved evidence.

This prompt template is designed to be pasted directly into your LLM interface or trace review tool. It instructs the model to act as a forensic auditor, comparing the final output of a RAG pipeline against the source documents that were present in the context window during that specific request. The goal is to produce a structured, claim-by-claim grounding report that flags unsupported statements, citation errors, and evidence gaps.

text
You are an evidence-grounding auditor. Your task is to analyze a single production trace from a Retrieval-Augmented Generation (RAG) system. You will be given the final model output and the exact set of retrieved source documents that were in the context window.

Your job is to produce a strict, claim-by-claim grounding report. Follow these rules:
1. Decompose the final model output into a list of discrete, verifiable factual claims.
2. For each claim, determine if it is fully supported, partially supported, or unsupported by the provided source documents.
3. For supported claims, you MUST provide the exact text span from the source documents that serves as evidence. Include the source document ID.
4. If a claim is unsupported, flag it as a potential hallucination.
5. If the output contains a citation that points to a source document which does not support the associated claim, flag it as a citation error.
6. Do not use your own world knowledge. Base your judgment ONLY on the provided source documents.

## INPUT DATA

<final_model_output>
[FINAL_OUTPUT]
</final_model_output>

<retrieved_source_documents>
[RETRIEVED_DOCUMENTS]
</retrieved_source_documents>

## OUTPUT FORMAT

Produce a JSON object with the following structure. Do not include any text outside the JSON object.

{
  "audit_summary": {
    "total_claims": <integer>,
    "fully_supported_claims": <integer>,
    "partially_supported_claims": <integer>,
    "unsupported_claims": <integer>,
    "citation_errors": <integer>,
    "overall_grounding_score": <float between 0.0 and 1.0>
  },
  "claims": [
    {
      "claim_id": <integer>,
      "claim_text": "<string>",
      "verdict": "fully_supported | partially_supported | unsupported",
      "evidence": [
        {
          "source_document_id": "<string>",
          "evidence_text": "<exact string from source>"
        }
      ],
      "citation_error": <boolean>,
      "notes": "<string, optional explanation>"
    }
  ]
}

To adapt this template, replace the [FINAL_OUTPUT] and [RETRIEVED_DOCUMENTS] placeholders with data extracted from your trace observability platform. The [RETRIEVED_DOCUMENTS] should be a structured list, where each document has a unique ID and its full text content. For high-stakes domains like healthcare or finance, the notes field in the output is critical for human reviewers to understand the auditor's reasoning. Always run this prompt with a low temperature setting (e.g., 0.0-0.2) to maximize deterministic, repeatable evaluations.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Evidence Grounding Trace Audit Prompt. Each placeholder must be populated from trace data before the prompt is assembled. Validation notes describe how to verify the input is complete and correctly formatted before execution.

PlaceholderPurposeExampleValidation Notes

[FULL_TRACE]

Complete production trace containing all spans: user input, retrieval calls, tool invocations, model outputs, and metadata

{"trace_id": "abc123", "spans": [...]}

Must be valid JSON with required fields: trace_id, spans array. Each span must include span_id, operation_name, start_time, end_time. Reject if spans array is empty or missing retrieval spans when RAG is expected.

[FINAL_OUTPUT]

The model's final generated response delivered to the user, extracted from the last generation span in the trace

"According to the Q3 report, revenue increased 12% year-over-year."

Must be a non-empty string extracted from the output field of the final LLM generation span. Reject if null, empty, or if the span status is error.

[RETRIEVED_CONTEXT]

Array of retrieved passages or documents that were inserted into the context window before generation

[{"doc_id": "doc_42", "passage": "Q3 revenue reached $4.2B...", "score": 0.89}]

Must be an array of objects with at least doc_id and passage fields. Reject if empty when trace indicates retrieval occurred. Validate that passage text is non-empty and doc_id references are resolvable.

[SOURCE_DOCUMENTS]

Full source documents or knowledge base entries available for citation verification, mapped by doc_id

{"doc_42": {"title": "Q3 Earnings Report", "full_text": "..."}}

Must be a map keyed by doc_id with full_text or content field. Reject if any doc_id referenced in RETRIEVED_CONTEXT is missing. Null allowed only when no retrieval occurred in the trace.

[CITATION_FORMAT]

Expected citation style or format specification for the output, defining how claims should reference sources

"[doc_id: chunk_index]" or "(Source: doc_title, Section: 3.2)"

Must be a non-empty string describing the expected citation pattern. Validate that the format is parseable by the downstream citation extraction regex or parser. Reject if format string contains unresolved tokens.

[GROUNDING_THRESHOLD]

Minimum confidence score for a claim to be considered grounded, expressed as a float between 0.0 and 1.0

0.7

Must be a float between 0.0 and 1.0 inclusive. Default to 0.7 if not provided. Reject values outside range. Lower thresholds increase false negatives; higher thresholds increase false positives in unsupported claim detection.

[CLAIM_SCHEMA]

JSON Schema defining the expected structure for each extracted claim in the audit output

{"type": "object", "properties": {"claim_text": {"type": "string"}, "grounding_status": {"enum": ["grounded", "unsupported", "partial"]}}}

Must be a valid JSON Schema object. Validate that required fields include claim_text and grounding_status. Reject if schema is malformed or missing required properties. Null allowed to use default schema.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when auditing evidence grounding in production traces and how to guard against it.

01

Silent Hallucination with High Confidence

What to watch: The model generates a factually incorrect claim that aligns with the retrieved context's topic but is not actually supported by any passage. The output reads fluently, making the hallucination hard to spot without line-by-line verification. Guardrail: Require the audit prompt to output a structured mapping of every factual claim to a specific source span. Flag any claim without a direct quote match as 'unsupported' and route for human review before the output reaches users.

02

Citation Mismatch and Source Confusion

What to watch: The model cites a source that exists in the retrieved context but the cited passage does not actually support the claim. This often happens when multiple documents discuss similar topics and the model conflates them. Guardrail: Include a verification step in the audit prompt that compares the generated claim against the cited passage word-for-word. Use a strict 'entailment' check rather than topical similarity. Flag citation mismatches as errors requiring re-generation or source correction.

03

Missing Evidence Due to Retrieval Gaps

What to watch: The model's output contains claims that are factually true but the retrieved context does not include the necessary evidence. The model may be relying on parametric knowledge rather than the provided sources, violating the grounding contract. Guardrail: The audit prompt must distinguish between 'supported by context' and 'consistent with context but not sourced.' Require an explicit 'evidence found' boolean for each claim. If evidence is missing, flag the retrieval pipeline for inspection rather than blaming the generation step.

04

Over-Abstention on Ambiguous Evidence

What to watch: The model refuses to answer or inserts excessive hedging when the evidence is sufficient but contains minor ambiguity. This degrades user experience and masks retrieval quality issues. Guardrail: The audit prompt should evaluate whether the retrieved context actually supports a clear answer. Include a 'sufficiency score' for each claim. If the context is sufficient but the model abstained, flag as a false refusal and adjust the generation prompt's abstention threshold.

05

Context Window Truncation Silently Dropping Evidence

What to watch: Critical source passages are truncated from the context window due to token limits, but the model still attempts to answer as if the evidence is present. The output may be partially grounded or entirely hallucinated without any indication of missing context. Guardrail: The audit prompt must cross-reference the retrieved document IDs against the documents actually present in the trace's context window. Flag any claim that references a document ID not found in the final packed context. Include a context-budget breakdown in the audit output.

06

Precision-Recall Tradeoff in Grounding Detection

What to watch: The audit prompt itself may have imperfect detection—flagging supported claims as unsupported (false positives) or missing real hallucinations (false negatives). This undermines trust in the audit pipeline. Guardrail: Calibrate the audit prompt against a labeled golden dataset of traces with known grounding labels. Measure precision and recall of the audit prompt's claim-level verdicts. Set operational thresholds for when audit results are reliable enough to automate versus when they require human spot-checking.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Evidence Grounding Trace Audit Prompt before shipping it into your production audit workflow. Each criterion validates a specific failure mode common in RAG faithfulness audits.

CriterionPass StandardFailure SignalTest Method

Claim Extraction Completeness

All factual claims in [OUTPUT] are extracted; no claim is merged or split incorrectly

Missing claims from the output or claims that combine multiple distinct facts into one

Count claims manually in 10 outputs; compare against prompt-extracted claim count; require >=95% recall

Source Passage Alignment Accuracy

Each extracted claim is mapped to the correct [RETRIEVED_PASSAGES] span that supports it

Claim mapped to a passage that does not contain the supporting evidence or mapped to a hallucinated source ID

Spot-check 20 claim-passage pairs; verify the passage contains the claim's fact; require >=90% precision

Unsupported Claim Flagging

Claims with no supporting evidence in [RETRIEVED_PASSAGES] are flagged as UNSUPPORTED with null source

Unsupported claim receives a fabricated source ID or is incorrectly marked as SUPPORTED

Insert 5 outputs with known unsupported claims; verify all are flagged; require 100% detection of injected unsupported claims

Citation Format Compliance

Every SUPPORTED claim includes a valid source_id from [RETRIEVED_PASSAGES] and a direct quote or span reference

Missing source_id, source_id not present in retrieved passages, or quote that does not appear in the cited passage

Validate all source_ids against the passage index; check quote substring match; require 100% format compliance

Grounding Precision Score

Precision = (correctly grounded claims) / (total claims marked SUPPORTED) >= 0.90

Precision below 0.85 indicates the prompt is over-claiming support from irrelevant passages

Run against 50 annotated trace samples with known grounding labels; compute precision; fail if <0.85

Grounding Recall Score

Recall = (correctly grounded claims) / (total groundable claims in output) >= 0.85

Recall below 0.80 indicates the prompt is missing evidence that exists in retrieved passages

Run against 50 annotated trace samples; compute recall; fail if <0.80

Hallucination Resistance

Prompt does not invent source passages, quotes, or facts not present in [RETRIEVED_PASSAGES] or [OUTPUT]

Generated quote contains text not found in any retrieved passage; fabricated passage ID appears in grounding report

Diff all generated quotes against retrieved passage text; flag any substring not present; require zero fabricated content

Schema Adherence Under Edge Cases

Output matches [OUTPUT_SCHEMA] even when [OUTPUT] is empty, [RETRIEVED_PASSAGES] is empty, or claims are all UNSUPPORTED

Missing required fields, null where array expected, or malformed JSON when inputs are edge-case

Test with empty output, empty passages, and all-unsupported claim sets; validate JSON schema; require 100% parse success

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a small sample of 3–5 traces. Replace strict JSON schema enforcement with a looser structured text request. Focus on getting the claim extraction and passage mapping logic right before adding validation harness code.

  • Remove the [OUTPUT_SCHEMA] block and ask for a markdown table instead.
  • Reduce the number of required fields to claim, passage_id, and support_level.
  • Run manually and spot-check 5 outputs before writing any eval script.

Watch for

  • The model skipping claims it considers obvious.
  • Passage IDs that don't match the provided context.
  • Overly verbose justifications that bury the verdict.
PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Evidence Grounding Trace Audit Prompt into a production RAG observability pipeline with validation, retries, and human review gates.

The Evidence Grounding Trace Audit Prompt is designed to be called programmatically as a post-hoc analysis step, not as a real-time user-facing feature. In a production harness, you should trigger this prompt after a user session completes and the full trace—including the user query, retrieved passages, final output, and any intermediate tool calls—has been persisted to your observability store. The prompt expects a structured input payload containing the final generated text and an array of source documents with their identifiers and content. Wire this prompt into an asynchronous job queue (e.g., a background worker or serverless function) that listens for trace-completion events from your inference pipeline. This keeps the audit out of the critical path for user latency while ensuring every session is eventually reviewed.

Before calling the model, validate the input payload against a strict schema. The [OUTPUT_TEXT] field must be a non-empty string, and the [SOURCE_DOCUMENTS] array must contain at least one object with id and content fields. If the trace is incomplete—for example, if the retrieval step failed and returned zero documents—skip the audit and log a trace_incomplete event instead of sending a malformed request. After receiving the model's response, parse the JSON output and validate that every claim object contains the required fields: claim_text, grounding_status (one of SUPPORTED, PARTIALLY_SUPPORTED, UNSUPPORTED), and source_references (an array of source IDs). If the model returns malformed JSON, use a repair prompt with the original schema as context and retry once. If the second attempt also fails, escalate the trace for human review and log the failure for schema drift monitoring.

For high-stakes domains such as healthcare, legal, or finance, do not treat this prompt's output as a final verdict. Route any trace where the UNSUPPORTED claim count exceeds a configurable threshold (e.g., more than 10% of total claims) to a human review queue. Additionally, implement a calibration harness that periodically samples audited traces and has a domain expert label a subset of claims independently. Compare the human labels against the model's grounding_status classifications to measure precision and recall over time. This feedback loop is essential because grounding evaluation is subjective at the margins, and model performance can drift as retrieval pipelines or underlying documents change. Log every audit result—including the trace ID, claim counts, grounding scores, and any human overrides—to your observability platform so you can track grounding quality trends across prompt versions and document corpus updates.

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.