This prompt is a specialized guardrail for legal-tech product teams who need to validate AI-generated outputs before they reach an attorney or client. It detects fabricated case citations, misstated statutes, incorrect party names, and unsupported legal conclusions in contract analysis, case summarization, or regulatory responses. Use this prompt when the cost of a hallucinated legal detail is high and a human-in-the-loop verification step is required. It is designed for high-recall detection, meaning it will flag more potential issues to ensure nothing slips through.
Prompt
Domain-Specific Hallucination Detection Prompt for Legal Outputs

When to Use This Prompt
Defines the specific job, ideal user, and operational boundaries for deploying a legal hallucination detection guardrail.
Deploy this prompt as a mandatory validation step in any pipeline where a language model generates a legal document, summary, or response based on provided source material. The prompt expects two structured inputs: a set of verified legal source passages and the AI-generated output to audit. It is not a general-purpose fact-checker; it requires the source material to be pre-validated and formatted. The prompt works best when the generated output contains specific, verifiable claims—citations, statutory references, party names, or legal conclusions—that can be directly matched against the source evidence. Do not use this prompt to evaluate creative legal arguments, assess the quality of legal advice, or replace a qualified attorney's review.
Before integrating this prompt, ensure your pipeline can supply clean, chunked source documents with stable identifiers. The prompt's effectiveness depends entirely on the quality and completeness of the source context provided. If your retrieval system cannot reliably surface the relevant statutes, case law, or contract clauses, this guardrail will generate false positives that erode user trust. Start by running this prompt against a golden dataset of known hallucinations and valid outputs to calibrate your flagging threshold. Pair it with a human review queue for all flagged outputs, and log every detection event to build a feedback loop for improving both your generation and retrieval systems over time.
Use Case Fit
Where this prompt works and where it does not. This domain-specific detector is designed for high-recall legal hallucination flagging with human-in-the-loop verification.
Good Fit: Legal Document Review
Use when: analyzing contract clauses, case summaries, or regulatory responses where fabricated citations or misstated statutes carry compliance risk. Guardrail: always route flagged outputs to a qualified human reviewer before any downstream action.
Bad Fit: General Conversational QA
Avoid when: the task is open-domain chat or general knowledge Q&A without legal stakes. The prompt's strict citation-format validation and entity-level checks will produce excessive false positives on non-legal text. Guardrail: use a general-purpose hallucination detector instead.
Required Inputs
Must provide: the model-generated legal output, the full source evidence set, and a defined citation format (e.g., Bluebook, neutral citation). Guardrail: missing or truncated source documents cause the detector to flag everything as unsupported—validate source completeness before running.
Operational Risk: High False-Positive Rate
What to watch: the detector is tuned for high recall, meaning it will flag borderline paraphrases and minor formatting deviations as potential hallucinations. Guardrail: implement a triage queue where flagged items are reviewed, and track false-positive rates weekly to avoid reviewer fatigue.
Operational Risk: Citation Format Drift
What to watch: legal citation formats vary by jurisdiction and court. A detector calibrated for one format will misflag correctly formatted citations from another system. Guardrail: version your citation format schema alongside the prompt and run regression tests whenever jurisdictions or format rules change.
Not a Replacement for Legal Judgment
What to watch: teams treating the detector's output as a definitive ruling on output correctness rather than a screening signal. Guardrail: the detector flags potential issues—it does not resolve them. Always pair with a human-in-the-loop step and document that the system is an assistive tool, not legal advice.
Copy-Ready Prompt Template
A reusable system prompt for detecting hallucinations in legal AI outputs, with placeholders for evidence, output, and domain constraints.
This prompt template is designed to be pasted directly into your model's system message. It instructs the model to act as a legal hallucination auditor, comparing a generated legal output against provided source documents. The template uses square-bracket placeholders for all variable inputs—replace each with your actual data before sending the request. The prompt is structured for high-recall detection, meaning it prioritizes flagging potential issues over avoiding false positives, with the understanding that a human reviewer will verify all flags.
textYou are a legal hallucination auditor. Your task is to compare a [LEGAL_OUTPUT] against provided [SOURCE_DOCUMENTS] and identify any statements that are not supported by the evidence. ## INPUT [LEGAL_OUTPUT] ## SOURCE DOCUMENTS [SOURCE_DOCUMENTS] ## DETECTION RULES 1. Flag any case citation where the case name, year, court, or holding cannot be verified in the source documents. 2. Flag any statutory reference where the statute number, section, or quoted language does not appear in the sources. 3. Flag any party name, date, dollar amount, or procedural fact that is not present in the sources. 4. Flag any legal conclusion stated as fact when the sources only provide factual background without reaching that conclusion. 5. Flag any quotation marks containing language not found verbatim in the sources. 6. Do NOT flag paraphrased statements that accurately reflect source content. 7. Do NOT flag reasonable inferences clearly supported by the sources. ## CITATION FORMAT VALIDATION For each citation in the output, verify: - Case citations follow [CITATION_STYLE] format (e.g., Bluebook, ALWD). - Statutory citations include correct title, section, and jurisdiction. - Pinpoint citations reference actual page or paragraph numbers from the source. ## OUTPUT FORMAT Return a JSON object with this exact schema: { "hallucination_flags": [ { "flagged_text": "exact text from output", "flag_type": "fabricated_citation | misstated_statute | incorrect_party | unsupported_conclusion | fabricated_detail | citation_format_error", "severity": "critical | high | medium | low", "explanation": "why this is flagged", "source_evidence": "relevant excerpt from sources or null if none exists", "suggested_correction": "correction if known, or null" } ], "overall_assessment": { "total_flags": number, "critical_flags": number, "requires_human_review": boolean, "summary": "brief assessment of output reliability" } } ## CONSTRAINTS - Only flag statements that lack source support. Do not flag stylistic choices or formatting. - If a citation appears correct but the source does not include enough detail to verify, flag it as "unverifiable" with severity "medium." - For [RISK_LEVEL] = "high", apply stricter scrutiny to legal conclusions and procedural statements. - If no hallucinations are detected, return an empty flags array with requires_human_review set to false.
To adapt this template, replace the bracketed placeholders with your actual data. [LEGAL_OUTPUT] should contain the full text of the AI-generated legal analysis, contract summary, or case brief. [SOURCE_DOCUMENTS] should include all evidence passages, case texts, or statutory excerpts that were provided to the generation model. [CITATION_STYLE] should specify your required citation format (e.g., "Bluebook 21st edition" or "ALWD Guide 7th edition"). [RISK_LEVEL] accepts "high," "medium," or "low" to adjust detection sensitivity. For production use, always route flagged outputs to a human reviewer before they reach end users—this prompt is a detection tool, not a replacement for legal judgment.
Prompt Variables
Required inputs for the Domain-Specific Hallucination Detection Prompt for Legal Outputs. Each placeholder must be populated before the prompt is sent. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[LEGAL_OUTPUT] | The generated legal text to scan for hallucinations—contract analysis, case summary, or regulatory response | The court held that Smith v. Jones, 123 F.3d 456 (9th Cir. 2022), established a duty of care... | Must be non-empty string. Check that output contains at least one claim statement. Null or whitespace-only input should abort before prompt execution. |
[SOURCE_DOCUMENTS] | The reference documents, case text, statutes, or evidence passages the output should be grounded in | Full text of Smith v. Jones, 123 F.3d 456 (9th Cir. 2022) and 42 U.S.C. § 1983 | Must contain at least one source passage. Validate that source text is not truncated mid-sentence. If sources are empty, the prompt should route to a zero-evidence refusal path instead. |
[CITATION_FORMAT] | The expected legal citation format to validate against—Bluebook, ALWD, or jurisdiction-specific style | Bluebook 21st edition | Must match a known citation format enum. If unrecognized format is supplied, default to Bluebook and log a warning. Do not accept null. |
[JURISDICTION] | The legal jurisdiction context for interpreting statutory references and case law authority | U.S. federal, 9th Circuit | Must be a non-empty string. Validate against a controlled jurisdiction list if available. Missing jurisdiction degrades statute-misstatement detection accuracy. |
[HALLUCINATION_CATEGORIES] | The specific hallucination types to flag—fabricated citations, misstated statutes, incorrect party names, unsupported conclusions | fabricated_citation, misstated_statute, incorrect_party_name, unsupported_legal_conclusion | Must be a list of valid category enums. At least one category must be selected. Unknown categories should be rejected before prompt assembly. |
[CONFIDENCE_THRESHOLD] | The minimum confidence score for flagging a hallucination; claims below this threshold are not reported | 0.7 | Must be a float between 0.0 and 1.0. Values below 0.5 produce high false-positive rates. Values above 0.95 may miss real hallucinations. Recommend 0.7–0.85 for legal use. |
[OUTPUT_SCHEMA] | The structured output format for hallucination findings—JSON schema defining flagged claims, evidence gaps, and severity | {"findings": [{"claim": string, "hallucination_type": string, "source_evidence": string | null, "confidence": float, "severity": string}]} | Must be a valid JSON Schema object. Validate parse before prompt execution. Schema must include required fields: claim, hallucination_type, confidence, severity. Missing fields cause downstream parsing failures. |
[MAX_FINDINGS] | The maximum number of hallucination findings to return; prevents unbounded output in long documents | 20 | Must be a positive integer. Values above 50 risk token overflow in long legal documents. Null is not allowed—default to 20 if unspecified. |
Implementation Harness Notes
How to wire the domain-specific hallucination detection prompt into a legal-tech application with validation, retries, logging, and human review.
This prompt is designed as a pre-release guardrail, not a post-hoc audit tool. It should sit between the primary legal reasoning model's output and the end user, evaluating every response before it is shown. The harness must treat the detection prompt as a high-recall safety net: it is better to flag a grounded statement for human review than to let a fabricated case citation reach a lawyer. Wire this prompt into an asynchronous validation pipeline where the primary model's output and the source context are passed together. The detection prompt returns a structured JSON report; your application must parse this report and enforce a routing decision—pass, block, or escalate—based on the flagged_statements array and the overall_risk_score.
Validation and Routing Logic: Parse the model's JSON output with a strict schema validator. If the output fails to parse, retry once with a repair prompt that includes the raw output and the expected schema. Once parsed, check overall_risk_score. If the score is below your low-risk threshold (e.g., < 0.3) and flagged_statements is empty, route the original output to the user. If the score exceeds a high-risk threshold (e.g., > 0.7) or any flagged statement has severity: 'critical', block the output entirely and log the incident. For scores in the middle band, or when flagged_statements contains only severity: 'minor' items, queue the output for human review with the detection report attached. Citation format validation requires an additional deterministic check: extract all citation strings from the original output using a regex pattern for legal citations (e.g., \d+\s+[A-Za-z.]+\s+\d+ for case reporters, or \d+\s+U\.S\.C\.\s+§\s+\d+ for statutes) and verify each against a known citation database or court API before the LLM detection step. This hybrid approach—deterministic citation lookup plus LLM semantic grounding check—catches fabricated citations that look real but don't exist.
Model Choice and Latency Budget: Use a fast, instruction-following model for this detection task (e.g., GPT-4o, Claude 3.5 Sonnet, or a fine-tuned open-weight model). The detection prompt is a secondary call that adds latency; budget 2–5 seconds for this step. If your primary legal output generation already takes 10+ seconds, this overhead is acceptable. For streaming applications, buffer the full output before running detection—do not attempt to run this prompt on partial streams. Logging and Observability: Log every detection result with the original output, source context, detection report, and routing decision. Include a unique trace_id that links the primary generation and the detection step. This audit trail is essential for legal-tech products where every decision must be explainable. Human Review Integration: When escalation is triggered, present the reviewer with a side-by-side view: the original output on the left, the detection report on the right, with flagged statements highlighted inline. The reviewer should be able to approve, edit, or reject each flagged statement. Track reviewer decisions to measure the detection prompt's precision and recall over time, and use this data to tune your risk thresholds.
What to avoid: Do not use this prompt as the sole defense in high-stakes legal workflows. Always combine it with deterministic citation validation, source document retrieval quality checks, and human review for critical outputs. Do not run this prompt without a schema validator—the model may return malformed JSON under load. Do not skip logging; without traceability, you cannot improve the detection pipeline or defend its decisions in an audit. Start with a high-recall threshold (flag more, block less) and tighten precision as you gather reviewer feedback on false positives.
Expected Output Contract
Fields, format, and validation rules for the structured JSON response the model must return when detecting hallucinations in legal outputs. Use this contract to build a post-processing validator.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
hallucination_report | object | Top-level object must parse as valid JSON. Schema validation required. | |
hallucination_report.overall_score | string (enum) | Must be one of: 'NO_HALLUCINATION', 'LOW_RISK', 'HIGH_RISK'. If any finding has severity 'CRITICAL', overall_score must be 'HIGH_RISK'. | |
hallucination_report.findings | array of objects | Array must not be empty if overall_score is not 'NO_HALLUCINATION'. Each object must conform to the finding schema. | |
hallucination_report.findings[].claim | string | The exact text span from the original output being flagged. Must be a substring of [ORIGINAL_OUTPUT]. If not found, reject the finding. | |
hallucination_report.findings[].type | string (enum) | Must be one of: 'FABRICATED_CITATION', 'MISSTATED_STATUTE', 'INCORRECT_PARTY', 'UNSUPPORTED_CONCLUSION', 'FABRICATED_DETAIL'. No other values allowed. | |
hallucination_report.findings[].severity | string (enum) | Must be one of: 'MINOR', 'MATERIAL', 'CRITICAL'. 'CRITICAL' requires immediate human review. | |
hallucination_report.findings[].evidence_span | string or null | If type is 'UNSUPPORTED_CONCLUSION' or 'FABRICATED_DETAIL', this must be null. Otherwise, must be a direct quote from [SOURCE_CONTEXT] that contradicts the claim. | |
hallucination_report.findings[].citation_format_check | object or null | Required if type is 'FABRICATED_CITATION'. Must contain fields: 'reporter_volume', 'page_number', 'court_year'. Each field is a boolean indicating format validity. Null for other types. |
Common Failure Modes
Legal hallucination detection fails in predictable ways. These are the most common failure modes when deploying domain-specific detection prompts for legal outputs, with concrete guardrails to catch them before they reach users.
Citation Format Mimicry Without Validation
What to watch: The model flags a citation as valid because it matches legal citation format (e.g., '123 F.3d 456'), but the volume, page, or year is fabricated. Format compliance does not equal authenticity. Guardrail: Add a post-detection validation step that checks citation components against a known legal database or regex pattern with volume-reporter-page consistency rules before accepting any citation as grounded.
False Negatives on Paraphrased Legal Standards
What to watch: The detector misses hallucinations when the model restates a legal standard in its own words that sounds plausible but subtly shifts the burden of proof, elements of a claim, or statutory language. Paraphrase drift on legal tests is high-risk. Guardrail: Include few-shot examples of paraphrased-but-wrong legal standards in the detection prompt, and run a secondary check comparing key legal phrases against canonical statutory or restatement language.
Over-Flagging Legitimate Legal Reasoning
What to watch: The detector treats valid legal analysis—such as analogizing to an unprovided case or applying a known doctrine to new facts—as hallucination because the reasoning step is not verbatim in the source. This produces high false-positive rates and erodes trust. Guardrail: Distinguish in the prompt between 'unsupported factual claims' and 'permissible legal inference.' Calibrate the detection threshold to flag factual fabrications aggressively while allowing reasoned application of law when the legal principle is grounded in provided sources.
Party Name and Entity Confusion
What to watch: The detector fails to catch hallucinated party names, judge names, or corporate entities because they look like plausible proper nouns. A fabricated 'Smith v. Jones' or 'Judge Reinhardt' passes through undetected. Guardrail: Extract all named entities from the output and cross-reference against the provided source documents. Flag any entity not present in the source as a potential fabrication, with special attention to capitalized proper nouns in legal contexts.
Temporal Hallucination on Effective Dates and Precedent Status
What to watch: The model asserts a statute is 'currently in effect' or a case is 'good law' without source evidence, or fabricates effective dates, repeal dates, and subsequent treatment history. Temporal claims about legal authority are high-stakes. Guardrail: Add a temporal-grounding check that requires any statement about current validity, effective dates, or subsequent treatment to be explicitly supported by a source. Flag unsupported temporal claims as high-severity hallucinations requiring human review.
Jurisdictional Scope Drift
What to watch: The detector misses hallucinations where the model applies a legal rule from one jurisdiction to another without source support—citing a Ninth Circuit standard as if it binds a district court in the Fifth Circuit, or applying GDPR principles to a CCPA question. Jurisdictional overreach is a domain-specific hallucination pattern. Guardrail: Include jurisdiction-awareness instructions in the detection prompt. Flag any legal conclusion that crosses jurisdictional boundaries without explicit source support for the applicability of that authority in the target jurisdiction.
Evaluation Rubric
Use this rubric to evaluate the performance of the Domain-Specific Hallucination Detection Prompt against a golden dataset of 50 labeled legal outputs. Each criterion targets a specific failure mode common in legal hallucination detection.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Fabricated Case Citation Recall |
| Recall < 0.90 on the fabricated citation subset of the golden dataset | Run prompt on 20 golden outputs containing known fabricated citations; compare detected spans to labeled ground truth |
Misstated Statute Precision |
| Precision < 0.80, indicating false positives on correctly paraphrased statutory language | Run prompt on 15 golden outputs with labeled statute errors; measure precision of [HALLUCINATED_STATUTE] flags |
Incorrect Party Name Detection |
| Recall < 0.90, missing fabricated entity references in case summaries | Test against 10 golden outputs with known party name errors; verify all [HALLUCINATED_ENTITY] spans are captured |
Unsupported Legal Conclusion Flagging |
| Recall < 0.75, allowing unsupported holdings or reasoning to pass without a flag | Run prompt on 15 golden outputs containing unsupported conclusions; check that [UNSUPPORTED_CLAIM] labels match human annotations |
Citation Format Validation Accuracy |
| Accuracy < 0.95, missing format errors that a regex validator would catch | Apply prompt to 10 golden outputs with known citation format errors; compare [FORMAT_ERROR] detections to a citation regex baseline |
False Positive Rate on Paraphrased Support | <= 0.10 false positive rate on sentences that paraphrase source material without fabrication | False positive rate > 0.15, flagging faithful paraphrases as hallucinations | Measure false positive rate on 20 golden outputs where all claims are grounded but paraphrased; count incorrect [UNSUPPORTED_CLAIM] flags |
Severity Classification Agreement |
| Agreement < 0.70, misclassifying critical fabrications as minor or vice versa | Run prompt on 25 golden outputs with severity labels; compute Cohen's kappa between [SEVERITY] output and human labels |
Overall Hallucination Detection F1 Score | F1 >= 0.85 across all hallucination types in the full 50-example golden dataset | F1 < 0.80, indicating the prompt misses too many hallucinations or produces too many false alarms | Compute micro-averaged F1 across all hallucination types using the full golden dataset; compare to baseline threshold |
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
Start with the base hallucination detection prompt and a small set of legal outputs. Use a frontier model (GPT-4o, Claude 3.5 Sonnet) with the system prompt as-is. Focus on detecting fabricated case citations and misstated statutes—the highest-risk categories. Run 20–30 examples manually and review every flag.
Simplify the output schema to a flat list of flagged claims with a severity label and a short justification. Skip structured citation validation in the first pass.
code[SYSTEM]: You are a legal hallucination detector. Review the [LEGAL_OUTPUT] against the [SOURCE_DOCUMENTS]. Flag any claim that is not supported by the sources. Pay special attention to case names, citations, statute numbers, party names, and legal conclusions. Return a JSON list of flagged claims with "claim", "severity", and "justification".
Watch for
- Over-flagging paraphrased source content as hallucinated
- Missing fabricated party names because they look plausible
- No structured citation format checks—citations that look real but don't match any known reporter format will pass through
- Model confidently flagging correct legal conclusions as unsupported because it doesn't understand the reasoning chain

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