Citation Verifier
The citation-verifier policy evaluates LLM responses for factual grounding by extracting citations, verifying them against known sources or RAG context, and detecting hallucinated claims. It is essential for any deployment where response accuracy has legal, medical, financial, or reputational consequences — ensuring that AI-generated content is traceable back to authoritative sources.
Use this page when
- You need the exact command, config, API, or integration details for Citation Verifier.
- You are wiring automation or AI retrieval and need canonical names, examples, and constraints.
- If you want a guided rollout instead of a reference page, use the linked workflow pages in Next steps.
Primary audience
- Primary: AI Agents, Technical Engineers
- Secondary: Technical Leaders
Configuration
policy:
citation-verifier:
require_sources: true
require_source_match: true
min_groundedness: 0.7
pack:
name: citation-verifier-example-1
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
Fields
| Field | Type | Description | Default |
|---|---|---|---|
require_sources | boolean | Responses must include at least one extractable citation. If the response contains no citations and this field is true, the policy triggers the unverified_action. | true |
require_source_match | boolean | Every extracted citation must match a known source in the verification database or RAG context. When false, unmatched citations are flagged but not blocked. | false |
min_confidence | number (0–1) | Minimum match confidence score for a citation to be considered verified. Citations scoring below this threshold are treated as unverified. | 0.8 |
min_groundedness | number (0–1) | Minimum RAG groundedness score for the overall response. The groundedness score measures what fraction of the response's factual claims are supported by the provided context. | — |
external_resolver | object | Configuration for an external citation-verification endpoint. When provided, extracted citations are sent to this endpoint for lookup against authoritative databases. | — |
external_resolver.endpoint | string (URI) | The URL of the external verification service. The gateway sends a POST request with the extracted citations as the request body. | (required if external_resolver is set) |
external_resolver.api_key | string | API key sent in the Authorization header when calling the external resolver. Supports environment variable interpolation via ${VAR} syntax. | — |
external_resolver.timeout_ms | integer (1–60000) | Maximum time in milliseconds to wait for a response from the external resolver before treating the verification as inconclusive. | 2000 |
extract_patterns | enum array | The citation pattern types to extract from responses. Supported values: "case_law" (legal case citations like Smith v. Jones, 500 U.S. 1), "academic" (journal references, DOIs, author-year), "url" (HTTP/HTTPS links), "quote" (direct quotations with attribution), "statistic" (numerical claims with source attribution). | ["case_law", "academic", "url", "quote", "statistic"] |
rag_context | object | Settings for verifying response groundedness against RAG-provided context documents. | — |
rag_context.verify_against_context | boolean | When true, the policy compares response claims against the context documents attached to the request (e.g., via the context or documents field in the prompt). | true |
rag_context.min_context_overlap | number (0–1) | Minimum semantic overlap between a response claim and the RAG context for the claim to be considered grounded. Claims below this threshold are marked as potentially hallucinated. | 0.7 |
output_action | object | Actions to take when verification detects issues in the response. | — |
output_action.unverified_action | enum | Action when citations cannot be verified: "flag" annotates the response with verification metadata, "redact" removes unverified claims from the response, "block" rejects the entire response. | "flag" |
output_action.hallucination_action | enum | Action when the response contains claims contradicted by or absent from the provided context. | "block" |
response | object | Controls what verification metadata is included in the gateway response. | — |
response.include_verification_report | boolean | When true, the gateway appends a structured verification report to the response metadata. The report includes each extracted citation, its verification status, confidence score, and the matched source (if any). | true |
Use Cases
Legal Research Verification
A law firm uses an LLM to draft legal memoranda. The citation verifier extracts case law references and validates them against an external legal database, ensuring that every cited case actually exists and that the holding described matches the actual ruling.
policy:
citation-verifier:
require_sources: true
require_source_match: true
min_groundedness: 0.85
pack:
name: citation-verifier-example-2
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
Medical Literature Grounding
A clinical decision support system augments physician queries with LLM-generated summaries of medical literature. The policy verifies that every cited study exists in PubMed and that the response is grounded in the retrieval context, preventing hallucinated treatment recommendations.
policy:
citation-verifier:
require_sources: true
require_source_match: true
min_groundedness: 0.8
pack:
name: citation-verifier-example-3
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
Financial Report Fact-Checking
An investment firm generates research reports using an LLM. The citation verifier ensures that every statistic (revenue figures, market-cap data, growth rates) is traceable to a verifiable source and that URLs in the response point to legitimate financial data providers.
policy:
citation-verifier:
require_sources: true
require_source_match: true
min_groundedness: 0.85
pack:
name: citation-verifier-example-4
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
RAG Pipeline Hallucination Detection
A customer-support chatbot answers questions from a product knowledge base using RAG. The citation verifier checks that every claim in the response is grounded in the retrieved documents, blocking fabricated product features or incorrect troubleshooting steps.
policy:
citation-verifier:
require_sources: false
require_source_match: true
min_groundedness: 0.85
pack:
name: citation-verifier-example-5
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
External Resolver Integration
An organization operates a centralized fact-checking service that maintains a curated database of verified claims. The citation verifier delegates verification to this service, using a generous timeout to accommodate complex lookups.
policy:
citation-verifier:
require_sources: true
require_source_match: true
min_groundedness: 0.85
pack:
name: citation-verifier-example-6
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
How It Works
When a response is received from the upstream LLM provider with citation-verifier enabled:
-
Citation extraction — The gateway scans the response text for citation patterns matching the types listed in
extract_patterns. Each pattern type uses a specialized extractor:case_lawidentifies legal citation formats (e.g., Roe v. Wade, 410 U.S. 113),academicmatches journal references and DOIs,urlextracts HTTP/HTTPS links,quoteidentifies attributed quotations, andstatisticdetects numerical claims with source attribution. -
Source presence check — If
require_sourcesistrueand no citations were extracted, the gateway triggers theunverified_actionimmediately. This ensures responses to fact-sensitive queries always include traceable references. -
RAG groundedness scoring — If
rag_context.verify_against_contextistrue, the gateway compares each factual claim in the response against the context documents from the request. It computes a semantic overlap score for each claim and an aggregate groundedness score for the full response. Claims belowmin_context_overlapare marked as ungrounded. If the overall groundedness score falls belowmin_groundedness, thehallucination_actionis triggered. -
External verification — If
external_resolveris configured, the gateway sends the extracted citations to the external endpoint as a structured POST request. The resolver returns a verification status and confidence score for each citation. Citations with a confidence score belowmin_confidenceare marked as unverified. -
Source matching — If
require_source_matchistrue, every extracted citation must have been confirmed by either the RAG context or the external resolver. Any unmatched citation triggers theunverified_action. -
Action enforcement — Based on the verification results, the gateway applies the configured actions:
"flag"annotates the response with verification metadata without altering the content,"redact"strips unverified claims from the response text, and"block"rejects the entire response and returns an error to the caller. -
Verification report — If
response.include_verification_reportistrue, the gateway appends a structured report to the response metadata containing each extracted citation, its verification status, confidence score, matched source, and any groundedness warnings.
Combining With Other Policies
The citation verifier is most effective as part of a multi-layered response-quality stack:
content-filter— Screens for harmful or inappropriate content in the response before citation verification runs. This prevents the verifier from processing responses that would be blocked regardless.pii-detector— Detects and redacts personally identifiable information that may appear in citations (e.g., patient names in medical references, party names in sealed court cases). Use PII detection upstream of citation verification.audit-logger— Records the verification report and policy decision for every response. Critical for regulated industries where you must demonstrate that AI outputs were fact-checked.rate-limiter— When using an external resolver, rate-limit outbound verification requests to avoid overwhelming the resolver service or incurring excessive API costs.disclaimer— Appends a standard disclaimer to responses that passed verification with flags (e.g., "Some citations in this response could not be independently verified"). Useful whenunverified_actionis"flag"rather than"block".
Best Practices
- Set
min_confidenceto at least 0.8 for regulated domains. Lower thresholds may allow loosely-matched citations to pass verification, undermining the reliability of the output. - Use
require_source_match: truewhen accuracy is non-negotiable. In legal and medical contexts, a fabricated citation can cause real harm. Requiring source matches ensures every reference is independently confirmed. - Start with
unverified_action: "flag"during initial deployment. This lets you monitor verification accuracy and tune thresholds before switching to"redact"or"block", avoiding false-positive disruptions. - Configure reasonable
timeout_msfor external resolvers. A timeout that is too short will cause legitimate citations to be marked as unverified. Measure your resolver's p95 latency and set the timeout to at least 2x that value. - Combine RAG grounding with external verification for defense in depth. RAG grounding catches claims unsupported by the provided context, while external verification catches citations to non-existent sources. Together they cover both fabricated facts and fabricated references.
- Review the verification report in your audit logs regularly. Patterns of unverified citations or low groundedness scores may indicate that your RAG retrieval pipeline needs tuning or that the LLM is systematically hallucinating in specific domains.
For AI systems
- Canonical terms: Keeptrusts,
citation-verifier, policy-config.yaml, require_sources, require_source_match, min_confidence, min_groundedness, external_resolver, extract_patterns, rag_context, output_action (flag/redact/block), hallucination_action. - Output-phase policy: runs on the model's response to verify factual grounding.
- Best next pages: Citation Verification template, Quality Assertions Configuration, Per-Policy Configuration Catalog.
For engineers
citation-verifieris an output-phase policy. Place it after input-phase policies and beforeaudit-logger.- Start with
unverified_action: "flag"during initial deployment to monitor accuracy before enforcing blocks. - Set
external_resolver.timeout_msto at least 2x your resolver's p95 latency to avoid false-negative timeouts. - Use
require_source_match: truein legal and medical contexts where fabricated citations cause real harm. - Validate by sending a prompt that should produce citations and confirming the verification report in response metadata.
For leaders
- Citation verification reduces liability from AI-generated hallucinations in legal, medical, financial, and research contexts.
- The policy supports both RAG groundedness scoring (internal context) and external resolver integration (authoritative databases), providing defense in depth.
- Flag mode preserves user experience during evaluation; block mode provides hard enforcement when accuracy is non-negotiable.
- Verification reports in audit logs provide evidence of fact-checking compliance for regulators and internal quality reviews.
Next steps
- Citation Verification template — ready-to-deploy starter config
- Quality Assertions Configuration — quality scoring for response correctness
- Healthcare HIPAA template — combine with medical literature grounding
- Policies overview — policy chain architecture