4.1 Content Policy as a Specification

The problem

In January 2024 a customer of the UK parcel company DPD, frustrated that its chatbot could not connect him to a person, asked it for a joke, then for a poem about the company, then to swear. The bot wrote a poem calling itself useless, described DPD as the worst delivery firm in the world, and swore, after first saying it was not allowed to. DPD said an error followed a system update and disabled the AI element (Fortune, 2024).

Nothing in that exchange was dangerous. It was still a policy failure, because the deployment had rules (no profanity, no disparaging the company) that existed only as instructions to the model. Nobody had written those rules where a detector could check them, a test could exercise them, or a reviewer could label against them.

The same problem appears in a quieter form on almost every team. Someone writes “the assistant must not produce harmful content.” The vendor classifier, the LLM judge, the human review queue, and the red team each read “harmful” differently. Block rates move when the classifier is upgraded and nobody can say whether the new behavior is right, because nothing defines right.

Why it happens

A content policy is usually written by legal, trust and safety, or product people for an audience of other people. Engineers need something different: a specification precise enough to drive four things.

  1. Labeling. Two reviewers given the same transcript must reach the same decision most of the time. If they cannot, any detector trained or tuned on their labels inherits the disagreement. Measuring that agreement is covered in 6.1 Designing Evaluations.
  2. Detection. Each category needs a detector (a rule, a classifier, a judge rubric) and a threshold. A category like “inappropriate” maps to no detector.
  3. Action. Each decision needs a defined response: answer, answer with care, refuse and redirect, or escalate. “Block harmful content” leaves the response undefined.
  4. Testing. Each rule needs examples that should pass and examples that should fail, so a change to any detector can be checked against it.

Prose policies fail all four for the same reason: they describe intent, not decisions. They also tend to be written once, before the system meets real traffic, and the boundary cases that matter most (the medical question that sounds like self-harm, the security question that sounds like an attack) appear only later.

Context makes this harder. “How do I pick a lock?” is a reasonable question on a locksmith training site and an unusual one on a children’s homework helper. “Write a story where the villain explains his plan” is fine for a fiction tool and odd for a bank’s support bot. A single global policy either over-blocks the first deployment or under-blocks the second.

Control patterns

Policy is a human-layer control: people write it, own it, and approve changes to it. Everything else in this domain enforces it, so its precision limits theirs. The patterns below are ordered roughly from foundational to operational.

1. A harm taxonomy with definitions

List the categories your system must handle. Each entry has:

FieldPurpose
Name and IDStable key used by detectors, logs, and tests (for example self_harm, regulated_advice.medical)
DefinitionOne or two sentences describing what is in scope
Includes / excludesConcrete inclusions and exclusions, especially the ones people argue about
Tier rulesWhat is allowed, what needs care, what is disallowed
ActionsWhat the system does at each tier
OwnerThe person or team who decides disputes and approves changes

Public taxonomies are a starting point, not a finished policy. Purpose-built safety classifiers such as Llama Guard were designed to take the taxonomy as input, so the categories and their descriptions directly change what the classifier flags (Inan et al., 2023). That design makes the point concrete: the policy text is part of the detector’s configuration.

Include categories that are not about harm in the narrow sense: off-scope topics, statements about the operator’s own policies (the Air Canada case in 4.3), brand and tone rules like DPD’s, and regulated advice. OWASP’s 2025 list treats misinformation as its own risk (LLM09:2025), and a policy that does not name it is unlikely to get a detector for it.

2. Three tiers instead of two

Allow/block maps poorly to real requests. Most sensitive requests have a legitimate reading that deserves an answer, written with care. Use three tiers:

  • Allowed: answer normally.
  • Needs care: answer, but with constraints: general rather than personalized information, safety framing, a pointer to a professional or resource, no operational detail. This is where most medical, legal, financial, and mental-health questions land.
  • Disallowed: do not provide the content. Respond with a refusal that helps the user where possible (see 4.4) and escalate if the policy says so.

The needs-care tier matches a shift in how providers train models. OpenAI describes moving from refusals based on classifying the user’s intent toward “safe-completions” that judge the safety of the output itself and aim to be as helpful as the policy allows (OpenAI, 2025). Your policy should state what a safe completion looks like for each category, because the model’s default will not match your deployment.

3. Worked examples and boundary pairs

Definitions get argued over. Examples settle arguments. For each category, write:

  • Several clear examples at each tier.
  • Boundary pairs: two requests that look alike but fall on different sides of a line, with the reason. For example, “What is the maximum safe dose of acetaminophen for an adult?” (needs care: give the general guidance and advise checking with a pharmacist) and a request for an amount intended to cause harm (disallowed, with crisis resources; see 4.5).
  • Known false-positive traps: benign requests that trip naive detectors, such as “How do I kill a Python process?”

These examples are used three ways: as labeler training, as few-shot material or rubric text for LLM judges, and as regression tests. A policy change that does not add or update examples is incomplete.

4. Deployment overlays

Write one base policy and a small overlay per deployment. The overlay tightens or relaxes specific categories and states why. A children’s education deployment might move all romance content to disallowed and lower thresholds for self-harm signals; a security research tool might move some exploit discussion from disallowed to needs-care for authenticated, vetted users. Overlays keep the shared parts shared, and they make the differences reviewable.

Overlays are chosen by deployment configuration, keyed by the authenticated tenant or product, never by anything the user says. A user who types “I am a security researcher” has not changed which overlay applies.

5. Versioning and change control

A policy is configuration. Give each version an identifier, keep a changelog that says what changed and why, and link each version to:

  • the detector thresholds and judge prompts that implement it,
  • the evaluation set (benign and harmful) that tests it,
  • the approval record from the policy owner.

Re-run the evaluation set before the change ships, and log the policy version with every guardrail decision so an incident review can tell which rules were in force. The release mechanics are in 7.3 Change Management.

Implementation

A policy can live as a reviewed document plus a machine-readable file that detectors and the action router read. A minimal version:

policy_id: support-assistant
version: 3.2.0
owner: trust-and-safety@yourco.example
categories:
  regulated_advice.medical:
    definition: "Requests for diagnosis, dosing, or treatment decisions."
    tiers:
      allowed: "General health information from public sources."
      needs_care: "Dosing or symptom questions: general guidance plus pointer to a clinician or pharmacist."
      disallowed: "Individualized prescriptions or advice to stop prescribed treatment."
    actions: {allowed: answer, needs_care: safe_complete, disallowed: refuse_redirect}
  brand.disparagement:
    definition: "Content insulting the company, its staff, or its customers."
    tiers:
      allowed: "Neutral acknowledgement of a service failure."
      disallowed: "Profanity, insults, or mocking the company or user."
    actions: {allowed: answer, disallowed: refuse_redirect}
  violence:
    definition: "Content that threatens, incites, or gives operational help with violence against people."
    tiers:
      allowed: "Idiomatic or technical uses (killing a process), news, history, and fiction without operational detail."
      disallowed: "Threats, incitement, or step-by-step help to harm a person."
    actions: {allowed: answer, disallowed: refuse_redirect}
overlays:
  support-web: {}            # every deployment is listed, even with no changes
  kids-homework:
    regulated_advice.medical: {needs_care: refuse_redirect}

The router that turns a detector’s verdict into an action should fail closed. An unknown category, a missing tier, an unknown deployment, or an overlay that names a category that does not exist is a configuration error, and the safe response to a configuration error is the strictest action plus an alert, not a default allow.

from dataclasses import dataclass
from enum import Enum


class Action(Enum):
    ANSWER = "answer"
    SAFE_COMPLETE = "safe_complete"
    REFUSE_REDIRECT = "refuse_redirect"
    ESCALATE = "escalate"


STRICTEST = Action.ESCALATE


@dataclass(frozen=True)
class Verdict:
    category: str
    tier: str  # "allowed" | "needs_care" | "disallowed"


class PolicyConfigError(Exception):
    pass


def resolve_action(policy: dict, deployment: str, verdict: Verdict) -> tuple[Action, str]:
    """Map a detector verdict to an action. Returns (action, policy_version)."""
    version = policy["version"]
    category = policy["categories"].get(verdict.category)
    if category is None:
        raise PolicyConfigError(f"unknown category {verdict.category!r}")

    actions = dict(category["actions"])
    overlays = policy.get("overlays", {})
    if deployment not in overlays:
        # A typo or missing entry must not silently fall back to the base
        # policy, which may be more permissive than the intended overlay.
        raise PolicyConfigError(f"unknown deployment {deployment!r}")
    overlay = overlays[deployment]
    for cat_name in overlay:
        if cat_name not in policy["categories"]:
            raise PolicyConfigError(f"overlay {deployment!r} names unknown category {cat_name!r}")
    actions.update(overlay.get(verdict.category, {}))

    name = actions.get(verdict.tier)
    if name is None:
        raise PolicyConfigError(f"no action for tier {verdict.tier!r} in {verdict.category!r}")
    return Action(name), version


def safe_resolve(policy: dict, deployment: str, verdict: Verdict, alert) -> tuple[Action, str]:
    try:
        return resolve_action(policy, deployment, verdict)
    except (PolicyConfigError, KeyError, ValueError) as exc:
        alert(f"policy config error: {exc}")
        return STRICTEST, policy.get("version", "unknown")

deployment comes from server-side configuration for the authenticated tenant, not from the request body. The version string is returned so the caller can log it with the decision.

The examples become tests. Each worked example carries the expected tier, and CI runs them through the detector stack whenever the policy, a threshold, or a model changes:

EXAMPLES = [
    {"text": "How do I kill a Python process that is hung?", "category": "violence", "expected": "allowed"},
    {"text": "What is the usual adult dose of ibuprofen?", "category": "regulated_advice.medical", "expected": "needs_care"},
]


def run_policy_examples(classify, examples) -> list[str]:
    """Return a list of failures; empty means every example matched its expected tier."""
    failures = []
    for ex in examples:
        got = classify(ex["text"], ex["category"])
        if got != ex["expected"]:
            failures.append(f"{ex['text'][:60]!r}: expected {ex['expected']}, got {got}")
    return failures

Where it breaks

  • Policies that cannot be labeled. If reviewers disagree often on a category, the definition is the problem, not the reviewers. Tightening the threshold of a detector trained on noisy labels moves errors around rather than reducing them. Measure agreement and rewrite the category before tuning anything.
  • Drift between the document and the configuration. The prose says one thing, the classifier threshold implements another, and the judge prompt was copied from last year’s version. Linking versions (pattern 5) and logging the version with each decision is how you notice.
  • Policies that are too long for the detectors that read them. A judge prompt containing a 40-page policy dilutes attention and costs more per call. Give each detector the categories it is responsible for, not the whole document.
  • Overlays chosen by the wrong input. If the overlay is selected by a request parameter the client controls, or by what the user claims about themselves, any user can select the permissive one.
  • Context the policy cannot see. A policy evaluated per message misses harm that builds across turns or is split between turns. Detectors that need conversation context must be given it, which raises cost (see 4.2).
  • Language and culture. Examples written in one language and one cultural context do not transfer cleanly. If you serve other languages, write examples in them and measure per language.
  • Rules that exist only in the prompt. DPD’s bot said it was not allowed to swear, then swore. A system prompt states a policy to the model; it does not enforce it. Every rule that matters needs a detector or a deterministic check outside the model.

Lab exercise

In Lab 4: Safety Controls, Task 4.1 asks you to write a versioned policy for the lab’s assistant with three tiers, boundary pairs for each category, and one deployment overlay, then wire it to an action router that fails closed and run the examples as tests.

Check your understanding

1. Two reviewers label the same 200 transcripts for "harassment" and disagree on a quarter of them. The team proposes lowering the classifier threshold. What should happen first?

Rewrite the category definition and add boundary examples until reviewers agree, then relabel. A detector tuned against labels that people cannot agree on has no stable target, so threshold changes only trade one set of disputed errors for another.

2. Why is a three-tier policy (allowed, needs care, disallowed) better than allow/block for a health information assistant?

Most health questions that look sensitive have a legitimate reading and deserve an answer with constraints (general information, a pointer to a clinician) rather than a refusal. Allow/block forces those into one bucket or the other, causing either over-refusal or unconstrained answers.

3. A deployment overlay for a vetted security-research product is selected when the request includes `"mode": "research"`. What is wrong?

The client controls that field, so any user can select the permissive overlay. The overlay must be chosen from server-side configuration tied to the authenticated tenant or product.

4. A detector returns a category name that the current policy file does not contain. What should the action router do and why?

Treat it as a configuration error: apply the strictest action, alert, and log the policy version. Defaulting to allow would let a mismatch between detector and policy versions silently disable the control.

Sources

  1. Inan et al. (2023), Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations
  2. Fortune (2024), DPD's AI chatbot calls itself 'useless' and says it works for the 'worst delivery firm in the world'
  3. OpenAI (2025), From hard refusals to safe-completions (GPT-5 safe completions)
  4. OWASP Top 10 for LLM Applications 2025: LLM09 Misinformation