This prompt is a triage and prioritization layer for production incident response and quality engineering workflows. It assumes you have already run a detection prompt or evaluation pipeline that identified unsupported claims in a model's output and matched them against the retrieved context captured in a trace. The job-to-be-done is not finding hallucinations—it is deciding which ones demand immediate action. Use this prompt when you have a list of extracted, evidence-matched claims and need to separate a critical safety misstatement that requires a model rollback from a minor stylistic imprecision that can wait for the next prompt update cycle. The ideal user is an incident responder, AI SRE, or quality engineer who needs to communicate severity to the broader team and prioritize remediation tasks.
Prompt
Hallucination Severity Classification from Traces Prompt

When to Use This Prompt
Learn when to apply severity classification to hallucinated claims and when to choose a different tool in your trace analysis pipeline.
The prompt requires three concrete inputs to function correctly. First, a list of claims that have already been flagged as unsupported, each with a claim ID and the generated text. Second, the associated trace context for each claim, including the retrieved passages that were available and the model's final output. Third, your organization's severity definitions, which must map to observable characteristics in the trace rather than abstract categories. A critical severity definition might be 'claim introduces a safety risk, legal liability, or contradicts a regulated fact' while a minor severity definition might be 'claim is imprecise but does not change the user's understanding or decision.' Without these concrete definitions, the model will apply its own inconsistent severity heuristics. The output is a severity-labeled list with per-claim justifications anchored to trace evidence, suitable for ingestion into an incident tracking system or remediation queue.
Do not use this prompt as the first step in hallucination detection. It is a classification layer that sits downstream of claim extraction and evidence matching. If you feed it raw model outputs without pre-extracted claims and trace context, it will attempt to do detection and classification simultaneously, producing unreliable results. Do not use this prompt when you need root-cause analysis—it tells you what is severe, not why the hallucination occurred. For root-cause diagnosis, use the Hallucination Root-Cause Trace Analysis Prompt instead. Do not use this prompt for real-time blocking decisions in a user-facing request path; its role is asynchronous triage and prioritization. If you need to block a response before it reaches the user, implement a streaming guardrail with a binary grounding check, not a multi-class severity classifier. The next step after classification is routing: critical findings go to the incident response channel, major findings go to the prompt engineering backlog, and minor findings feed into continuous improvement tracking.
Use Case Fit
Where the Hallucination Severity Classification from Traces Prompt works, where it fails, and what you need before deploying it into a production monitoring pipeline.
Good Fit: Production Incident Triage
Use when: an incident responder needs to quickly prioritize hallucinated claims by risk level. Guardrail: The prompt's severity labels (critical, major, minor, stylistic) map directly to PagerDuty, Jira, or Slack escalation policies, making it a strong first step in an on-call runbook.
Good Fit: Continuous Monitoring Pipelines
Use when: you run a batch job over production traces to detect regressions. Guardrail: The structured output (severity-labeled claim list) is designed for ingestion into dashboards and alerting systems. Pair with a threshold: if critical count > 0 in a window, trigger an alert.
Bad Fit: Real-Time Guardrails
Avoid when: you need to block a hallucinated response before it reaches the user. Guardrail: This prompt is for post-hoc trace analysis, not synchronous pre-flight checks. For real-time blocking, use a lightweight NLI model or a deterministic rule engine on the output before streaming.
Required Input: A Complete Trace
What to watch: The prompt cannot classify severity without the full context. Guardrail: The input must include the user query, the final generated output, and the retrieved context or tool-call results. A trace missing the retrieval step will cause the prompt to misclassify grounding failures as model over-generalizations.
Operational Risk: Severity Drift
What to watch: The model's definition of 'critical' vs. 'major' can drift across model versions or over long time horizons. Guardrail: Run a weekly calibration test using a golden set of 20 traces with human-verified severity labels. If agreement drops below 90%, tune the prompt's severity definitions or add few-shot examples.
Operational Risk: Cost on High-Volume Traces
Avoid when: you need to classify every single trace in a high-QPS system. Guardrail: Use sampling. Classify only traces that have already been flagged by a cheaper heuristic (e.g., user-reported feedback, low retrieval scores, or an NLI model detecting unsupported claims). This prompt is a precision tool for triage, not a firehose filter.
Copy-Ready Prompt Template
A reusable prompt template for classifying hallucination severity from production traces, ready to copy and adapt with your trace data and severity definitions.
The prompt template below is designed to classify hallucinated claims in a production trace by severity level. It expects a structured trace containing the generated output, retrieved context, and source documents. The model will extract claims, compare them against the evidence in the trace, and assign each unsupported claim a severity label: critical (safety or legal risk), major (factual error with user impact), minor (imprecise but not misleading), or stylistic (acceptable variation). Replace each square-bracket placeholder with your actual trace data and severity definitions before sending to the model. The template includes explicit output schema instructions to ensure structured, machine-readable results suitable for incident triage pipelines and monitoring dashboards.
textYou are a hallucination severity classifier for production AI traces. Your task is to analyze a trace containing a generated output, retrieved context, and source documents, then classify any unsupported claims by severity. ## INPUT [TRACE_DATA] ## SEVERITY DEFINITIONS [SEVERITY_DEFINITIONS] ## INSTRUCTIONS 1. Extract all factual claims from the generated output in the trace. 2. For each claim, check whether it is supported by the retrieved context and source documents in the trace. 3. If a claim is unsupported, classify its severity using the definitions above. 4. For each unsupported claim, provide: - The claim text - The severity level - The closest retrieved passage (if any) - A brief justification for the severity classification - The trace event ID or span reference where the claim appears 5. If no unsupported claims are found, return an empty list with a confidence note. 6. Do not classify stylistic variations or acceptable paraphrasing as hallucinations unless they change the factual meaning. ## CONSTRAINTS [CONSTRAINTS] ## OUTPUT SCHEMA Return a JSON object with this structure: { "trace_id": "string", "analysis_timestamp": "string", "total_claims_extracted": number, "unsupported_claims": [ { "claim_text": "string", "severity": "critical | major | minor | stylistic", "closest_retrieved_passage": "string | null", "trace_event_reference": "string", "justification": "string", "recommended_action": "string" } ], "grounding_summary": "string", "confidence_note": "string" } ## EXAMPLES [EXAMPLES]
Adaptation guidance: Replace [TRACE_DATA] with the full trace object including the generated output, retrieved passages, source document references, and any tool-call logs. Replace [SEVERITY_DEFINITIONS] with your organization's specific severity taxonomy—the template assumes four levels but you can adjust the enum. Use [CONSTRAINTS] to add domain-specific rules such as regulatory requirements, prohibited severity downgrades, or mandatory human-review triggers for critical findings. The [EXAMPLES] placeholder should contain 2-3 few-shot examples showing correct severity classification for your domain's typical hallucination patterns. For high-risk domains like healthcare or legal, add a constraint requiring "recommended_action": "escalate_to_human_review" for all critical and major classifications. The output schema is designed to feed directly into incident management systems, monitoring dashboards, or automated alerting pipelines—ensure your downstream consumers can parse the severity enum and trace_event_reference fields.
Prompt Variables
Required inputs for the Hallucination Severity Classification from Traces prompt. Validate each variable before sending to the model to prevent misclassification and ensure traceable severity assignments.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TRACE_LOG] | Full production trace containing retrieval steps, generated output, tool calls, and metadata for a single request | {"trace_id": "abc123", "spans": [{"span_id": "retrieval_01", "output": "..."}, {"span_id": "generation_01", "output": "The patient's dosage should be 500mg"}]} | Must be valid JSON with trace_id and spans array. Reject if spans array is empty or missing generation span. Parse check required before prompt assembly. |
[GENERATED_OUTPUT] | The final model-generated text extracted from the trace that contains claims to classify | "The patient's dosage should be 500mg based on the clinical guidelines from 2023." | Must be non-empty string extracted from the generation span. Reject if null, whitespace-only, or exceeds 32k characters. Truncation allowed only with truncation marker appended. |
[RETRIEVED_CONTEXT] | Array of retrieved passages or documents from the trace that the model used during generation | [{"source": "guideline_doc_2023.pdf", "content": "Recommended dosage is 250mg for adults.", "span_id": "retrieval_01"}] | Must be an array with at least one entry if RAG was used. Each entry requires source and content fields. Null allowed only for non-RAG traces. Validate content is non-empty string per entry. |
[SEVERITY_DEFINITIONS] | Taxonomy mapping severity levels to decision criteria for consistent classification | {"critical": "Safety or legal risk present", "major": "Factual error with direct user impact", "minor": "Imprecise but not misleading", "stylistic": "Wording preference only"} | Must be a valid JSON object with exactly four keys: critical, major, minor, stylistic. Each value must be a non-empty description string. Reject if definitions are missing or ambiguous. |
[CLAIM_EXTRACTION_INSTRUCTIONS] | Instructions for how to decompose the generated output into atomic claims before classification | "Extract each factual assertion as a separate claim. Ignore opinions, greetings, and disclaimers. Output one claim per line." | Must be a non-empty string. Validate that instructions explicitly require atomic claim decomposition. Reject if instructions would cause the model to classify entire output as a single claim. |
[OUTPUT_SCHEMA] | Expected JSON schema for the severity-labeled claim list | {"claims": [{"claim_text": "...", "severity": "major", "evidence_status": "unsupported", "closest_retrieved_passage": "...", "trace_span_id": "..."}]} | Must be a valid JSON Schema object or example structure. Validate that required fields include claim_text, severity, and evidence_status. Reject if schema allows severity values outside the defined taxonomy. |
[SAFETY_POLICY_REFERENCE] | Reference to organizational safety or compliance policy that defines critical-severity triggers | "Per ACME Corp AI Safety Policy v2.1: Critical severity applies to claims involving medication dosage, surgical procedures, or emergency response instructions." | Must be a non-empty string if domain involves safety-critical outputs. Null allowed for non-safety domains. When present, validate that policy reference is specific and actionable, not a generic disclaimer. |
Implementation Harness Notes
How to wire the Hallucination Severity Classification prompt into an incident triage or monitoring pipeline.
This prompt is designed to operate as a classification microservice within a broader observability stack. It expects a structured trace input containing the generated output, the retrieved context, and any tool-call results. The primary integration point is a post-retrieval, pre-user-response hook in a RAG pipeline, or a batch processor that scans logged traces from a data warehouse. The output is a severity-labeled claim list, which downstream systems can use to trigger alerts, populate dashboards, or prioritize human review queues.
To wire this into an application, wrap the prompt in a function that validates the input trace schema before calling the model. The trace must include generated_output, retrieved_context (as a list of document objects with id and content), and optional tool_outputs. After receiving the model response, run a strict JSON schema validator against the expected output structure: a list of objects, each with claim, severity (one of critical, major, minor, stylistic), evidence_status (supported, unsupported, contradicted), and source_reference. If validation fails, implement a single retry with the validation error message injected into the prompt as additional [CONSTRAINTS]. Log both the raw and validated outputs to your observability platform, attaching the trace ID for correlation. For high-risk domains, route all critical and major findings to a human review queue before any automated action is taken.
Model choice matters here. Use a model with strong instruction-following and structured output capabilities, such as GPT-4o or Claude 3.5 Sonnet, and set a low temperature (0.0–0.2) to maximize consistency. Avoid using this prompt on streaming endpoints; the full trace context must be available before classification begins. For cost control in high-volume pipelines, consider sampling traces based on user-reported issues or low confidence scores from an upstream faithfulness evaluator, rather than classifying every single request. The next step after implementation is to build an eval set of 50–100 traces with known hallucination severities, run this prompt against them, and calibrate your alert thresholds based on the precision and recall of critical and major detections.
Expected Output Contract
Defines the structure, types, and validation rules for the model response when classifying hallucination severity from traces. Use this contract to parse, validate, and route the output in your incident triage pipeline.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
severity_classifications | Array of objects | Must be a JSON array. If no hallucinations are found, return an empty array. Reject if not parseable as an array. | |
severity_classifications[].claim_text | String | Must be a non-empty string containing the exact verbatim claim from the generated output. Reject if null, empty, or whitespace-only. | |
severity_classifications[].trace_span_id | String or null | Must reference a valid span ID from the provided trace context or be null if the claim cannot be anchored to a specific trace event. Reject if ID format does not match trace schema. | |
severity_classifications[].severity | Enum: critical, major, minor, stylistic | Must be exactly one of the four allowed values. Reject on case mismatch, extra whitespace, or unrecognized labels. Map any other output to a parse error. | |
severity_classifications[].rationale | String | Must be a non-empty string explaining why the severity was assigned, referencing the retrieved context or lack thereof. Reject if null or empty. Flag for human review if shorter than 20 characters. | |
severity_classifications[].retrieved_evidence_used | Boolean | Must be true if the claim was compared against retrieved passages in the trace, false if no evidence was available. Reject if not a strict boolean. | |
severity_classifications[].closest_evidence_span | String or null | If provided, must be a verbatim excerpt from the retrieved context in the trace. If null, no matching evidence was found. Validate by substring match against trace context; flag mismatch for review. | |
overall_severity | Enum: critical, major, minor, stylistic, none | Must be the highest severity found across all claims, or 'none' if the array is empty. Reject if inconsistent with the max severity in the classifications array. |
Common Failure Modes
What breaks first when classifying hallucination severity from traces and how to guard against it.
Severity Inflation for Vague Claims
What to watch: The model classifies imprecise or ambiguous statements as 'major' or 'critical' because it cannot verify them, rather than recognizing them as 'minor' stylistic issues. Guardrail: Add explicit definitions and few-shot examples distinguishing 'minor (imprecise but not misleading)' from 'major (factual error with user impact)' in the prompt.
Missing Safety-Critical Hallucinations
What to watch: The model fails to flag a hallucination as 'critical' when it involves contraindications, legal obligations, or financial thresholds because the domain-specific risk is not explicitly defined. Guardrail: Maintain a domain-specific taxonomy of critical topics (e.g., dosage, contract terms, regulatory deadlines) and inject it into the prompt as a [CRITICAL_TOPICS] variable.
Trace Context Window Truncation
What to watch: The full trace exceeds the context window, causing the model to classify claims without seeing the retrieved evidence that proves or disproves them. Guardrail: Pre-process traces to extract only the claim, the generated output, and the top-k relevant source spans. If the trace is too large, split claims into batches and classify independently.
Over-Reliance on Source Presence
What to watch: The model assumes any claim with a nearby citation is grounded, missing that the cited source does not actually support the specific claim. Guardrail: Require the model to output a 'source support' justification for each claim before assigning severity. Pair this prompt with a citation-to-source alignment audit step.
Inconsistent Severity Across Batches
What to watch: The same type of hallucination receives different severity labels across different traces due to model non-determinism or subtle prompt drift. Guardrail: Use a low temperature (0-0.1) for classification. Implement a post-processing validator that checks output schema compliance and flags severity label distribution shifts for human review.
Confusing Stylistic Choices with Errors
What to watch: The model flags tone, verbosity, or formatting preferences as 'minor' hallucinations, polluting the severity report with non-factual issues. Guardrail: Explicitly define 'stylistic' as 'no factual claim is made or contradicted' in the prompt instructions. Add a pre-filter step that separates factual claims from stylistic observations before classification.
Evaluation Rubric
Run this rubric on a golden set of 20 annotated traces with known severity labels to calibrate the prompt before production deployment. Each criterion targets a specific failure mode in hallucination severity classification.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Critical Severity Recall | 100% of known critical claims (safety/legal risk) are classified as critical | Any critical claim misclassified as major, minor, or stylistic | Compare output labels against golden-set annotations for all traces containing critical claims |
Major Severity Precision | ≥90% of claims classified as major are actually major in the golden set | Minor or stylistic claims incorrectly escalated to major severity | Calculate false positive rate for major classification across all 20 traces |
Minor Severity Discrimination | ≥85% of minor claims correctly distinguished from stylistic claims | Minor claims labeled as stylistic or stylistic claims labeled as minor in >15% of cases | Confusion matrix analysis between minor and stylistic categories on annotated traces |
Claim Completeness | All hallucinated claims present in the golden set appear in the output claim list | Missing claims from the output that were annotated as hallucinated in the golden set | Set intersection check: output claim count must match golden-set claim count within ±1 |
Severity Justification Quality | Every severity label includes a trace-anchored reason referencing specific evidence or its absence | Severity labels provided without justification or with justifications that don't reference trace events | Manual review of justification field against trace event IDs for 5 randomly sampled claims |
Non-Hallucination Exclusion | Zero claims from the golden set marked as grounded are included in the output | Grounded claims appearing in the hallucination severity output | Diff output claim list against golden-set grounded-claim list; any overlap is a failure |
Output Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present | Missing fields, extra fields, or malformed JSON that fails schema validation | Automated JSON Schema validation against the expected output contract |
Trace Event Reference Accuracy | ≥95% of claims reference correct trace event IDs from the input trace | Trace event IDs that don't exist in the input trace or point to unrelated events | Cross-reference all output trace event IDs against the input trace event list |
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
Use the base prompt with a simplified severity scale (e.g., critical, non-critical). Run against a small batch of 10-20 traces and manually review all classifications. Skip structured output enforcement initially; accept markdown lists and validate by hand.
Watch for
- Over-classification of minor imprecision as
major - Missing trace event references in the output
- Model conflating
stylisticwithminorwhen the phrasing changes meaning

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