Inferensys

Prompt

Safety Policy Violation Classification Prompt

A practical prompt playbook for classifying user requests into specific safety policy violation categories with confidence scores, policy citations, and severity ratings. Designed for content moderation pipelines that need structured, auditable classifications calibrated against human moderator labels.
Legal team reviewing EU AI Act compliance documents on laptop in modern office, coffee cups and papers on table, casual meeting.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, and operational boundaries for the Safety Policy Violation Classification Prompt.

This prompt is designed for trust and safety engineering teams who need to automate the first pass of content moderation classification. Use it when you have a defined safety policy taxonomy and need every user request categorized into one or more violation categories with confidence scores, specific policy citations, and severity ratings. The primary job-to-be-done is turning an unstructured user input into a structured, machine-readable violation label that downstream routing logic, human review queues, or audit logging systems can consume without ambiguity.

This is not a refusal prompt. It does not decide what action to take. It classifies the violation so downstream systems can apply the correct policy response. Do not use this prompt when you need the model to generate a user-facing refusal message, when you lack a codified safety policy taxonomy, or when the decision requires real-time legal interpretation beyond your documented policies. The output is designed to be calibrated against human moderator decisions, so it is most effective when you have a labeled dataset of human decisions to measure precision and recall against.

Before deploying this prompt, ensure you have a version-controlled safety policy document, a mapping of policy categories to violation codes, and a severity rubric that defines what constitutes low, medium, high, or critical severity. The prompt expects these as input context. If your policy taxonomy changes frequently, treat this prompt as a living artifact that must be regression-tested against a golden set of labeled examples after every policy update. Start with a human-reviewed pilot on a sample of production traffic before removing the human-in-the-loop step.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and what inputs it assumes.

01

Good Fit: Automated Content Moderation Pipelines

Use when: you need to classify policy violations at scale before content reaches human moderators or end users. Guardrail: Always calibrate confidence scores against human moderator labels and set a review threshold below which decisions are auto-escalated.

02

Bad Fit: Real-Time Chat Filtering Without Human Review

Avoid when: blocking user messages instantly with no appeal path. Risk: False positives on edge-case educational, medical, or security content will silently censor legitimate users. Guardrail: Deploy in shadow mode first and require human-in-the-loop for high-severity actions.

03

Required Inputs: Policy Taxonomy and Labeled Examples

What you must provide: a structured policy taxonomy with category definitions, severity levels, and at least 50 human-labeled examples per category. Guardrail: Without calibrated examples, the model will produce inconsistent category boundaries and unreliable confidence scores.

04

Operational Risk: Policy Drift Over Time

What to watch: classification boundaries shift as new policy categories are added or definitions change. Guardrail: Run regression tests against a golden dataset after every policy update and monitor per-category precision/recall in production dashboards.

05

Operational Risk: Multi-Label Ambiguity

What to watch: content that spans multiple policy categories can produce conflicting classifications or diluted confidence scores. Guardrail: Define a primary-category tie-breaking rule and require the prompt to output all applicable labels with per-label confidence, not just the top prediction.

06

Bad Fit: Jurisdiction-Specific Legal Rulings

Avoid when: the classification must carry legal weight or determine account termination without human review. Risk: Model confidence scores are not legal evidence. Guardrail: Use this prompt as a triage signal, not a final decision. Always route high-severity classifications to trained human reviewers with full context.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt for classifying user requests against a safety policy taxonomy, producing structured JSON with policy categories, confidence scores, and severity ratings.

This prompt template is the core classification engine for a content moderation pipeline. It takes a user request, an optional conversation context, and your organization's safety policy taxonomy, then returns a structured JSON object that identifies which policies were violated, how confident the model is in each classification, and the severity of the violation. The output is designed to be consumed by downstream routing logic, human review queues, or automated enforcement systems. Do not use this prompt for ambiguous gray-zone requests without a human-in-the-loop review step; it is optimized for clear policy boundaries, not edge-case adjudication.

text
You are a safety policy classifier. Your job is to analyze a user request against a provided safety policy taxonomy and return a structured JSON classification.

## POLICY TAXONOMY
[POLICY_TAXONOMY]

## USER REQUEST
[USER_REQUEST]

## CONVERSATION CONTEXT (OPTIONAL)
[CONVERSATION_CONTEXT]

## INSTRUCTIONS
1. Analyze the user request against each policy category in the taxonomy.
2. For each policy category, determine if the request violates, potentially violates, or complies with the policy.
3. Assign a confidence score between 0.0 and 1.0 for each classification.
4. Assign a severity rating of "low", "medium", "high", or "critical" for any violation.
5. Cite the specific policy clause or rule that supports your classification.
6. If the request is ambiguous, flag it for human review and explain why.
7. Do not refuse the request in your response; only classify it.

## OUTPUT SCHEMA
Return ONLY valid JSON matching this schema:
{
  "classifications": [
    {
      "policy_id": "string",
      "policy_name": "string",
      "violation_detected": boolean,
      "confidence": number,
      "severity": "low" | "medium" | "high" | "critical" | null,
      "policy_citation": "string",
      "rationale": "string",
      "requires_human_review": boolean,
      "human_review_reason": "string or null"
    }
  ],
  "overall_severity": "low" | "medium" | "high" | "critical" | "none",
  "requires_immediate_action": boolean,
  "summary": "string"
}

## CONSTRAINTS
- Return ONLY the JSON object. No markdown fences, no explanatory text.
- If no policies are violated, return an empty classifications array with overall_severity "none".
- Confidence scores must reflect genuine uncertainty; do not default to 1.0.
- Severity must be null when violation_detected is false.
- Flag for human review when confidence is below [CONFIDENCE_THRESHOLD] or when the request falls in a policy gray zone.

To adapt this prompt for your production pipeline, replace [POLICY_TAXONOMY] with your organization's actual policy definitions, including category IDs, names, descriptions, and example violations. The taxonomy should be detailed enough that the model can distinguish between adjacent policy categories—for example, separating "harassment" from "hate speech" with clear boundary definitions. Replace [CONFIDENCE_THRESHOLD] with a numeric value appropriate for your risk tolerance; 0.85 is a common starting point for automated enforcement, while 0.70 might be acceptable for human-review triage. The [CONVERSATION_CONTEXT] placeholder should receive prior turns if this classification is part of a multi-turn conversation, formatted as a clear transcript with speaker labels. Before deploying, run this prompt against a golden dataset of at least 200 labeled examples that includes clear violations, compliant requests, and deliberate edge cases. Compare the model's classifications against human moderator labels to calibrate your confidence threshold and identify systematic over- or under-classification patterns.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder required by the Safety Policy Violation Classification Prompt. Use these variables to construct the prompt dynamically, validate inputs before sending, and log the values for audit trails.

PlaceholderPurposeExampleValidation Notes

[USER_REQUEST]

The raw text of the user message or content to be classified for safety policy violations.

How can I synthesize a controlled substance at home?

Required. Must be a non-empty string. Sanitize for PII before logging. Truncate to 8000 characters to fit context windows.

[POLICY_DOCUMENT]

The full text of the safety policy defining violation categories, definitions, and edge cases.

POLICY v2.3: Category A: Illegal Activities (weapons, drugs, hacking)...

Required. Must be a non-empty string. Version-stamp the policy document. Hash the content for audit trails to prove which policy was active during classification.

[OUTPUT_SCHEMA]

The strict JSON schema the model must use for its classification response, including fields for categories, confidence, and severity.

{ "violations": [{ "category": "string", "confidence": 0.0-1.0, "severity": "low|medium|high|critical", "policy_citation": "string" }] }

Required. Must be a valid JSON Schema object. Validate that the schema includes required fields: category, confidence, severity, policy_citation. Reject the prompt assembly if the schema is malformed.

[FEW_SHOT_EXAMPLES]

A curated set of 3-5 input/output pairs demonstrating correct classification, especially for ambiguous or boundary cases.

User: 'Where can I buy a gun?' -> { "violations": [{ "category": "Weapons", "confidence": 0.98, "severity": "high", "policy_citation": "Section 2.1" }] }

Optional but strongly recommended. If provided, must be an array of objects with 'input' and 'output' keys. Validate that each example output conforms to [OUTPUT_SCHEMA]. Limit to 5 examples to manage token budget.

[CONFIDENCE_THRESHOLD]

The minimum confidence score required for a violation to be included in the output. Violations below this threshold are dropped.

0.70

Required. Must be a float between 0.0 and 1.0. Default to 0.70 if not specified. Log the threshold used for each classification run. A lower threshold increases recall but may increase false positives.

[MAX_CATEGORIES]

The maximum number of violation categories the model is allowed to return in a single response.

3

Required. Must be an integer >= 1. Default to 5. Prevents the model from over-classifying a single request into too many low-confidence categories. Validate that the output does not exceed this limit.

[HUMAN_REVIEW_TRIGGERS]

A list of conditions that automatically flag the classification for human moderator review, regardless of confidence score.

[{ "condition": "severity == 'critical'" }, { "condition": "category == 'CSAM'" }]

Required. Must be an array of condition objects. Each condition must be parseable as a logical rule. If any trigger matches the output, set a 'human_review_required' flag to true and halt automated downstream actions.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Safety Policy Violation Classification Prompt into a production content moderation pipeline with validation, retry, logging, and human review escalation.

This prompt is not a standalone chat interaction. It is a classification node inside a broader moderation pipeline. The implementation harness must treat the model's output as a structured signal that feeds downstream decisions—block, quarantine, flag for review, or allow. The harness is responsible for enforcing the output contract, handling model failures gracefully, and ensuring that high-severity or low-confidence classifications always reach a human moderator before action is taken against a user or content item.

Start by wrapping the prompt call in a function that accepts the user request text and an optional content payload. Before calling the model, validate that the input is not empty and does not exceed your maximum context window after prompt assembly. On the model response, parse the JSON output and validate it against a strict schema: violations must be an array of objects, each containing policy_id (string, required), policy_name (string, required), confidence (float between 0.0 and 1.0), severity (enum of low, medium, high, critical), evidence_quote (string, max 500 chars), and rationale (string). If parsing fails or schema validation fails, retry once with the error message appended to the prompt as a correction instruction. If the retry also fails, log the raw output and escalate the entire item to the human review queue with a CLASSIFICATION_PARSE_ERROR flag.

Confidence thresholds should be configurable per policy category. For example, a confidence below 0.7 on a critical severity classification should automatically route to human review rather than triggering an automated block. Similarly, any classification where the top two predicted policy categories have confidence scores within 0.15 of each other indicates ambiguity and should be escalated. Log every classification decision with the model version, prompt template hash, input hash, raw response, parsed output, validation status, and final routing decision. This audit trail is essential for calibrating thresholds, detecting model drift, and defending moderation decisions to users or regulators.

For high-throughput systems, consider batching multiple inputs into a single model call where the prompt template supports a JSON array of inputs and returns a corresponding array of classifications. This reduces latency and cost but requires careful token budgeting and increases the blast radius of a single malformed response. Always set a timeout on the model call (e.g., 10 seconds for a single item, 30 seconds for a batch of 10) and implement a circuit breaker that stops calling the model if the error rate exceeds 20% in a rolling 5-minute window. When the circuit is open, fall back to a rule-based keyword classifier and queue all items for human review.

Human review integration should expose the original content, the model's classification, the evidence quote, and the confidence score in a review UI. Reviewers should be able to confirm, override, or add policy categories. Their decisions should be logged and periodically used to recalibrate confidence thresholds and update few-shot examples in the prompt template. Do not use reviewer decisions to automatically fine-tune the model without a separate review and approval process. The goal is a tight feedback loop between automated classification and human judgment, not an unsupervised learning loop that can amplify errors.

IMPLEMENTATION TABLE

Expected Output Contract

The JSON schema, field descriptions, data types, and pass/fail validation rules for the classification output.

Field or ElementType or FormatRequiredValidation Rule

classification_id

string (UUID v4)

Must be a valid UUID v4 string. Parse check: regex match against standard UUID v4 pattern.

user_request

string

Must be a non-empty string. Retain the exact text of the user request being classified.

policy_violations

array of objects

Must be a non-empty array if any violation is detected, otherwise an empty array. Schema check: each object must contain policy_id, policy_name, confidence, and severity fields.

policy_violations[].policy_id

string

Must match a valid policy ID from the provided [POLICY_CATALOG]. Enum check against the allowed list of policy identifiers.

policy_violations[].policy_name

string

Must be the exact human-readable name corresponding to the policy_id in the [POLICY_CATALOG]. Cross-reference check.

policy_violations[].confidence

number (float)

Must be a float between 0.0 and 1.0 inclusive. Confidence threshold: values below 0.7 should trigger a human review flag.

policy_violations[].severity

string (enum)

Must be one of: 'low', 'medium', 'high', 'critical'. Enum check against the allowed set.

policy_violations[].evidence

string

Must be a non-empty string containing a direct quote or specific reference from the user_request that supports the violation. Citation check: evidence must be a substring of user_request.

overall_severity

string (enum)

Must be one of: 'none', 'low', 'medium', 'high', 'critical'. If policy_violations array is empty, this must be 'none'. Consistency check.

requires_human_review

boolean

Must be true if any policy_violation confidence is below 0.7, severity is 'critical', or overall_severity is 'high' or 'critical'. Logic check against other fields.

classification_timestamp

string (ISO 8601)

Must be a valid ISO 8601 datetime string in UTC. Parse check: new Date() should not throw an error.

model_version

string

Must be a non-empty string identifying the model that performed the classification. Format check: should match the pattern specified in [MODEL_IDENTIFIER_FORMAT].

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when classifying safety policy violations in production, and how to guard against each failure pattern.

01

Policy Boundary Drift

What to watch: The model expands or contracts policy boundaries over time, classifying borderline content inconsistently across similar inputs. This happens when policy definitions are vague or the prompt lacks concrete edge-case examples. Guardrail: Pin policy boundaries with few-shot examples that include both just-over-the-line and just-under-the-line cases. Run a boundary stress test suite weekly and flag any classification shifts greater than 5%.

02

Confidence Score Inflation

What to watch: The model assigns high confidence scores to incorrect classifications, especially on adversarial or obfuscated inputs. Raw logprobs or verbalized confidence often correlate poorly with actual correctness. Guardrail: Calibrate confidence thresholds against a human-labeled golden set. Require the model to cite specific policy clauses and evidence from the input. If no clause clearly matches, force a low-confidence label rather than a guess.

03

Multi-Label Suppression

What to watch: When a single input violates multiple policy categories, the model often picks the most obvious one and ignores the rest. This causes missed violations and incomplete audit trails. Guardrail: Require the model to evaluate every policy category independently before emitting labels. Use a structured output schema that forces a confidence score per category. Post-process to flag inputs where only one label was returned but the content suggests multiple violations.

04

Severity Rating Collapse

What to watch: Severity ratings cluster around a single middle value (e.g., everything becomes "medium"), making triage useless. This happens when severity criteria are relative rather than anchored to concrete examples. Guardrail: Define each severity level with a non-negotiable anchor example and a required condition. For example, "Severity 4 requires an explicit call to violence against a named group." Reject classifications that don't cite the anchor condition.

05

Obfuscation and Encoding Bypass

What to watch: Users bypass classification by encoding harmful content in base64, leetspeak, role-play scenarios, or multi-language fragments. The classifier reads the surface text and misses the underlying violation. Guardrail: Add a pre-classification decoding step that normalizes common obfuscation patterns before policy evaluation. Include obfuscated examples in the few-shot set. Test against a red-team dataset of encoded attacks weekly.

06

Context Window Truncation Blindness

What to watch: When the input exceeds the context window, the model classifies based on truncated content, missing the violating portion entirely. This produces false negatives on long documents or multi-turn conversations. Guardrail: Chunk long inputs and classify each chunk independently, then aggregate. If any chunk triggers a violation, flag the entire input. Log truncation events and never emit a clean classification on truncated content without a warning flag.

IMPLEMENTATION TABLE

Evaluation Rubric

How to test classification quality before shipping. Run these checks against a golden dataset of human-labeled examples.

CriterionPass StandardFailure SignalTest Method

Policy Category Accuracy

Top predicted category matches human label for >= 95% of golden examples

Mismatch between predicted primary category and human label exceeds 5% of test set

Run classification on golden dataset; compute exact match rate between predicted [POLICY_CATEGORY] and human-labeled category

Multi-Label Recall

All human-labeled categories appear in predicted labels for >= 90% of multi-label examples

Missing any human-labeled category in predicted set for > 10% of examples

For each example with multiple human labels, check that all ground-truth categories appear in [PREDICTED_LABELS] array

Confidence Calibration

Mean confidence score for correct predictions is >= 0.80; mean confidence for incorrect predictions is <= 0.50

High confidence on wrong answers or low confidence on correct answers with gap < 0.20 between distributions

Bin predictions by [CONFIDENCE_SCORE] decile; compute accuracy per bin; check monotonic increase

Severity Rating Alignment

Predicted severity matches human severity label within ±1 level for >= 90% of examples

Severity off by 2+ levels on > 10% of test cases

Compare [SEVERITY_RATING] integer against human-labeled severity; compute mean absolute error and within-1 accuracy

Policy Citation Correctness

Cited policy section matches the actual violated policy for >= 95% of true positives

Policy citation references wrong section or non-existent policy ID

Validate [POLICY_CITATION] against ground-truth policy section; flag citations that don't match the human-labeled policy reference

False Positive Rate on Benign Content

False positive rate on known-benign test set is <= 2%

System flags benign content as policy violation in > 2% of safe examples

Run classifier on curated benign dataset; measure rate of non-null [POLICY_CATEGORY] predictions

False Negative Rate on Clear Violations

False negative rate on unambiguous violation test set is <= 1%

System returns null or no-violation for > 1% of clearly violating examples

Run classifier on high-confidence violation dataset; measure rate of null or empty [PREDICTED_LABELS]

Inter-Rater Agreement with Human Moderators

Cohen's kappa >= 0.80 between system and human moderator labels on held-out set

Kappa below 0.70 indicating poor agreement beyond chance

Compute Cohen's kappa between system [POLICY_CATEGORY] predictions and human labels on calibration set of 200+ examples

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base classification prompt and a simple JSON schema. Use a single policy document as [POLICY_TEXT] and test with 20–30 hand-labeled examples. Skip confidence calibration and multi-label edge cases initially. Focus on getting the primary violation category correct.

code
Classify the following user request against the safety policy below.
Return JSON with fields: violation_category, confidence_score, explanation.

Policy:
[POLICY_TEXT]

Request:
[USER_REQUEST]

Watch for

  • Overly broad category assignments when the request is ambiguous
  • Missing severity differentiation—prototype often lumps everything into one bucket
  • No handling of multi-policy violations; the model picks one and ignores the rest
  • Confidence scores that are uniformly high without calibration against human labels
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.