Inferensys

Prompt

Citation Accuracy Gate Evaluation Prompt

A practical prompt playbook for using the Citation Accuracy Gate Evaluation Prompt in production RAG workflows to verify source fidelity before release.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the exact job, required inputs, and operational boundaries for the Citation Accuracy Gate Evaluation Prompt.

This prompt is a release gate for RAG system owners and platform engineers who need an automated, structured audit of citation accuracy before promoting a new retrieval pipeline or generation prompt to production. The job-to-be-done is verifying that a generated answer is faithfully grounded in its cited sources, not performing general fact-checking or evaluating the answer's helpfulness in isolation. It assumes you already have the final generated answer and the exact source chunks provided to the model during retrieval. The output is a machine-readable audit report that measures precision, recall, hallucinated sources, and unsupported claims, enabling a data-driven promotion decision.

Use this prompt when you are modifying retrieval logic, changing embedding models, updating chunking strategies, or iterating on the generation prompt itself. It is designed to catch regressions where the model cites a source that does not support the claim, fabricates a source identifier, or makes a statement with no grounding in the provided context. The prompt is not a substitute for human review of sensitive content, nor is it designed for real-time guardrailing on every user request—its cost and latency profile make it best suited for offline evaluation runs against a golden dataset of question-answer-context triplets. Do not use this prompt to evaluate the quality of the retrieval step itself; it only judges whether the generated answer is supported by the sources it was given.

Before running this prompt, ensure you have a structured dataset where each record contains the user query, the final generated answer, and the list of source chunks with their unique identifiers. The prompt expects these as structured inputs and will return a JSON report with per-claim verification status, source-level precision/recall, and a list of unsupported or hallucinated citations. Wire this into your CI/CD pipeline as a blocking gate: if the hallucination rate exceeds your threshold or if any hallucinated source is detected, the release should be halted for human investigation. The next section provides the exact prompt template you can adapt and integrate into your evaluation harness.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Citation Accuracy Gate Evaluation Prompt works, where it fails, and what you must have in place before relying on it as a release gate.

01

Good Fit: RAG Systems with Source Documents

Use when: you have a RAG pipeline that retrieves source documents and generates answers with inline citations. The prompt excels at verifying that each citation points to the correct source span and that no claims float unsupported. Guardrail: always pass the full retrieved context alongside the generated answer so the evaluator can perform span-level verification.

02

Bad Fit: Creative or Opinion-Based Outputs

Avoid when: the output is subjective analysis, marketing copy, or strategic recommendations without a ground-truth source. The prompt will flag legitimate interpretation as unsupported claims, producing false positives. Guardrail: route creative outputs to a different gate (e.g., Qualitative Rubric Gate) and reserve citation accuracy checks for evidence-bound tasks.

03

Required Inputs: Source-Answer Pairs

Risk: running the gate without the original retrieved passages makes hallucinated source detection impossible. The evaluator needs both the generated answer and the exact source chunks provided to the model. Guardrail: implement a harness that captures retrieval results alongside generation outputs before invoking the gate. Missing sources should block the evaluation, not pass it.

04

Operational Risk: Latency and Token Cost

Risk: citation-level verification requires the evaluator model to process every claim-source pair, which multiplies token usage and adds seconds to gate execution. This can bottleneck CI/CD pipelines. Guardrail: set a per-evaluation timeout and token budget. For large answer sets, sample citations rather than exhaustively checking every one, and escalate full audits to async jobs.

05

Operational Risk: Source Chunk Ambiguity

Risk: when retrieved chunks are too short or lack surrounding context, the evaluator may flag a citation as unsupported even though the broader document contains the evidence. Guardrail: include a context window around each retrieved chunk and instruct the evaluator to mark ambiguous cases for human review rather than auto-failing them.

06

Not a Replacement for Human Review in Regulated Domains

Risk: in legal, clinical, or compliance workflows, an automated citation gate can miss subtle misrepresentations or context-shifting errors that a subject-matter expert would catch. Guardrail: treat the gate as a first-pass filter. Escalate any answer with flagged citations or borderline sufficiency scores to a human review queue before promotion.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for evaluating citation accuracy in RAG outputs, ready to paste into your evaluation harness.

This prompt template implements a citation accuracy gate for RAG systems. The model receives the original user query, the final generated answer with inline citation markers, and the full set of source chunks provided during generation. It produces a structured audit report that flags unsupported claims, hallucinated sources, and insufficient evidence. Use this as a release gate before promoting any RAG prompt to production.

code
You are a citation accuracy auditor. Your job is to verify that every citation in a generated answer points to correct and sufficient source material.

## INPUT

**User Query:**
[USER_QUERY]

**Generated Answer with Citations:**
[GENERATED_ANSWER_WITH_CITATIONS]

**Source Chunks Provided During Generation:**
[SOURCE_CHUNKS]

## TASK

For each citation marker in the generated answer, perform the following checks:

1. **Source Existence:** Does the cited source chunk actually exist in the provided source material? If a citation references a source ID or chunk number that is not present, flag it as HALLUCINATED_SOURCE.

2. **Claim Verification:** Extract the specific claim(s) associated with each citation. Compare each claim against the cited source chunk. Determine if the source:
   - FULLY_SUPPORTS the claim
   - PARTIALLY_SUPPORTS the claim
   - CONTRADICTS the claim
   - DOES_NOT_ADDRESS the claim

3. **Evidence Sufficiency:** For each claim, assess whether the cited source provides enough detail to substantiate the claim. Rate as SUFFICIENT, PARTIAL, or INSUFFICIENT.

4. **Unsupported Claims:** Identify any factual claims in the answer that have no citation marker at all. Flag these as UNCITED_CLAIM.

## OUTPUT SCHEMA

Return a JSON object with the following structure:

```json
{
  "audit_summary": {
    "total_citations": <integer>,
    "total_claims": <integer>,
    "hallucinated_sources": <integer>,
    "unsupported_claims": <integer>,
    "uncited_claims": <integer>,
    "overall_precision": <float 0-1>,
    "overall_recall": <float 0-1>,
    "passes_gate": <boolean>
  },
  "per_citation_results": [
    {
      "citation_id": "<string>",
      "citation_text": "<string>",
      "source_chunk_id": "<string or null>",
      "source_exists": <boolean>,
      "claims": [
        {
          "claim_text": "<string>",
          "verification": "FULLY_SUPPORTS | PARTIALLY_SUPPORTS | CONTRADICTS | DOES_NOT_ADDRESS",
          "evidence_sufficiency": "SUFFICIENT | PARTIAL | INSUFFICIENT",
          "source_span_evidence": "<exact text from source that supports or contradicts>"
        }
      ]
    }
  ],
  "uncited_claims": [
    {
      "claim_text": "<string>",
      "location_in_answer": "<string describing where this claim appears>"
    }
  ],
  "hallucinated_sources": [
    {
      "citation_id": "<string>",
      "referenced_source": "<the non-existent source ID or chunk reference>"
    }
  ]
}

GATE CRITERIA

Set passes_gate to true ONLY if ALL of the following are met:

  • hallucinated_sources equals 0
  • overall_precision >= [PRECISION_THRESHOLD]
  • overall_recall >= [RECALL_THRESHOLD]
  • No claim is rated CONTRADICTS
  • No uncited factual claims exist

CONSTRAINTS

  • Do not infer claims the answer does not explicitly make.
  • If a source chunk is ambiguous, rate it as PARTIALLY_SUPPORTS and note the ambiguity.
  • For source_span_evidence, quote the exact text from the source. Do not paraphrase.
  • If the generated answer contains no citations at all, set total_citations to 0 and flag all factual claims as UNCITED_CLAIM.
  • Do not penalize the answer for missing information the user did not request.

Adapt this template by adjusting the GATE CRITERIA thresholds to match your risk tolerance. For high-stakes domains like healthcare or legal, set PRECISION_THRESHOLD and RECALL_THRESHOLD to 1.0 and add a mandatory human review step for any CONTRADICTS finding. For lower-stakes applications, you might accept precision of 0.9 and allow PARTIALLY_SUPPORTS claims to pass. Wire the output into your CI/CD pipeline by parsing passes_gate as a boolean gate signal and surfacing per_citation_results in your evaluation dashboard for manual inspection when the gate fails.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Citation Accuracy Gate Evaluation Prompt needs to work reliably. Validate these before each evaluation run to prevent false positives or missed hallucinations.

PlaceholderPurposeExampleValidation Notes

[GENERATED_RESPONSE]

The full model-generated text containing citations to be audited

According to Smith (2023), the market grew 12% [source: doc_42].

Must be non-empty string. Check for presence of citation markers before running audit; empty response should short-circuit with 'no citations to evaluate'.

[SOURCE_DOCUMENTS]

Complete set of source documents the model had access to during generation

{"doc_42": "Market growth was 12% in Q3...", "doc_87": "Revenue declined..."}

Validate JSON structure with document ID keys and text values. Each cited source ID must exist in this map. Missing source documents cause false hallucination flags.

[CITATION_SPANS]

Pre-extracted citation markers with their claimed source IDs and quoted text

[{"marker": "[source: doc_42]", "source_id": "doc_42", "claimed_text": "market grew 12%"}]

Parse citation markers from response before evaluation. Validate each span has source_id and claimed_text fields. Null claimed_text allowed if citation is positional only.

[EVIDENCE_SUFFICIENCY_THRESHOLD]

Minimum score (0.0-1.0) for a citation to be considered sufficiently supported

0.7

Must be float between 0.0 and 1.0. Default 0.7. Lower values increase false positives; higher values increase false negatives. Log threshold in audit report.

[HALLUCINATION_SEVERITY_LEVELS]

Mapping of hallucination types to severity scores for prioritization

{"fabricated_source": 1.0, "misattributed_claim": 0.8, "insufficient_evidence": 0.5}

Validate JSON object with string keys and float values 0.0-1.0. Missing severity levels should use defaults. Check that all expected hallucination types are covered.

[OUTPUT_SCHEMA_VERSION]

Schema version for the audit report to ensure downstream parsers can consume it

"2.1"

Must match expected schema version in evaluation harness. Mismatch should trigger schema migration or rejection. Validate as semver-compatible string.

[MAX_CLAIMS_PER_DOCUMENT]

Upper bound on claims extracted per source to prevent runaway extraction

50

Integer greater than 0. Default 50. Exceeding this should trigger truncation warning in audit report. Prevents token explosion on large documents.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Citation Accuracy Gate Evaluation Prompt into a CI/CD pipeline as a post-generation evaluation step, not a real-time serving path.

This prompt is designed to run as an offline evaluation gate, not in the real-time RAG serving path. It should be executed after a batch of RAG responses has been generated, typically during a staging or canary evaluation phase. The prompt expects a structured input containing the original user query, the generated response with its citations, and the full source documents or passages that were retrieved. Running this in the serving path would add unacceptable latency and cost; instead, sample a representative subset of production or staging traffic and run the evaluation asynchronously.

To integrate this into a CI/CD pipeline, build a harness that: (1) loads a golden dataset of query-response-source triples or samples from a staging traffic log; (2) calls the evaluation prompt for each sample, passing the query, response, and retrieved sources as structured inputs; (3) parses the JSON output containing per-citation precision/recall scores, unsupported claim flags, and hallucinated source detection; (4) aggregates results into a pass/fail decision based on predefined thresholds (e.g., citation precision below 0.85 triggers a block). Use a model with strong instruction-following and JSON output capabilities, such as gpt-4o or claude-3-5-sonnet, and set temperature=0 for deterministic evaluation. Implement retries with exponential backoff for malformed JSON outputs, and log every evaluation result with the prompt version, model version, and dataset version for auditability.

The harness must include source span verification: for each citation in the response, extract the cited text span from the source document and compare it against what the response claims. If the prompt flags a hallucinated source (a citation that does not exist in the provided sources), the harness should automatically fail that sample and surface it for human review. For evidence sufficiency scoring, set a minimum threshold (e.g., 0.7) below which the response is considered inadequately grounded. Wire the aggregated report into your release gate scorecard, and ensure that any sample with a hallucinated source or unsupported claim count above zero triggers a blocking condition. Do not use this prompt as a substitute for human review on high-stakes domains like healthcare or legal; instead, route flagged samples to a review queue and require human sign-off before promotion.

IMPLEMENTATION TABLE

Expected Output Contract

Each field in the JSON response must pass the validation rules below before the citation audit report is accepted by downstream systems or human reviewers.

Field or ElementType or FormatRequiredValidation Rule

audit_id

string (UUID v4)

Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

overall_score

object

Must contain precision, recall, and sufficiency keys; each must be a float between 0.0 and 1.0 inclusive

citations

array of objects

Array length must equal the number of citations in the source text; empty array allowed only if source text contains zero citations

citations[].source_span

object

Must contain start_char and end_char integer fields; start_char must be less than end_char; both must be non-negative

citations[].verification_status

string (enum)

Must be one of: verified, partially_verified, unsupported, hallucinated_source, or insufficient_evidence

citations[].evidence_match

object

Must contain matched_text string and confidence float between 0.0 and 1.0; matched_text must not be empty when verification_status is verified or partially_verified

unsupported_claims

array of objects

Each object must contain claim_text string, severity enum (minor, moderate, critical), and suggested_correction string or null

hallucinated_sources

array of strings

Each string must be a source identifier that does not appear in the provided source material; empty array if none detected

PRACTICAL GUARDRAILS

Common Failure Modes

Citation accuracy gates break in predictable ways. Here are the most common failure modes when evaluating whether generated citations point to correct and sufficient source material, and how to guard against them.

01

Hallucinated Source Fabrication

What to watch: The model generates plausible-sounding citations with realistic titles, authors, or identifiers that do not exist in the source corpus. This often happens when the model is pressured to provide a citation for every claim but lacks supporting evidence. Guardrail: Implement a strict source-span verification step that requires each citation to resolve to an exact document ID, passage offset, or content hash present in the retrieval index. Flag any citation that cannot be anchored to a real source span as a fabrication and fail the gate.

02

Weak Evidence Sufficiency Scoring

What to watch: A citation points to a real source, but the cited passage does not actually support the claim made. The model may cite a tangentially related paragraph or cherry-pick a sentence that appears relevant out of context. Guardrail: Deploy an evidence sufficiency scorer that compares the generated claim against the full cited passage using natural language inference. Require a minimum entailment score for each claim-citation pair. Claims with contradiction or neutral scores should block the gate and trigger source re-verification.

03

Precision-Recall Imbalance in Citation Coverage

What to watch: The citation gate reports high precision because every cited source is real, but recall is poor because the model omits citations for claims that require support. Alternatively, the model over-cites every sentence, drowning reviewers in low-value references. Guardrail: Define a citation policy that specifies which claim types require evidence. Use a claim extraction step to identify all verifiable assertions, then measure recall as the fraction of required claims that have at least one valid citation. Set minimum recall thresholds per output type.

04

Source Span Mismatch Under Chunking Artifacts

What to watch: The model cites a correct document but points to the wrong passage because the retrieval chunk boundaries split the relevant content across multiple chunks. The citation appears valid at the document level but fails span-level verification. Guardrail: Implement overlapping chunk verification that checks adjacent chunks when a span match fails. Use a passage-alignment scorer that searches within a window around the cited chunk for the best-matching evidence. Flag persistent mismatches as chunking-strategy issues rather than citation failures.

05

Citation Format Drift Across Model Versions

What to watch: A citation gate calibrated on one model version produces clean reports, but after a model upgrade, citation formats change subtly. Brackets become parentheses, identifiers shift, or inline references move to footnotes. The gate's regex or parser breaks silently, producing false negatives. Guardrail: Include format compliance assertions in the gate that validate citation structure against an expected schema before running accuracy checks. Test the gate against a golden dataset of known citation formats across model versions. Fail fast on format violations rather than silently accepting unparseable citations.

06

Unsupported Claim Flag Fatigue

What to watch: The gate correctly flags unsupported claims, but the volume of flags is so high that reviewers ignore them or the gate is tuned down to reduce noise. This happens when the claim extractor is too aggressive, treating every statement as requiring a citation. Guardrail: Classify claims by severity and evidentiary requirement. Only gate on high-severity claims that require mandatory citations. Use a tiered threshold: block on factual claim failures, warn on interpretive claim gaps, and ignore stylistic or transitional statements. Track flag-to-action conversion rates to detect reviewer fatigue.

IMPLEMENTATION TABLE

Evaluation Rubric

Run this rubric against a golden dataset of 20-50 annotated examples to test output quality before shipping the Citation Accuracy Gate Evaluation Prompt itself. Each criterion targets a specific failure mode in citation verification.

CriterionPass StandardFailure SignalTest Method

Citation Precision

Precision >= 0.95 across golden dataset

False positive citations where generated claim references a source that does not support it

Compare each generated citation span to annotated ground-truth source spans; count mismatches

Citation Recall

Recall >= 0.90 across golden dataset

Missing citations for claims that require source grounding per golden annotations

Check each annotated claim in golden dataset for presence of a corresponding citation in output

Unsupported Claim Detection

All unsupported claims flagged with confidence >= 0.85

Generated output fails to flag a claim that golden annotations mark as unsupported by provided sources

Extract [UNSUPPORTED_CLAIMS] array; compare to golden unsupported claim list; measure overlap

Hallucinated Source Detection

Zero hallucinated source IDs in output

Output cites a source ID, URL, or title not present in the input [SOURCE_MATERIAL] list

Parse all citation references; cross-reference against input source inventory; flag any foreign identifiers

Evidence Sufficiency Scoring

Sufficiency score within ±0.1 of golden annotation score for >= 90% of examples

Output assigns HIGH sufficiency when golden annotation says LOW, or vice versa, with deviation > 0.2

Extract [EVIDENCE_SUFFICIENCY_SCORE]; compute absolute difference from golden score; count threshold violations

Source Span Verification

All cited source spans match golden span boundaries within ±2 sentences

Citation points to wrong paragraph, wrong section, or span offset > 2 sentences from golden annotation

Align output citation spans to golden spans using sentence-index mapping; measure boundary deviation

Output Schema Compliance

100% of output fields present with correct types per [OUTPUT_SCHEMA]

Missing required field, wrong type, or extra field not in schema

Validate output against JSON Schema definition; reject on any schema violation

Refusal and Abstention Handling

Correct abstention when [SOURCE_MATERIAL] contains zero relevant evidence

Output fabricates citations or provides unsupported answer instead of returning abstention signal

Run 5 golden examples with empty or irrelevant source material; verify abstention flag is true and no citations are generated

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict JSON output schema with required fields: citation_id, claim_text, source_span_start, source_span_end, verdict (enum: SUPPORTED, PARTIALLY_SUPPORTED, UNSUPPORTED, HALLUCINATED_SOURCE), evidence_snippet, sufficiency_score (0-1). Include retry logic for schema validation failures. Add logging for every evaluation run with trace IDs.

json
{
  "citations": [
    {
      "citation_id": "[CITATION_ID]",
      "claim_text": "[CLAIM]",
      "source_span_start": [CHAR_OFFSET],
      "source_span_end": [CHAR_OFFSET],
      "verdict": "SUPPORTED|PARTIALLY_SUPPORTED|UNSUPPORTED|HALLUCINATED_SOURCE",
      "evidence_snippet": "[EVIDENCE]",
      "sufficiency_score": [0.0-1.0]
    }
  ],
  "unsupported_claims": [{"claim_text": "[CLAIM]", "severity": "MINOR|MAJOR|CRITICAL"}],
  "aggregate_metrics": {"precision": [0.0-1.0], "recall": [0.0-1.0], "hallucination_rate": [0.0-1.0]}
}

Watch for

  • Silent format drift when model changes output structure
  • Missing human review for CRITICAL severity unsupported claims
  • Source span offsets being off-by-one or pointing to wrong document
  • Sufficiency scoring being inconsistent without calibration examples
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.