Inferensys

Prompt

Citation Fabrication Detection Prompt

A practical prompt playbook for using Citation Fabrication Detection 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

Defines the job-to-be-done, ideal user, required context, and constraints for the Citation Fabrication Detection Prompt.

This prompt is designed for RAG system operators and security engineers who need to programmatically audit model outputs for fabricated or poisoned citations. The job-to-be-done is not to generate answers, but to act as a secondary evaluator: given a model's final answer and the set of documents actually retrieved, the prompt must identify citations that reference non-existent sources, misrepresent document content, or point to documents that were never in the retrieval set. This is a grounding integrity check, not a content quality review. Use it when you have access to both the generated output and the ground-truth retrieval context, and you need automated, high-recall detection of citation fraud before the answer reaches a user or an audit log.

Do not use this prompt when you lack access to the original retrieved documents or when the model's output does not include explicit citations. It is ineffective for evaluating the factual accuracy of uncited claims—that requires a separate fact-checking workflow. This prompt is also not a replacement for human review in high-risk domains; it is a filtering and triage tool that flags suspicious outputs for escalation. The ideal user is someone who can integrate this prompt into a post-generation validation harness, with clear thresholds for precision (avoiding false accusations of fabrication) and recall (catching actual fabrications). The required inputs are the model's full answer, a structured list of retrieved source chunks with unique identifiers, and a defined output schema for the detection results.

Before deploying this prompt, ensure your retrieval pipeline logs are complete and that every citation in the model's output can be mapped to a source identifier. The prompt's effectiveness depends on the quality of this mapping. If your system allows the model to cite sources by vague references (e.g., 'according to the document'), you must first enforce a strict citation format. After running this detection prompt, route flagged outputs to a human review queue or an automated quarantine. Never use this prompt to automatically delete or suppress content without human confirmation in regulated environments, as false positives can suppress legitimate, well-grounded answers.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Citation Fabrication Detection Prompt delivers value and where it creates noise. This prompt is a diagnostic tool, not a prevention mechanism.

01

Good Fit: RAG Output Auditing

Use when: you need to audit a sample of RAG-generated answers to measure hallucinated or poisoned citation rates. Guardrail: Run this prompt on a statistically significant sample, not every single response, to avoid latency spikes in user-facing paths.

02

Good Fit: Pre-Release Regression Gates

Use when: you are about to ship a new prompt, model, or retrieval config and need to verify citation faithfulness hasn't regressed. Guardrail: Pair this detection prompt with a fixed golden dataset of known good and poisoned source-answer pairs.

03

Bad Fit: Real-Time Guardrails

Avoid when: you need to block a poisoned response before it reaches the user. This prompt analyzes after generation, adding latency. Guardrail: Use lightweight embedding similarity or keyword overlap as a synchronous pre-check; reserve this prompt for async analysis.

04

Bad Fit: Source-Less Generation

Avoid when: the model is not supposed to cite sources or the retrieval step is optional. The prompt will flag all statements as unsupported, generating false positives. Guardrail: Only invoke this prompt when a citation contract is explicitly part of the system instructions.

05

Required Inputs

Risk: Running the prompt without the original retrieved chunks forces the detector to guess what the model saw. Guardrail: Always pass the exact list of retrieved documents or chunks that were in the model's context window, not a cleaned or re-fetched version.

06

Operational Risk: Precision Drift

Risk: Over time, the detector may become too strict or too lenient as model behavior shifts. Guardrail: Continuously log a sample of detection verdicts and have a human reviewer spot-check 50–100 examples per week to recalibrate your acceptance thresholds.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template with square-bracket placeholders for detecting fabricated, misrepresented, or hallucinated citations in RAG-generated answers.

This template provides the core instruction set for a citation fabrication detection prompt. It is designed to be dropped into an evaluation harness that compares a model's answer and its citations against the original retrieved documents. The prompt instructs the evaluator model to check for three failure modes: citations that reference non-existent sources, citations that misrepresent what a source actually says, and claims that lack any supporting citation. Use this template as the foundation for automated quality gates, regression tests, or continuous monitoring of RAG outputs.

text
You are a citation integrity auditor. Your job is to detect fabricated, misrepresented, or hallucinated citations in AI-generated answers.

You will receive:
- [ANSWER]: The AI-generated response that includes citations.
- [CITATIONS]: A list of citation identifiers and the text spans they reference.
- [RETRIEVED_DOCUMENTS]: The full set of retrieved source documents, each with a unique identifier.
- [GROUND_TRUTH_NOTES]: Optional known facts or authoritative references for cross-checking.

Your task:
1. For each citation in [CITATIONS], verify whether the cited document exists in [RETRIEVED_DOCUMENTS].
2. For each existing citation, check whether the cited document genuinely supports the claim it is attached to. Flag any misrepresentation where the document says something different, contradicts the claim, or is irrelevant.
3. Identify any factual claims in [ANSWER] that lack a citation and appear to require one.
4. Identify any citation that references a source outside [RETRIEVED_DOCUMENTS] (fabricated citation).

Output your findings in the following JSON schema:
{
  "citations_evaluated": [
    {
      "citation_id": "string",
      "exists_in_retrieved": true|false,
      "supports_claim": true|false|"partial",
      "misrepresentation_detail": "string or null",
      "fabricated": true|false
    }
  ],
  "uncited_claims": [
    {
      "claim_text": "string",
      "severity": "low"|"medium"|"high",
      "should_have_citation": true|false
    }
  ],
  "overall_fabrication_risk": "none"|"low"|"medium"|"high"|"critical",
  "summary": "string"
}

[CONSTRAINTS]
- Do not invent source identifiers. Only reference documents present in [RETRIEVED_DOCUMENTS].
- If a citation is ambiguous, mark it as "partial" support and explain the ambiguity.
- If [GROUND_TRUTH_NOTES] contradicts a cited document, note the conflict but do not override the citation check.
- Flag any citation that appears to be a plausible but non-existent source (e.g., realistic-looking DOIs, URLs, or document titles not in the retrieved set).
- If the answer contains no citations at all, set overall_fabrication_risk to "none" and note the absence.

[RISK_LEVEL]: [HIGH_RISK_DOMAIN] — if true, require higher confidence before clearing a citation and flag borderline cases as "medium" risk.

To adapt this template, replace each square-bracket placeholder with data from your RAG pipeline. [ANSWER] should contain the full model response including inline citation markers. [CITATIONS] needs a structured mapping of citation IDs to the claim spans they support. [RETRIEVED_DOCUMENTS] must include every document that was in the context window, with stable identifiers that match the citation references. The [GROUND_TRUTH_NOTES] field is optional but valuable for regulated domains where you have known-correct answers. The [HIGH_RISK_DOMAIN] boolean in [RISK_LEVEL] adjusts the evaluator's sensitivity — set it to true for healthcare, legal, or financial applications where a missed fabrication carries serious consequences. After adapting the template, run it against a labeled dataset of known-good and known-fabricated citation examples to calibrate your precision and recall thresholds before deploying to production.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Citation Fabrication Detection Prompt. Each placeholder must be populated before the prompt can reliably analyze model outputs for hallucinated or poisoned citations.

PlaceholderPurposeExampleValidation Notes

[MODEL_OUTPUT]

The full text response from the RAG system that contains claims and citations to be audited

According to the Q3 report, revenue grew 12% [1]. The new pricing model launched in June [2].

Must be non-empty string. Truncate to 32K tokens if longer. Strip any system prompt artifacts before passing.

[RETRIEVED_DOCUMENTS]

The complete set of documents or chunks retrieved and provided to the model as context, with their citation IDs

[1] Q3 Earnings Summary, p.4: Revenue increased 12% YoY... [2] Product Launch Timeline: Pricing update effective July 15...

Must be a valid JSON array of objects with id and content fields. Each citation ID in MODEL_OUTPUT must have a corresponding entry or be flagged.

[CITATION_FORMAT]

The regex or pattern that identifies citation markers in the model output

[(\d+)] or [\d+(?:,\d+)*]

Must compile as valid regex in the target runtime. Test against known citation formats before deployment. Null allowed if using default bracket-numeric pattern.

[GROUNDING_THRESHOLD]

Minimum similarity or entailment score required to consider a citation grounded in its source document

0.7

Float between 0.0 and 1.0. Values below 0.5 produce high false-positive rates. Values above 0.9 may miss legitimate paraphrased citations. Default 0.7.

[PRECISION_TARGET]

Minimum acceptable precision for the detection system before flagging a response for human review

0.85

Float between 0.0 and 1.0. Used to calibrate detection strictness. Lower values reduce false negatives but increase human review load. Must be paired with RECALL_TARGET.

[RECALL_TARGET]

Minimum acceptable recall for catching fabricated citations before the system is considered underperforming

0.90

Float between 0.0 and 1.0. Missing fabricated citations is higher-risk than false-flagging legitimate ones. Set higher than PRECISION_TARGET for safety-critical domains.

[OUTPUT_SCHEMA]

The expected JSON structure for the detection results, including per-citation verdicts and aggregate scores

{"citations": [{"id": "1", "verdict": "grounded|fabricated|uncertain", "evidence": "...", "confidence": 0.92}], "aggregate": {"precision": 0.88, "recall": 0.91}}

Must be a valid JSON Schema or example object. All downstream consumers must parse this schema. Include uncertainty handling for ambiguous cases.

[ESCALATION_POLICY]

Rules for when detection results require human review instead of automated action

Escalate if any citation has verdict 'fabricated' with confidence above 0.8, or if more than 2 citations are 'uncertain'

Must define concrete thresholds. Avoid vague rules like 'review if suspicious.' Test escalation rate against production volume to ensure human review capacity.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Citation Fabrication Detection Prompt into a production RAG pipeline with validation, retries, and human review gates.

The Citation Fabrication Detection Prompt is designed to operate as a post-generation audit step within a RAG pipeline, not as a real-time guardrail that blocks responses. After the primary model generates an answer with citations, this prompt receives the full output, the original retrieved documents, and any user-provided context. It returns a structured verdict per citation—whether it is grounded, hallucinated, or poisoned—along with a confidence score and a brief explanation. This separation from the generation step avoids adding latency to the user-facing response while still providing a systematic check before the answer is logged, cached, or surfaced in high-trust interfaces.

Wire the prompt into an asynchronous validation worker that triggers after the primary generation completes. The worker should construct the prompt payload with three required fields: [GENERATED_OUTPUT] (the full model response including inline citations), [RETRIEVED_DOCUMENTS] (the exact chunks or documents provided to the model during generation, with stable identifiers), and [CITATION_SCHEMA] (a JSON schema defining the expected citation format so the detection prompt can parse them reliably). The worker must handle cases where the generated output contains zero citations—returning an empty verdict list rather than failing—and cases where the citation format is unparseable, which should trigger a citation_parse_error flag. Log every detection result with a unique generation_id that ties back to the original request trace. For high-stakes domains such as healthcare or legal, route any citation flagged as hallucinated or poisoned with confidence above 0.7 to a human review queue before the answer reaches the end user.

Model choice matters for this detection task. The prompt requires strong instruction-following and structured output adherence, making it suitable for models like GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Avoid using smaller or older models that may hallucinate the detection verdicts themselves, creating a recursive trust problem. Set temperature=0 to maximize deterministic output, and enforce the output schema using the model's native structured output or function-calling API rather than relying on free-text parsing. If the detection prompt itself fails validation—returning malformed JSON, missing required fields, or exceeding the expected verdict count—retry once with the same payload. If the second attempt also fails, log the failure, flag the generation for manual review, and do not surface the answer in any interface that implies verified grounding.

Build eval harnesses that measure precision and recall against a labeled dataset of known-good and known-bad citations. For precision, verify that citations flagged as hallucinated or poisoned are genuinely problematic—false positives here erode trust in the detection system and waste reviewer time. For recall, verify that known fabrications are caught, especially subtle cases where the citation exists but the claim misrepresents the source content. Track these metrics per model version and per prompt revision. A reasonable initial target is precision above 0.90 and recall above 0.85, but adjust thresholds based on your domain's tolerance for missed detections versus false alarms. Run this eval suite as part of your CI/CD pipeline whenever the detection prompt, the generation prompt, or the underlying model changes.

Do not treat this prompt as a substitute for retrieval quality monitoring. If your retrieval pipeline consistently returns irrelevant or low-quality documents, the detection prompt will correctly flag citations as ungrounded, but the root cause is upstream. Pair this detection step with retrieval relevance metrics, embedding drift monitoring, and periodic index integrity checks. The detection prompt is a safety net, not a replacement for a well-tuned retrieval system. When deploying to production, start with a shadow mode that logs verdicts without blocking responses, calibrate thresholds against real traffic for at least a week, and only then enable blocking or review gates for high-severity flags.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the Citation Fabrication Detection Prompt's output quality before shipping. Use these standards to measure precision, recall, and reliability in production.

CriterionPass StandardFailure SignalTest Method

Citation-to-Document Match

All cited source IDs exist in the provided [RETRIEVED_DOCUMENTS] set

Output references a document ID not present in the input context

Parse output citations; cross-reference each ID against the input document ID list; flag any mismatch

Claim-to-Evidence Alignment

Every flagged claim is paired with a specific passage from the cited document that contradicts or fails to support it

Flagged claim cites a passage that actually supports the claim or is semantically unrelated

For each flagged claim, extract the cited passage; run a semantic entailment check (NLI model) between passage and claim; fail if entailment score > 0.7

Fabrication Classification Accuracy

Precision >= 0.90 and Recall >= 0.85 against a golden dataset of 50 known-fabricated and known-genuine citation pairs

Precision < 0.85 or Recall < 0.80 on the golden evaluation set

Run the prompt against a held-out test set with ground-truth labels; compute precision and recall; compare against thresholds

Non-Existent Source Detection

Correctly identifies citations that reference fabricated URLs, DOIs, or titles not found in any retrieval index

Output marks a real but obscure source as fabricated, or misses a completely invented source

Maintain a blocklist of known-fabricated identifiers and a whitelist of real ones; test both false-positive and false-negative cases

Misrepresentation Flagging

Detects when a citation's surrounding text contradicts the cited document's actual content

Output accepts a citation where the model's summary inverts or fabricates the source's conclusion

Create test pairs where the model output misrepresents a source; verify the prompt flags the mismatch with a specific explanation

Output Schema Compliance

Response is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed

Response is malformed JSON, missing required fields, or contains fields with incorrect types

Validate output against the JSON Schema definition; check field presence, types, and enum values; reject on first parse error

Abstention on Ambiguous Cases

Prompt returns confidence_score < 0.5 and sets needs_human_review = true when evidence is insufficient to decide

Prompt assigns high confidence to a fabrication call when the cited passage is ambiguous or partially supportive

Feed borderline cases where human annotators disagree; verify the prompt abstains or requests review rather than making a forced call

Latency and Token Budget

Prompt completes analysis within 3 seconds and uses fewer than 2000 output tokens for up to 10 citation checks

Prompt exceeds 5 seconds or produces verbose explanations that blow past the token budget

Benchmark with 10-citation batches; measure end-to-end latency and output token count; fail if either threshold is breached

PRACTICAL GUARDRAILS

Common Failure Modes

Citation fabrication is a critical failure mode in RAG systems where the model generates references that look plausible but don't exist or don't support the claim. These cards cover the most common failure patterns and how to detect them before they reach users.

01

Hallucinated Source Titles

What to watch: The model invents plausible-sounding paper titles, author names, or document references that don't exist in the retrieval index. This often happens when the model tries to fill gaps in evidence with fluent-sounding fabrications. Guardrail: Cross-reference every cited title against the actual retrieved document set using exact string matching or fuzzy deduplication. Flag any citation whose source identifier doesn't appear in the retrieval payload.

02

Mismatched Claim-to-Citation Mapping

What to watch: The model cites a real document that exists in the index, but the document doesn't actually support the specific claim being made. The citation is real but the grounding is false. Guardrail: Implement a claim-decomposition step that extracts each factual assertion and verifies it independently against the cited document's text. Use an NLI model or a second LLM call with strict entailment checking.

03

Poisoned Document Propagation

What to watch: An attacker plants documents in the retrieval index that contain fabricated citations, fake studies, or misleading authority signals. The RAG system retrieves and cites these as if they were legitimate. Guardrail: Maintain a document provenance log with insertion timestamps and source metadata. Alert on newly inserted documents that suddenly appear in high-stakes citations. Run periodic integrity scans comparing citation patterns before and after index updates.

04

Over-Citation to Mask Uncertainty

What to watch: When the model is uncertain or the retrieved evidence is weak, it may add extra citations to appear more authoritative. Multiple citations don't mean multiple supporting sources—they may all be irrelevant or fabricated. Guardrail: Score each citation independently for relevance and entailment. Set a minimum per-citation threshold rather than relying on citation count. Flag outputs where citation density spikes relative to the model's confidence signals.

05

Context Window Citation Drift

What to watch: In long-context scenarios, the model loses track of which source said what and begins conflating documents or attributing claims to the wrong source. This is especially common when multiple retrieved documents have similar content. Guardrail: Limit the number of documents in a single context window. Use structured citation markers that include document IDs and chunk offsets. Verify that each citation's surrounding context in the original document matches the claim.

06

Precision-Recall Tradeoff Blindness

What to watch: A citation detection system tuned only for high precision misses fabricated citations (low recall), while a system tuned for high recall floods reviewers with false positives. Operators often don't know which failure mode dominates. Guardrail: Track both precision and recall separately in production. Set explicit targets for each (e.g., precision > 0.95, recall > 0.85). Use a human review sample to calibrate thresholds and detect drift in either direction over time.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base detection prompt and a small set of known-good and known-bad citation examples. Run the prompt against 20-50 outputs from your RAG pipeline and manually review the results. Focus on tuning the [FABRICATION_DEFINITION] placeholder to match your specific citation format (footnotes, inline references, source IDs).

Watch for

  • Over-flagging legitimate citations that use different phrasing than the source document
  • Missing fabricated citations that closely mimic real source titles or author names
  • The model conflating 'citation not found' with 'citation contradicts source'
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.