Inferensys

Prompt

Source Attribution Completeness Check Prompt

A practical prompt playbook for using Source Attribution Completeness Check Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user, required context, and when not to use the source attribution completeness check prompt.

This prompt is designed for RAG developers and quality engineers who need to validate citation coverage in production traces. It reviews a single trace containing the user query, the generated answer, and all retrieved source chunks. The prompt extracts every factual claim from the answer, maps each claim to supporting citations, and flags claims that lack source backing. The output is an attribution coverage score with specific locations of unsupported statements. Use this prompt when you need to quantify how much of a generated answer is grounded in retrieved evidence, when you are debugging hallucination complaints, or when you are building automated quality gates that reject answers with insufficient citation coverage.

This prompt assumes the trace already contains the full retrieved context and the final answer with inline citations. It does not perform retrieval itself and does not evaluate whether citations are correctly placed, only whether they exist for each claim. The ideal user is someone who already has access to production trace data—either through an observability platform, logging pipeline, or manual trace export—and needs a structured, repeatable way to assess citation completeness at scale. The prompt works best when the answer contains explicit citation markers (e.g., [1], [2]) that reference specific source chunks, but it can also operate on answers without inline citations by performing claim-to-source semantic matching.

Do not use this prompt when you need to verify that a citation actually supports the claim it is attached to—that requires a separate grounding verification prompt that checks the content of the cited source against the claim text. Do not use this prompt when you need to evaluate retrieval quality itself; it only assesses whether claims have citations, not whether the right documents were retrieved. Do not use this prompt on traces where the retrieved context is missing or incomplete, as the coverage score will be artificially low and misleading. For high-stakes domains like healthcare, legal, or finance, always pair this prompt with human review of flagged unsupported claims before taking action on the output.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Source Attribution Completeness Check prompt delivers reliable value and where it introduces risk. Use these cards to decide whether to deploy this prompt in your observability pipeline.

01

Good Fit: RAG Answer Faithfulness Audits

Use when: you need to verify that every factual claim in a generated answer is backed by a retrieved source. This prompt excels at comparing claim-level assertions against the full retrieved context captured in a production trace. Guardrail: pair with a human review step for claims scored below 0.8 confidence to avoid false positives on implicit knowledge.

02

Good Fit: Pre-Release Citation QA

Use when: validating a RAG pipeline before shipping to production. Run this prompt against a golden dataset of traces to establish baseline attribution coverage scores. Guardrail: define a minimum coverage threshold (e.g., 90%) and block releases that fall below it. Track scores per prompt version.

03

Bad Fit: Creative or Opinion-Based Outputs

Avoid when: the generated answer contains subjective analysis, synthesis, or opinion that cannot be directly attributed to a single source. This prompt will flag legitimate interpretive statements as unsupported. Guardrail: restrict use to fact-dense, citation-required domains like legal, medical, or technical documentation.

04

Bad Fit: Multi-Hop Reasoning Without Intermediate Citations

Avoid when: the model combines facts from multiple sources to reach a conclusion not explicitly stated in any single document. The prompt may penalize valid inference. Guardrail: supplement with a reasoning-trace review prompt that validates the logical chain, not just direct citation matches.

05

Required Input: Complete Production Trace

Risk: running this prompt without the full retrieved context, generated answer, and source metadata produces unreliable scores. Missing chunks lead to false unsupported-claim flags. Guardrail: validate trace completeness before invoking the prompt. Reject traces with truncated context windows or missing retrieval steps.

06

Operational Risk: Claim Extraction Drift

Risk: the model may fail to extract all factual claims from the generated answer, producing an artificially high attribution score by ignoring hard-to-verify statements. Guardrail: spot-check claim extraction against human-annotated traces weekly. If claim recall drops below 95%, recalibrate the extraction step or add few-shot examples.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your trace analysis workflow to audit citation coverage and flag unsupported claims.

This prompt template is designed to be dropped directly into your trace analysis pipeline. It instructs the model to act as an attribution auditor, comparing every factual claim in a generated answer against the source citations provided in the production trace. The output is a structured coverage report, not a free-text critique, making it suitable for automated downstream processing, dashboarding, or triggering a human review queue.

text
You are an attribution auditor. Your task is to review a production trace from a RAG system and determine whether every factual claim in the generated answer is supported by a corresponding source citation.

## INPUT

**User Query:**
[USER_QUERY]

**Generated Answer:**
[GENERATED_ANSWER]

**Retrieved Sources (with citation IDs):**
[RETRIEVED_SOURCES]

## INSTRUCTIONS

1.  **Extract Claims:** Decompose the Generated Answer into a list of discrete, verifiable factual claims. Ignore opinions, stylistic phrasing, and purely transitional language.
2.  **Match Claims to Sources:** For each claim, search the Retrieved Sources for evidence that directly supports it. A claim is supported only if a source explicitly states the fact or the fact can be directly and unambiguously inferred from the source.
3.  **Flag Unsupported Claims:** Identify any claim that cannot be matched to a source. Flag it as "unsupported."
4.  **Flag Contradicted Claims:** Identify any claim that is directly contradicted by a source. Flag it as "contradicted" and cite the contradicting source.
5.  **Calculate Coverage Score:** Calculate an attribution coverage score as `(Number of Supported Claims) / (Total Number of Claims)`.

## OUTPUT_SCHEMA

You must respond with a single JSON object conforming to this schema:

{
  "total_claims": <integer>,
  "supported_claims": <integer>,
  "unsupported_claims": <integer>,
  "contradicted_claims": <integer>,
  "attribution_coverage_score": <float between 0.0 and 1.0>,
  "claim_details": [
    {
      "claim_text": "<exact text of the claim>",
      "status": "supported | unsupported | contradicted",
      "source_citation_ids": ["<list of citation IDs>"],
      "rationale": "<brief explanation of the match or mismatch>"
    }
  ]
}

## CONSTRAINTS

- Base your analysis strictly on the provided text. Do not use outside knowledge.
- If a claim is a paraphrase of a source, it is supported. If it adds new information not in the source, it is unsupported.
- If the Generated Answer contains no factual claims, return an empty `claim_details` array and a score of 1.0.

To adapt this prompt for your specific RAG pipeline, replace the [USER_QUERY], [GENERATED_ANSWER], and [RETRIEVED_SOURCES] placeholders with data from your trace. The [RETRIEVED_SOURCES] should be formatted as a clear mapping of citation IDs to their full text. For high-stakes domains like healthcare or finance, the output of this prompt should be treated as a diagnostic signal, not a final verdict. Always route traces with an attribution_coverage_score below your defined threshold (e.g., 0.9) to a human review queue for manual verification before any action is taken on the information.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required for the Source Attribution Completeness Check Prompt. Validate each placeholder before sending to avoid false attribution scores or hallucinated citation maps.

PlaceholderPurposeExampleValidation Notes

[GENERATED_ANSWER]

The full model-generated response to audit for citation coverage

The primary cause of the outage was a failed deployment at 14:32 UTC [1].

Must be non-empty string. Strip trailing whitespace. Reject if only whitespace or under 10 characters.

[RETRIEVED_CONTEXT]

Complete set of retrieved documents or chunks provided to the model during generation

["doc_1": "Deployment started at 14:30 UTC...", "doc_2": "Monitoring alerts fired at 14:35 UTC..."]

Must be valid JSON array of objects with content fields. Reject if empty array or missing content keys. Validate each chunk has non-empty text.

[CITATION_FORMAT]

Regex or pattern defining how citations appear in the generated answer

[\d+] or [source-\d+]

Must be a valid regex string. Test against known citation patterns before use. Reject if pattern matches zero citations in a known-good sample.

[SOURCE_IDENTIFIER_MAP]

Mapping from citation markers to specific retrieved context chunks

{"1": "doc_1", "2": "doc_3"}

Must be valid JSON object. Keys must match citation format. Values must reference existing chunk IDs in [RETRIEVED_CONTEXT]. Reject if any citation maps to missing chunk.

[MIN_GROUNDING_SCORE]

Threshold below which a claim-to-source match is considered unsupported

0.7

Must be float between 0.0 and 1.0. Default 0.7. Reject if non-numeric or outside range. Lower values increase false positives; higher values increase false negatives.

[OUTPUT_SCHEMA]

Expected JSON structure for the attribution coverage report

{"coverage_score": float, "claims": [{"text": str, "citation": str|null, "grounded": bool, "source_evidence": str|null}]}

Must be valid JSON Schema or example structure. Validate that schema includes coverage_score, claims array, and grounded boolean fields. Reject if schema missing required attribution fields.

[ABSTENTION_FLAG]

Whether the model abstained from answering or refused the query

Must be boolean. If true, skip attribution check and return coverage_score: null with abstention_reason. Reject if non-boolean value provided.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Source Attribution Completeness Check into an automated RAG observability pipeline.

This prompt is designed to run as a post-hoc analysis step in a RAG observability pipeline, not as a real-time guardrail in the user-facing path. It consumes a production trace containing the user query, the final generated answer, and the full list of retrieved source chunks with their identifiers. The output is a structured attribution coverage report that can be logged, aggregated, and used to trigger alerts or re-indexing jobs. Because the analysis is computationally intensive and requires the full context window, it is best executed asynchronously after the user response has been delivered.

To wire this into an application, extract the required inputs from your tracing system (e.g., LangSmith, Arize, or a custom trace store). The [TRACE_INPUT] should be a serialized JSON object containing three fields: query, answer, and sources (an array of objects with source_id and content). Validate the input shape before calling the model—reject traces where the answer is empty or the sources array is missing. On success, parse the model's JSON output and validate that the coverage_score is a float between 0.0 and 1.0, that unsupported_claims is an array, and that each claim includes a claim_text and location_in_answer. If validation fails, retry once with a stricter output schema instruction; if it fails again, log the raw output and flag the trace for manual review. For high-stakes domains like healthcare or legal, always route traces with a coverage_score below a configurable threshold (e.g., 0.8) to a human review queue before any downstream action is taken.

Model choice matters here. Use a model with strong instruction-following and JSON output capabilities, such as gpt-4o or claude-3-5-sonnet, because the task requires precise claim extraction and careful comparison against source text. Avoid smaller or older models that may conflate claims or hallucinate source content during the verification step. Log the coverage_score, the count of unsupported claims, and the specific source_ids that were missing as structured metrics in your observability platform. Over time, aggregate these metrics by knowledge base partition, retrieval configuration, or prompt version to identify systemic attribution gaps. Do not use this prompt as a substitute for human review in regulated workflows; it is a diagnostic tool that surfaces potential problems, not a final arbiter of factual accuracy.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when running source attribution completeness checks on production RAG traces and how to guard against it.

01

Overclaiming Attribution

What to watch: The checker prompt marks a claim as 'cited' when the source only tangentially mentions the topic without actually supporting the specific factual statement. This inflates attribution scores and hides real grounding gaps. Guardrail: Require the checker to quote the exact source sentence that supports each claim. If no sentence can be quoted, the claim must be flagged as unsupported regardless of topical overlap.

02

Citation Boundary Confusion

What to watch: The checker treats a citation marker at the end of a paragraph as covering all preceding claims, even when the source only supports the last sentence. This masks unsupported claims that appear earlier in the paragraph. Guardrail: Require claim-level granularity in the check. Each atomic factual statement must be independently verified against the cited source, not the paragraph as a whole.

03

Implicit Knowledge Leakage

What to watch: The checker accepts claims that are factually correct but unsupported by the retrieved context because the checker itself knows the information from pre-training. This creates a false sense of grounding when the RAG system actually failed to retrieve evidence. Guardrail: Instruct the checker to operate in 'closed-book' mode for verification—only the provided source documents count as evidence. Explicitly forbid using the checker's own world knowledge to validate claims.

04

Paraphrase Mismatch Blindness

What to watch: The checker fails to recognize that a claim is supported because the source expresses the same fact using different terminology, sentence structure, or technical vocabulary. This produces false negatives and underreports attribution coverage. Guardrail: Add a semantic equivalence check step. Before flagging a claim as unsupported, require the checker to attempt a paraphrase match and explain why the source does or does not convey the same meaning.

05

Multi-Source Claim Fragmentation

What to watch: A single claim requires evidence from two different retrieved documents, but the checker only looks for a single source match and flags the claim as unsupported when no single document contains all the evidence. Guardrail: Allow the checker to cite multiple sources for a single claim when the claim combines facts. The output schema should support an array of source references per claim rather than a single citation pointer.

06

Truncated Source Blindness

What to watch: The retrieved source was truncated before reaching the model, so the evidence that would support a claim is missing from the trace. The checker correctly flags the claim as unsupported, but the root cause is a context-window packing issue, not a retrieval failure. Guardrail: Cross-reference attribution gaps with context-window truncation detection. When a claim is flagged as unsupported, check whether the cited source was truncated. If so, classify the failure as a context-window issue rather than a retrieval or generation issue.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Source Attribution Completeness Check Prompt before shipping it into production. Each criterion targets a specific failure mode observed in RAG citation verification. Run these checks against a golden set of annotated production traces where ground-truth attribution labels are known.

CriterionPass StandardFailure SignalTest Method

Claim Extraction Recall

All factual claims in the generated answer are identified and extracted with exact text spans

The prompt misses a verifiable factual statement present in the answer, producing fewer claims than the ground-truth count

Compare extracted claim count against human-annotated claim list from golden trace set; require recall >= 0.95

Citation-to-Claim Mapping Accuracy

Every extracted claim is correctly paired with its supporting citation when evidence exists in retrieved context

A claim is mapped to a citation that does not contain the claimed information, or a supported claim is incorrectly flagged as unsupported

Spot-check 50 random claim-citation pairs against source document text; require precision >= 0.90

Unsupported Claim Detection

Claims without any supporting evidence in the retrieved context are correctly flagged as unsupported with specific missing-fact descriptions

An unsupported claim is incorrectly marked as supported, or the missing-fact description is vague or references a non-existent gap

Compare unsupported claim flags against golden labels; require false-negative rate < 0.05 for unsupported claims

Attribution Coverage Score Calibration

The overall attribution coverage score matches the proportion of supported claims within a 5% tolerance of the ground-truth ratio

The coverage score is inflated by counting weak or irrelevant citations as valid support, or deflated by penalizing correctly attributed claims

Calculate absolute difference between prompt-produced coverage score and ground-truth ratio across 20 traces; require mean absolute error <= 0.05

Missing-Citation Location Precision

Each missing citation is reported with the exact text span location in the answer and the specific factual gap identified

Missing-citation locations point to the wrong sentence, or the gap description is too generic to act on

Validate reported locations against golden annotations; require span overlap >= 0.80 with ground-truth missing-citation spans

False Positive Citation Flagging

No claim that is actually supported by retrieved context is incorrectly flagged as missing a citation

A correctly cited claim is reported as unsupported, inflating the missing-citation count and eroding trust in the check

Count false-positive unsupported flags across golden set; require false-positive rate < 0.03

Retrieved Context Exhaustiveness Check

The prompt confirms whether all retrieved chunks were examined before declaring a claim unsupported, and reports if context truncation may have hidden evidence

A claim is flagged as unsupported but the evidence exists in a retrieved chunk that the prompt failed to examine due to truncation or ordering

Inject traces with known truncation; verify the prompt emits a context-exhaustiveness caveat when evidence may exist outside the examined window

Output Schema Compliance

The prompt output is valid JSON matching the expected schema with all required fields present and correctly typed

Output is malformed JSON, missing required fields, or contains fields with incorrect types that break downstream parsing

Validate output against JSON Schema using a programmatic validator; require 100% parse success rate across test runs

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single trace and lighter validation. Replace strict JSON schema enforcement with a simpler structured text output. Focus on getting the attribution coverage score and a list of unsupported claims without requiring exact byte offsets or citation IDs.

Prompt modification

Remove the [OUTPUT_SCHEMA] block and replace with: Return a coverage score (0-100) and a bullet list of unsupported claims.

Watch for

  • The model may skip claims it considers obvious, producing a falsely high coverage score
  • Without schema validation, output format will drift across runs
  • No baseline comparison makes it hard to know if 80% coverage is good or bad for your use case
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.