This prompt is designed for a single, high-stakes job: producing a machine-readable map that traces every factual statement in a generated answer back to its exact origin in a source document. The ideal user is a QA engineer, compliance officer, or AI platform architect who needs to prove that an answer is grounded in specific, retrievable evidence, not just that it sounds plausible. The required context is a fully synthesized answer and the complete set of source documents from which it was supposedly derived. The output is not a corrected answer or a simple pass/fail flag; it is a structured provenance map containing document IDs, character offsets, and the verbatim evidence spans that support each claim. This is a post-generation verification step, meaning it runs after an answer is created, and it serves as the auditable evidence foundation for downstream compliance checks, release gates, or regulatory filings.
Prompt
Statement Provenance Tracing Prompt

When to Use This Prompt
Understand the specific job, ideal user, and operational boundaries for the Statement Provenance Tracing Prompt.
You should use this prompt when your operational requirements demand full lineage. For example, in a regulated financial audit, a compliance officer might need to prove that a summary of a quarterly report is not just accurate but is mechanically traceable to specific paragraphs in the original filing. The prompt's output, a JSON object mapping each statement to a source_document_id and char_offset, can be stored as an audit artifact. This is distinct from a citation prompt, which might only add a reference number. Here, the goal is to build a verifiable chain of custody for information. The prompt is designed to be integrated into a validation harness where its output schema is strictly checked; if a statement cannot be traced, the system should flag it for human review rather than silently passing it.
Do not use this prompt as a replacement for answer generation or as a real-time citation formatter for a chat UI. It is too expensive and slow for per-token streaming. It is also not a fact-checking prompt; it assumes the source documents are the ground truth and only verifies if a statement is present in them, not if the source itself is correct. Avoid using it when the source documents are poorly chunked or lack stable identifiers, as the character offsets will be unreliable. The next step after understanding this use case is to examine the prompt template itself, where you will see how to structure the input and enforce the required output schema.
Use Case Fit
Statement Provenance Tracing maps every factual claim in a generated answer back to its exact source passage. This section clarifies where the prompt delivers high value and where it introduces unacceptable risk or cost.
Good Fit: Regulated Audit Trails
Use when: compliance, legal, or clinical reviewers require a verifiable chain of evidence for every output. Guardrail: store the provenance map alongside the answer as an immutable audit artifact.
Good Fit: High-Stakes RAG QA
Use when: answers inform financial, medical, or safety decisions where unsupported claims are unacceptable. Guardrail: gate answer delivery on a minimum provenance coverage threshold (e.g., >95% of claims traced).
Bad Fit: Creative or Open-Ended Generation
Avoid when: the task is summarization, brainstorming, or stylistic rewriting where strict factual attribution is not required. Risk: provenance tracing will flag legitimate paraphrasing as unsupported, creating noisy false positives.
Bad Fit: Real-Time Chat with Latency Budgets
Avoid when: sub-second response times are required. Risk: tracing every claim through a second LLM call doubles latency. Guardrail: use a lighter sentence-level grounding check for latency-sensitive paths.
Required Inputs
Must provide: the full generated answer text and the complete set of retrieved source passages with document IDs and character offsets. Guardrail: validate that source metadata is present before invoking the prompt; missing offsets will cause the trace to fail silently.
Operational Risk: Source Fragmentation
Risk: if retrieval returns overlapping or redundant chunks, the provenance map may point to multiple equivalent sources, confusing auditors. Guardrail: deduplicate and normalize source passages before tracing to ensure each claim maps to a single canonical source span.
Copy-Ready Prompt Template
A copy-ready prompt for tracing every factual statement in a generated answer back to its exact source passage, producing a fully auditable provenance map.
This prompt template is designed for audit and compliance workflows where full lineage is non-negotiable. It instructs the model to decompose a provided answer into discrete factual statements and then map each one to a precise location in the source documents, including document identifiers and character offsets. The output is a structured provenance map, not a revised answer. Use this when you need to prove exactly where every claim came from, such as in regulatory filings, legal briefs, or financial reports. Do not use this prompt for general fact-checking or when approximate source attribution is sufficient; it is intentionally exhaustive and will add latency and token cost.
textYou are an audit-grade provenance tracer. Your task is to decompose a provided answer into individual factual statements and trace each one back to its exact source passage in the provided context documents. You must produce a structured provenance map that makes the answer's evidence foundation fully auditable. ## INPUT **Answer to Trace:** [ANSWER] **Source Documents:** [DOCUMENTS] Each source document is provided with a unique DOCUMENT_ID and the full text. The text includes character offset markers at the start of each line for precision. ## OUTPUT SCHEMA Return a JSON object with the following structure: { "provenance_map": [ { "statement_id": "S1", "statement_text": "The exact factual claim from the answer.", "source_document_id": "DOC-001", "source_passage": "The verbatim text from the source that supports this statement.", "character_offset_start": 145, "character_offset_end": 312, "relationship": "direct_support | partial_support | inference", "confidence": "high | medium | low", "notes": "Optional explanation of the mapping or any ambiguity." } ], "unmapped_statements": [ { "statement_id": "S5", "statement_text": "A factual claim with no supporting source found.", "search_notes": "Description of where the model looked and why no match was found." } ] } ## CONSTRAINTS 1. Decompose the answer into the smallest atomic factual claims. A single sentence may contain multiple statements. 2. For each statement, find the most specific source passage that supports it. Prefer the narrowest span that contains the evidence. 3. Character offsets must be exact and verifiable against the provided source text. 4. If a statement is a direct quote or close paraphrase, mark the relationship as "direct_support". If the source implies the statement but does not state it explicitly, use "inference". If the source supports part but not all of the statement, use "partial_support". 5. If no source passage supports a statement, place it in `unmapped_statements`. Do not guess or fabricate sources. 6. Do not alter the answer text. You are tracing, not editing. 7. If the source documents contain conflicting information for a statement, note the conflict in the `notes` field and include all relevant source passages as separate entries. ## EXAMPLES **Example Statement:** "The company reported revenue of $4.2 billion in Q3 2024." **Source Passage:** "Third-quarter revenue reached $4.2 billion, a 12% increase year-over-year." **Output:** { "statement_id": "S1", "statement_text": "The company reported revenue of $4.2 billion in Q3 2024.", "source_document_id": "EARNINGS-2024-Q3", "source_passage": "Third-quarter revenue reached $4.2 billion, a 12% increase year-over-year.", "character_offset_start": 245, "character_offset_end": 312, "relationship": "direct_support", "confidence": "high", "notes": "Exact match on the revenue figure and quarter." } ## RISK LEVEL **HIGH.** This prompt is used in audit and compliance contexts. Incorrect provenance mappings can lead to regulatory findings, legal liability, or financial misstatements. Always validate a sample of mappings manually before relying on this output for critical decisions.
To adapt this prompt, replace [ANSWER] with the generated text you need to audit and [DOCUMENTS] with your retrieved context, ensuring each document includes a unique ID and character offset markers. The output schema is designed to be machine-readable for downstream automation, such as populating an audit dashboard or triggering a review workflow when unmapped_statements is non-empty. If your source documents do not have character offsets, you can remove those fields from the schema and rely on document ID and passage text alone, but this reduces precision and auditability.
Before deploying this prompt in production, build a validation harness that checks the output JSON against the schema, verifies that character offsets are within bounds, and confirms that statement_text values are substrings of the original answer. For high-stakes use cases, implement a human review step for any statement marked with confidence: low or relationship: inference. The most common failure mode is the model hallucinating source passages or offsets that look plausible but do not exist in the provided documents; always run a programmatic verification of source_passage against the original document text before accepting the provenance map.
Prompt Variables
Required inputs for the Statement Provenance Tracing Prompt. Each variable must be populated before the prompt is assembled and sent to the model. Missing or malformed inputs are the most common cause of silent failures in provenance tracing.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[GENERATED_ANSWER] | The full text of the answer whose factual statements need provenance tracing | The Model 7 processor achieves 3.2 TFLOPS at 45W TDP according to the 2024 spec sheet. | Must be a non-empty string. If the answer is empty, the prompt should be skipped entirely rather than sent with an empty value. |
[SOURCE_DOCUMENTS] | An array of source documents with IDs, full text, and metadata that the answer was generated from | [{"doc_id": "spec-sheet-2024.pdf", "text": "Model 7: 3.2 TFLOPS at 45W TDP...", "metadata": {"page": 4}}] | Must be a valid JSON array with at least one document. Each document object must contain doc_id and text fields. Metadata is optional but strongly recommended for useful offsets. |
[TRACE_GRANULARITY] | Controls whether tracing operates at sentence, clause, or atomic fact level | sentence | Must be one of: sentence, clause, atomic_fact. Default to sentence if not specified. Atomic fact tracing is more expensive and may require a more capable model. |
[INCLUDE_CHARACTER_OFFSETS] | Whether the provenance map should include exact character start and end positions in the source text | Must be true or false. When true, the model must return precise offsets. When false, only document ID and passage text are required. Character offsets increase token usage significantly. | |
[REQUIRED_CONFIDENCE_THRESHOLD] | Minimum confidence score (0.0 to 1.0) for a provenance link to be included in the output | 0.7 | Must be a float between 0.0 and 1.0. Statements with confidence below this threshold should be flagged as unverifiable rather than silently dropped. Use 0.0 to include all links regardless of confidence. |
[OUTPUT_SCHEMA] | The exact JSON schema the provenance map must conform to | {"type": "object", "properties": {"statements": {"type": "array"}}, "required": ["statements"]} | Must be a valid JSON Schema object. The prompt should include this schema inline and instruct the model to validate its output against it before responding. Schema mismatch is a common retry trigger. |
[MAX_SOURCE_DOCUMENTS] | Upper limit on the number of source documents included in the prompt context to prevent token overflow | 20 | Must be a positive integer. If the source document array exceeds this limit, the application layer must truncate or chunk before prompt assembly. Do not rely on the model to handle overflow gracefully. |
Implementation Harness Notes
How to wire the Statement Provenance Tracing Prompt into an audit-grade application pipeline.
The Statement Provenance Tracing Prompt is not a casual chat instruction; it is a deterministic audit tool. It should be deployed as a post-generation verification step within a RAG pipeline, triggered only after a final answer has been synthesized and before it is delivered to the user or logged to an immutable audit store. The harness must treat the prompt as a strict contract: it expects a generated answer and the full set of retrieved source documents (with IDs and character offsets) as input, and it must produce a machine-readable provenance map. Because this workflow is designed for compliance use cases, the implementation must prioritize reproducibility and failure visibility over low latency. The model call should be synchronous in the critical path, with a strict timeout, and any failure to produce a valid provenance map should block the answer from being surfaced.
To wire this into an application, start by constructing the input payload. The [ANSWER] placeholder must receive the exact text that was generated in the previous step, with no truncation or normalization. The [SOURCES] placeholder requires a structured JSON array where each object includes a unique document_id, the full text of the retrieved chunk, and the char_offset range within the parent document. If your retrieval system does not track character offsets, you must add them before invoking this prompt; without precise offsets, the provenance map cannot be audited. The model should be instructed to return a strict JSON schema—an array of objects, each containing a statement string, a source_document_id, and a char_range array of [start, end]. Implement a JSON schema validator in your application layer immediately after the model response. If parsing fails, retry once with a stricter prompt variant that includes the raw model error message. If the retry also fails, log the full payload and escalate for human review rather than silently dropping the provenance check.
For high-risk audit and compliance deployments, you must go beyond schema validation. Implement a secondary verification step that checks whether the char_range offsets in the provenance map actually exist in the referenced source document and that the extracted substring matches the claimed statement. This prevents the model from hallucinating plausible but incorrect offsets. Additionally, compare the set of statements in the provenance map against the original answer using a text segmentation diff; any statement in the answer that is missing from the provenance map represents an untraced claim and must be flagged. Log every provenance map alongside the answer, the source documents, the model version, and the prompt template version in an append-only audit store. Do not rely on the model's internal confidence; the harness is the source of truth for whether tracing succeeded. Finally, expose a monitoring metric that tracks the percentage of answers with complete provenance coverage, and set an alert threshold below 100%—any gap is a potential compliance violation.
Expected Output Contract
Defines the structure, types, and validation rules for the provenance map output. Each row specifies a required or optional field, its expected format, and the concrete validation check to apply before accepting the output.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
provenance_map | Array of objects | Top-level output must be a JSON array. Reject if missing or not an array. | |
provenance_map[].statement | String | Must exactly match a substring of [GENERATED_ANSWER]. Reject if statement text is not found in the answer. | |
provenance_map[].source_document_id | String | Must match a document_id present in [SOURCE_DOCUMENTS] array. Reject if ID is not in the provided source set. | |
provenance_map[].source_passage | String | Must be a verbatim substring of the passage text for the claimed source_document_id. Reject if not found. | |
provenance_map[].char_offset_start | Integer | Must be a non-negative integer. The substring from char_offset_start to char_offset_end in the source passage must equal source_passage. Reject on mismatch. | |
provenance_map[].char_offset_end | Integer | Must be greater than char_offset_start. Combined with char_offset_start, must resolve to the exact source_passage string. Reject on mismatch. | |
provenance_map[].confidence | String enum | If present, must be one of: 'direct_quote', 'strong_paraphrase', 'weak_inference'. Null allowed. Reject on unknown values. | |
provenance_map[].audit_note | String or null | Free text for human review. Null allowed. No structural validation required. |
Common Failure Modes
Statement provenance tracing fails when models hallucinate source mappings, misattribute claims, or produce unparseable offset data. These failure modes break audit trails and undermine compliance workflows.
Hallucinated Source Mappings
What to watch: The model fabricates document IDs, invents passage text, or maps a claim to a source that never existed in the provided context. This is especially common when the context window is large and the model loses track of which documents were actually supplied. Guardrail: Require the model to quote the exact source text verbatim alongside each provenance entry, then run a string-match validator that confirms the quoted text exists in the original context before accepting the mapping.
Character Offset Drift
What to watch: The model reports character offsets that are off by a few characters, lines, or paragraphs, making the provenance map point to the wrong location in the source document. This breaks downstream tooling that relies on exact spans for highlighting or linking. Guardrail: Post-process provenance outputs with a span-verification step that extracts the text at the reported offset range and compares it to the claimed source text. Reject or flag any mapping where the extracted text does not match.
Claim-to-Source Misattribution
What to watch: The model correctly identifies a source passage but attaches it to the wrong claim in the answer, or merges evidence from multiple sources into a single provenance entry without disambiguation. This creates a false audit trail that appears valid on the surface. Guardrail: Structure the prompt to require one provenance entry per claim with an explicit one-to-one mapping. Add a cross-validation step that checks whether the cited passage actually supports the specific claim it is attached to, not just the general topic.
Unparseable Provenance Format
What to watch: The model outputs provenance data in an inconsistent JSON structure, uses unexpected field names, nests objects differently across runs, or wraps the output in markdown fences that break automated parsers. This is a schema-adherence failure, not a factual error. Guardrail: Use a strict JSON schema in the prompt with explicit field definitions and an example of the exact output shape. Implement a schema validator in the application layer that rejects malformed provenance outputs and triggers a retry with the validation error message included.
Incomplete Claim Coverage
What to watch: The model traces some factual statements back to sources but silently omits others, leaving gaps in the provenance map. The audit trail appears complete because no errors are raised, but unsupported claims pass through without traceability. Guardrail: Add a pre-tracing step that extracts all factual claims from the answer first, then require the provenance output to include an entry for every extracted claim. Implement a coverage check that compares the claim list to the provenance entries and flags any claim without a corresponding source mapping.
Source Boundary Confusion
What to watch: When multiple source documents are provided, the model confuses which document a passage came from, assigning the correct text but the wrong document ID or metadata. This is especially likely when documents have similar content or overlapping topics. Guardrail: Prepend each source document with a unique, unambiguous identifier in the prompt context, and instruct the model to use only those identifiers. Implement a post-processing check that verifies the reported document ID exists in the input set and that the quoted text actually appears in that specific document.
Evaluation Rubric
Criteria for testing the Statement Provenance Tracing Prompt before deployment. Each row defines a pass standard, a failure signal, and a concrete test method to validate that the provenance map is complete, accurate, and auditable.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Statement Coverage | Every factual statement in [GENERATED_ANSWER] has a corresponding entry in the provenance map | A factual claim exists in the answer but is missing from the provenance map | Parse the provenance map and extract all statement text spans. Diff against a human-annotated list of factual claims in the answer. Flag any claim with no matching provenance entry. |
Source Grounding Accuracy | Each provenance entry's [SOURCE_DOCUMENT_ID] and [CHARACTER_OFFSET] point to a passage that genuinely supports the statement | A provenance entry cites a source passage that does not contain the claim or contradicts it | For a sample of provenance entries, manually retrieve the cited passage using the document ID and offsets. Verify the passage supports the statement. Fail if support rate drops below 95%. |
Offset Precision | Character offsets in each provenance entry correctly identify the exact supporting span within the source document | Offsets point to an unrelated sentence, are off by more than 50 characters, or are null when a source exists | Automated check: extract the text at the given offsets from the source document. Compute string similarity between the extracted span and the statement. Flag if similarity is below a threshold or if offsets are null for a non-null document ID. |
Document ID Validity | All [SOURCE_DOCUMENT_ID] values in the provenance map match actual document identifiers in the provided [SOURCE_DOCUMENTS] list | A provenance entry references a document ID not present in the input source list | Parse all document IDs from the provenance map. Cross-reference against the input [SOURCE_DOCUMENTS] metadata. Flag any ID not found in the input set. |
Multi-Source Attribution | Statements supported by multiple sources list all relevant [SOURCE_DOCUMENT_ID] and offset pairs | A statement clearly supported by two or more provided sources is attributed to only one | For statements where the test set includes multiple known supporting sources, verify the provenance entry contains all expected document IDs. Flag if any known source is missing. |
Abstention on Unsupported Claims | Statements in the answer that lack source support are marked with a confidence of 'unsupported' or an explicit null source | An unsupported statement is assigned a fabricated source or marked as 'supported' with high confidence | Identify statements in the answer that human reviewers flag as unsupported. Check the corresponding provenance entry. Fail if the entry claims a source or marks confidence as 'high' or 'supported'. |
Output Schema Compliance | The provenance map is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present | The output is missing required fields, contains malformed JSON, or uses incorrect types | Validate the output against the defined JSON schema programmatically. Reject if schema validation fails. Check that statement_text, source_document_id, character_offset_start, character_offset_end, and confidence are all present and correctly typed. |
Confidence Score Calibration | Confidence values in provenance entries correlate with source passage relevance and specificity | High confidence is assigned to statements with vague or tangentially related source passages | Sample provenance entries with high confidence scores. Manually review the cited passages for relevance. Fail if more than 10% of high-confidence entries have weak or irrelevant source support. |
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
Use the base prompt with a single document and a short generated answer. Skip character offsets and use paragraph-level provenance. Replace the strict JSON schema with a simpler markdown table output.
codeFor each factual statement in [ANSWER], identify which paragraph in [DOCUMENT] supports it. Output a table with columns: Statement | Source Paragraph | Confidence (High/Medium/Low). If no source supports a statement, mark it as 'Unsupported'.
Watch for
- Missing schema checks will let malformed provenance maps through
- Overly broad instructions may produce narrative summaries instead of structured traces
- Paragraph-level granularity hides multi-claim paragraphs where only part supports the statement

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