Inferensys

Prompt

Domain-Specific Hallucination Detection Prompt for Medical Outputs

A practical prompt playbook for detecting clinically significant hallucinations in medical summaries, note generation, and patient-facing AI outputs. Includes a copy-ready template, clinical terminology awareness, human-review integration patterns, and evaluation against medical NLI benchmarks.
AI evaluator reviewing output quality on laptop, comparison metrics visible, casual evaluation session.
PROMPT PLAYBOOK

When to Use This Prompt

Deploy this prompt as a clinical safety guardrail to detect medically significant hallucinations in generated text before it reaches a patient or clinician.

This prompt is designed for healthcare AI teams who need to detect clinically significant hallucinations before medical outputs reach patients or clinicians. Use it when your system generates medical summaries, clinical notes, discharge instructions, or patient-facing explanations from source evidence such as EHR data, clinical guidelines, or medical literature. The prompt flags fabricated findings, incorrect dosages, unsupported diagnoses, missing contraindications, and temporal inconsistencies that could cause patient harm. It is built for a guardrail position in your pipeline: after generation, before human review or release.

This is not a general-purpose hallucination detector. It assumes clinical terminology, structured source evidence, and a mandatory human-in-the-loop review step for any flagged output. The prompt expects a specific input structure: a generated medical text and a set of source evidence passages. It returns a structured JSON report with flagged spans, severity classifications, and grounding assessments. Do not use this prompt for non-medical content, for real-time streaming outputs without adaptation, or in any workflow that bypasses human review of flagged items. The prompt's value is in its clinical specificity—it looks for medication name mismatches, lab value fabrications, and temporal inconsistencies that a general hallucination detector would miss.

Before integrating this prompt, ensure your pipeline can supply clean source evidence and handle the structured JSON output. You will need to map the prompt's severity classifications to your own escalation logic. Start by running the prompt against a labeled dataset of known hallucinations and valid outputs to calibrate thresholds for your specific use case. The next section provides the copy-ready template with all required placeholders.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Medical hallucination detection requires clinical terminology awareness, strict evidence grounding, and human review integration. These cards define the operational boundaries.

01

Good Fit: Clinical Summary Verification

Use when: verifying AI-generated discharge summaries, radiology reports, or patient-facing explanations against source clinical notes. Guardrail: Always require a human clinician in the loop for final sign-off. The prompt flags hallucinations but does not make clinical decisions.

02

Good Fit: Medication and Dosage Cross-Check

Use when: detecting fabricated dosages, incorrect frequencies, or missing contraindications in generated medication instructions. Guardrail: Pair with a structured medication database lookup. The prompt identifies unsupported claims; the database provides ground truth for verification.

03

Bad Fit: Real-Time Diagnostic Decision Support

Avoid when: the output directly informs emergency clinical decisions without human review. This prompt detects hallucinations post-generation, not in real-time. Guardrail: Never deploy as a standalone safety gate for live diagnostic systems. Use only in asynchronous review workflows.

04

Bad Fit: Unstructured Patient-Generated Text

Avoid when: analyzing free-text patient messages, forum posts, or non-clinical narratives without clear source grounding. Guardrail: The prompt requires structured source evidence. Unstructured patient text lacks the clinical reference needed for reliable hallucination detection.

05

Required Inputs: Source Evidence and Output Pairs

What to watch: The prompt needs both the generated medical output and the specific source documents used to produce it. Missing or incomplete source context produces false positives. Guardrail: Validate that source documents are complete and version-locked before running detection. Log source hashes for audit trails.

06

Operational Risk: False Negatives on Paraphrased Findings

What to watch: The prompt may miss hallucinations when generated text paraphrases clinical findings with subtle meaning drift—changing 'mild effusion' to 'no significant effusion.' Guardrail: Calibrate against medical NLI benchmarks. Implement a secondary paraphrase-drift check for high-risk finding categories. Track false negative rates by clinical severity tier.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your validation pipeline to detect clinically significant hallucinations in medical outputs.

This prompt template is designed to be dropped directly into your medical output validation pipeline. It instructs the model to act as a clinical hallucination auditor, comparing a generated medical text against provided source evidence. The prompt is structured to produce a machine-readable JSON output that can be parsed by downstream guardrails, logging systems, or human review queues. Before using it, you must replace the square-bracket placeholders with your specific clinical context, the generated output under review, and the source evidence that should support it.

text
You are a clinical hallucination auditor. Your task is to compare a generated medical output against provided source evidence and identify clinically significant hallucinations. A clinically significant hallucination is a statement that could affect patient care, clinical decision-making, or medical understanding if acted upon.

## INPUT
Generated Medical Output:
[GENERATED_OUTPUT]

Source Evidence:
[SOURCE_EVIDENCE]

Clinical Context:
[CLINICAL_CONTEXT]

## INSTRUCTIONS
1. Extract every clinical claim from the Generated Medical Output. A clinical claim includes findings, diagnoses, medications, dosages, procedures, lab results, patient demographics, allergies, contraindications, and care instructions.
2. For each claim, search the Source Evidence for direct support. A claim is supported if the evidence explicitly states it or if it can be directly and unambiguously inferred.
3. Classify each unsupported claim into one of the following hallucination types:
   - `fabricated_finding`: A clinical observation or result not present in the source evidence.
   - `incorrect_dosage`: A medication dosage, frequency, or route that contradicts or is absent from the source evidence.
   - `unsupported_diagnosis`: A diagnosis stated without evidence support.
   - `missing_contraindication`: A failure to mention a documented contraindication, allergy, or interaction when recommending a treatment.
   - `demographic_error`: Incorrect patient age, sex, or other identifying clinical factor.
   - `temporal_error`: A date, time, or sequence of events that contradicts the source evidence.
   - `omitted_material_fact`: A clinically relevant fact from the source evidence that is absent from the generated output, where omission could lead to harm.
4. Assign a severity to each hallucination:
   - `critical`: Could lead to immediate patient harm if acted upon.
   - `major`: Could significantly alter clinical understanding or decision-making.
   - `minor`: Factual inaccuracy with low potential for clinical impact.
5. For each hallucination, provide the exact text span from the Generated Medical Output and the conflicting or missing evidence from the Source Evidence.

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "hallucinations": [
    {
      "claim_text": "string",
      "hallucination_type": "fabricated_finding | incorrect_dosage | unsupported_diagnosis | missing_contraindication | demographic_error | temporal_error | omitted_material_fact",
      "severity": "critical | major | minor",
      "output_span": "string (exact text from generated output)",
      "source_evidence_span": "string (relevant excerpt from source evidence, or 'NO EVIDENCE FOUND')",
      "explanation": "string (brief clinical rationale for the flag)"
    }
  ],
  "overall_assessment": {
    "total_claims_extracted": number,
    "total_hallucinations_found": number,
    "critical_count": number,
    "major_count": number,
    "minor_count": number,
    "requires_human_review": boolean,
    "summary": "string (one-sentence clinical safety summary)"
  }
}

## CONSTRAINTS
- Only flag claims that are unsupported by the Source Evidence. Do not flag stylistic differences or paraphrasing that preserves clinical meaning.
- If the Source Evidence is insufficient to verify a claim, flag it as unsupported and note the evidence gap.
- Do not introduce external medical knowledge. Base all judgments solely on the provided Source Evidence.
- If no hallucinations are found, return an empty hallucinations array and set `requires_human_review` to false.
- Set `requires_human_review` to true if any hallucination has a severity of `critical` or `major`.

To adapt this template, replace [GENERATED_OUTPUT] with the medical text your system produced, [SOURCE_EVIDENCE] with the retrieved or provided clinical documents, and [CLINICAL_CONTEXT] with a brief description of the clinical scenario. The output schema is designed for direct ingestion by a validation harness. After receiving the JSON response, your application should automatically escalate any output where requires_human_review is true to a clinical reviewer and log all hallucinations for evaluation against a held-out set of annotated medical hallucination examples. Do not deploy this prompt without first measuring its recall and precision against a benchmark such as Med-HALT or a custom set of clinically annotated outputs.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Validate each before sending to the model. For medical hallucination detection, missing or malformed inputs can cause false negatives on clinically significant fabrications.

PlaceholderPurposeExampleValidation Notes

[MEDICAL_OUTPUT]

The generated text to audit for hallucinations

Patient presents with acute myocardial infarction. Start 325mg aspirin and 0.4mg nitroglycerin sublingual.

Must be non-empty string. Check length > 0. If output contains structured sections, preserve section boundaries for span-level mapping.

[SOURCE_EVIDENCE]

Ground-truth source documents or passages the output should be grounded in

ECG shows ST elevation in leads II, III, aVF. Vitals: BP 145/90, HR 98. Current medications: metformin 500mg BID.

Must be non-empty string. Validate that source passages are complete and not truncated. Missing source context is the leading cause of false-positive hallucination flags.

[CLINICAL_DOMAIN]

Specific clinical domain or specialty context for terminology awareness

cardiology

Must match a supported domain from the allowed taxonomy list. Use enum validation: cardiology, neurology, oncology, pediatrics, internal_medicine, or null for general medical. Incorrect domain mapping degrades entity recognition precision.

[DETECTION_SENSITIVITY]

Threshold controlling the trade-off between recall and precision for hallucination flagging

high

Must be one of: high, medium, low. High sensitivity flags more potential hallucinations including minor paraphrase drift. Low sensitivity only flags clear fabrications. Validate against use-case risk tolerance before setting.

[OUTPUT_SCHEMA]

Expected structure for the hallucination detection report

{"flagged_spans": [{"text": "...", "severity": "...", "evidence_match": "..."}], "overall_score": 0.85}

Must be a valid JSON Schema object or reference. Validate schema parse before prompt assembly. Schema must include fields for span text, severity classification, and evidence alignment. Malformed schema causes unparseable detection reports.

[SEVERITY_TAXONOMY]

Clinical severity levels for classifying detected hallucinations

["critical", "material", "minor", "paraphrase_drift"]

Must be a non-empty array of severity labels. Validate that downstream escalation logic maps to these exact labels. Critical: fabricated findings or contraindication omissions. Material: incorrect dosage or timing. Minor: terminology imprecision without clinical impact. Paraphrase drift: meaning shift without fabrication.

[HUMAN_REVIEW_REQUIRED]

Boolean flag indicating whether flagged outputs must route to human review

Must be true for any clinical deployment. Validate that the application harness enforces this flag before any output reaches a patient or clinician without review. Set to false only for offline evaluation runs against benchmark datasets.

[CLINICAL_NLI_BENCHMARK]

Reference to a clinical natural language inference benchmark for eval calibration

MedNLI

Must reference a validated clinical NLI benchmark. Validate that eval harness loads the correct benchmark version. Used for calibration runs, not production inference. Null allowed if eval is not running in this invocation.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the medical hallucination detection prompt into a production clinical AI pipeline with human review integration.

This prompt operates as a post-generation guardrail, not a real-time interrupter. After a medical summary, note draft, or patient-facing output is generated, the hallucination detection prompt receives the full output alongside the source evidence (clinical notes, lab results, reference guidelines). The harness must enforce a strict contract: the prompt returns a structured JSON payload with flagged claims, severity labels, and evidence gaps. Do not rely on the model's self-assessment alone—the harness validates output schema compliance before any downstream action.

Pipeline integration steps: (1) Retrieve the source context that was used to generate the original output—this must be the exact evidence set, not a re-retrieved set that may differ. (2) Assemble the prompt with [GENERATED_OUTPUT], [SOURCE_EVIDENCE], [CLINICAL_DOMAIN], and [OUTPUT_SCHEMA] populated. (3) Call the model with response_format set to JSON Schema matching the expected hallucination report structure. (4) Validate the response: confirm all required fields exist, severity labels match the allowed enum, and each flagged span maps to a character offset or quote in the original output. (5) Route based on severity: critical or safety findings block the output and trigger human review; material findings queue for clinician review within a configurable SLA; minor findings log for offline audit without blocking the workflow. (6) Log the full prompt, response, validation result, and routing decision for audit trails.

Human review integration is mandatory for any clinical-facing system. The harness must surface flagged claims with their source evidence side by side in a review interface. Reviewers need one-click actions: confirm hallucination, override as acceptable paraphrase, or edit and release corrected output. Track reviewer decisions to measure the detector's precision and recall over time. Model choice matters: use a model with strong instruction-following and medical terminology awareness (GPT-4, Claude 3.5 Sonnet, or Med-PaLM variants). Avoid small or general-purpose models that conflate paraphrasing with hallucination. Eval calibration: run this prompt against a held-out set of outputs with clinician-annotated hallucination labels. Measure precision (flagged items that are true hallucinations) and recall (true hallucinations that were flagged). Tune the severity threshold in the routing logic based on your acceptable false-positive rate for blocking versus queuing. What breaks first: false positives on acceptable medical paraphrasing, missed hallucinations in rare disease contexts where the model lacks terminology, and schema non-compliance under high token pressure. Monitor all three in production dashboards.

IMPLEMENTATION TABLE

Expected Output Contract

Validate every field in the hallucination detection output before routing to human review or downstream systems. Reject or repair any output that fails these rules.

Field or ElementType or FormatRequiredValidation Rule

hallucination_report

object

Top-level object must exist and be parseable JSON

hallucination_report.patient_id

string | null

Must match [PATIENT_ID] from input or be null if not provided; null allowed only when input lacks patient identifier

hallucination_report.document_reference

string

Must be non-empty string matching a section or identifier from [SOURCE_DOCUMENT]; reject if fabricated reference

hallucination_report.findings

array

Must be an array with at least 0 items; empty array indicates no hallucinations detected

hallucination_report.findings[].claim_text

string

Must be a direct quote from [GENERATED_OUTPUT]; reject if claim_text does not appear verbatim in the generated output

hallucination_report.findings[].hallucination_type

enum

Must be one of: fabricated_finding, incorrect_dosage, unsupported_diagnosis, missing_contraindication, wrong_entity, temporal_error, attribution_error, other; reject unknown values

hallucination_report.findings[].severity

enum

Must be one of: critical, major, minor; critical requires immediate human review before any downstream use

hallucination_report.findings[].evidence_gap

string

Must describe what source evidence is missing or contradicted; reject if empty or generic placeholder like 'no evidence' without specifics

hallucination_report.findings[].suggested_correction

string | null

If provided, must be grounded in [SOURCE_DOCUMENT] content; null allowed when no correction can be sourced

hallucination_report.findings[].confidence_score

number

Must be a float between 0.0 and 1.0 inclusive; scores below [CONFIDENCE_THRESHOLD] should route to human review regardless of severity

hallucination_report.overall_risk_score

number

Must be a float between 0.0 and 1.0 inclusive; scores above [RISK_THRESHOLD] must block output and escalate to clinical reviewer

hallucination_report.requires_human_review

boolean

Must be true if any finding has severity critical or overall_risk_score exceeds [RISK_THRESHOLD]; false otherwise

hallucination_report.review_instructions

string | null

Required when requires_human_review is true; must contain specific review steps for clinical reviewer; null allowed when no review needed

PRACTICAL GUARDRAILS

Common Failure Modes

Medical hallucination detection fails in predictable ways. These are the most common failure modes when deploying domain-specific detectors in production, with concrete mitigations for each.

01

Paraphrase Penalized as Hallucination

What to watch: The detector flags clinically accurate paraphrases as unsupported because the wording differs from the source. This produces false positives that erode trust and overwhelm review queues. Guardrail: Include paraphrase-acceptance criteria in the prompt with explicit medical synonym mappings. Calibrate against human-annotated paraphrase pairs and set a precision target before deployment.

02

Implied Clinical Knowledge Misclassified

What to watch: The detector flags statements that a clinician would reasonably infer from the source but are not explicitly stated—such as standard contraindications or common drug interactions. This creates noisy alerts for clinically sound outputs. Guardrail: Define an explicit inference boundary in the prompt. Distinguish between common medical knowledge inferences and unsupported leaps. Route borderline cases to human review with a low-confidence label rather than auto-flagging.

03

Numerical Precision Drift

What to watch: The detector misses small but clinically significant numerical errors—dosage shifts, unit conversions, lab value rounding—because the difference appears minor to a general-purpose evaluator. Guardrail: Add a dedicated numerical verification pass that extracts all numbers from both source and output, normalizes units, and flags discrepancies above a domain-specific tolerance threshold. Test against a curated set of known-dangerous numerical errors.

04

Source-Silence Confusion

What to watch: The detector cannot distinguish between a statement that contradicts the source and a statement about something the source simply does not address. Both get flagged as hallucinations, but the clinical risk profiles differ. Guardrail: Add a three-way classification to the prompt: supported, contradicted, and not-addressed-in-source. Use the not-addressed category to trigger evidence-gap logging rather than hallucination alerts.

05

Temporal Context Staleness

What to watch: The detector validates against outdated source material, missing that clinical guidelines, drug approvals, or reference ranges have changed. Outputs are flagged as hallucinated when they actually reflect current evidence the source lacks. Guardrail: Require source date metadata in the prompt context. Instruct the detector to note when source material predates current clinical practice and to suppress hallucination flags for discrepancies attributable to temporal mismatch.

06

Entity Normalization Failures

What to watch: The detector treats the same medical entity expressed in different forms—brand name vs. generic, abbreviation vs. full term, ICD code vs. description—as a mismatch, generating false hallucination flags. Guardrail: Preprocess both source and output through a medical entity normalization step before hallucination detection. Map synonyms, codes, and abbreviations to a unified terminology standard. Validate normalization coverage against your target domain vocabulary.

IMPLEMENTATION TABLE

Evaluation Rubric

Calibrate the hallucination detector against medical NLI benchmarks and clinician annotations. Each criterion defines a pass standard, a failure signal, and a test method for integration into a CI/CD eval harness.

CriterionPass StandardFailure SignalTest Method

MedNLI Accuracy

= 85% accuracy on MedNLI test set

Accuracy drops below 85%

Run prompt against MedNLI benchmark; compare entailment/contradiction/neutral labels

Clinician-Annotated Recall

= 90% recall on clinician-flagged hallucinations

Recall below 90% on gold-standard annotations

Curate 50 clinician-annotated output pairs; measure true positive rate of hallucination flags

Clinician-Annotated Precision

= 80% precision on clinician-flagged hallucinations

Precision below 80% with excessive false positives

Same annotation set; measure false positive rate; flag if >20% of detections are spurious

Fabricated Finding Detection

100% detection of fabricated clinical findings in test suite

Any fabricated finding passes undetected

Inject 20 outputs with fabricated findings; verify all are flagged with severity label

Incorrect Dosage Flagging

100% detection of dosage errors in test suite

Any dosage error passes undetected

Inject 15 outputs with incorrect dosages, frequencies, or units; verify all are flagged

Unsupported Diagnosis Detection

= 95% detection of unsupported diagnoses

Unsupported diagnosis passes undetected or misclassified as minor

Inject 25 outputs with diagnoses lacking evidence support; measure detection rate and severity classification accuracy

Missing Contraindication Flagging

= 90% detection of missing contraindications

Missing contraindication not flagged in safety-critical context

Inject 10 outputs omitting known contraindications; verify flag and severity label; require human review escalation signal

Human Review Escalation Accuracy

100% of safety-critical hallucinations trigger human review flag

Safety-critical hallucination does not trigger review flag

Run full test suite; verify every high-severity hallucination includes [REQUIRES_HUMAN_REVIEW] output field set to true

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and a small set of 20-30 clinical examples. Start with the core hallucination categories (fabricated findings, incorrect dosages, unsupported diagnoses) without the full severity matrix. Run the prompt on synthetic medical summaries before real clinical data.

Simplify the output schema to a flat list of flagged items with claim, category, and evidence_gap fields. Skip the NLI benchmark calibration step initially.

Prompt snippet

code
[SYSTEM] You are a clinical accuracy reviewer. For each statement in [CLINICAL_OUTPUT], flag any claim that cannot be verified against [SOURCE_EVIDENCE]. Return JSON with fields: claim, category, evidence_gap.

Watch for

  • Over-flagging paraphrased content that is semantically equivalent to source material
  • Missing dosage-unit normalization (5mg vs 5 milligrams)
  • False positives on standard-of-care statements that are implicit in the source
  • Model confusing absence of evidence with evidence of absence
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.