AI Safety Compendium

Releasing and running it safely

Constraining

Input and output classifiers (guardrails)

Run separate classifier models on users' prompts and the model's responses, and block harmful ones in real time.

Open in the compendium

Input and output classifiers, often called guardrails, are separate models that check what users send to an AI system and what the system sends back, and block harmful content in real time. They add a safety layer that does not depend on the main model refusing on its own. Models can be 'jailbroken' (tricked into ignoring their training), and a separate filter gives a second chance to stop the harm.

How it works

A guardrail sits between the user and the main model. When a prompt arrives, an input classifier scores it against a list of harm categories, such as hate speech or requests for weapons help. When the model replies, an output classifier scores the reply, often token by token as it streams, and can cut it off mid-answer. Meta's Llama Guard (December 2023) is a small Llama 2 model fine-tuned to label prompts and responses against a written risk taxonomy; developers can change the categories by editing the instructions.

Anthropic's Constitutional Classifiers (January 2025) are trained on synthetic examples generated from a 'constitution', a plain-language list of what is allowed and what is not. In May 2025 Anthropic switched them on for Claude Opus 4 to block a narrow class of dangerous weapons information. Newer designs use a cascade, in which a cheap first-stage filter screens all traffic and passes only suspicious exchanges to a slower, stronger classifier. Some classifiers now read a developer's policy at run time and reason about it, so rules can change without retraining.

Where research stands

Guardrails are in everyday use. Anthropic runs them in production, and open guardrail models and toolkits are available from Meta, Google, IBM, NVIDIA and OpenAI. Anthropic's results show that classifiers can resist large-scale human red teaming at a modest cost. Over 3,000 hours of testing found no universal jailbreak against an early guarded model. The January 2026 version cost about 40 times less to run than Anthropic's baseline exchange classifier and refused only 0.05% of production traffic. Government testers at the UK AI Security Institute and the US Center for AI Standards and Innovation red-teamed these classifiers before and after deployment and found real weaknesses, which Anthropic then addressed, in one case by restructuring its safeguard architecture.

Guardrails are not airtight. In Anthropic's public challenge in February 2025, four participants passed all eight levels and one found a universal jailbreak. A study in October 2025 showed that adaptive attackers, who tune their attack to a specific defence, bypassed 12 recent jailbreak and prompt-injection defences with success rates above 90% for most. Classifiers also trade safety against usefulness. Stricter filters block more legitimate requests, and they add latency and cost.

Key results

Open problems

See all open problems in this group

Criticisms

Who works on it

Status

In use. Llama Guard weights are public, and Anthropic put Constitutional Classifiers into use with Claude Opus 4 in May 2025. In over 3,000 estimated hours of red teaming, no red teamer found a universal jailbreak that got an early classifier-guarded model to answer most target questions in as much detail as an unguarded model. Improved classifiers raised refusals on production traffic by 0.38 percentage points. In Anthropic's February 2025 public demo, one participant found a universal jailbreak. A January 2026 version (Constitutional Classifiers++) reports about 40 times lower compute cost than a baseline exchange classifier and a 0.05% refusal rate on production traffic.

Start reading

Related approaches

In their own words

We introduce Llama Guard, an LLM-based input-output safeguard model geared towards Human-AI conversation use cases. Our model incorporates a safety risk taxonomy, a valuable tool for categorizing a specific set of safety risks found in LLM prompts (i.e., prompt classification).

Hakan Inan et al. (Meta), Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations, 2023

We have implemented Constitutional Classifiers—a system where real-time classifier guards, trained on synthetic data representing harmful and harmless CBRN-related prompts and completions, monitor model inputs and outputs and intervene to block a narrow class of harmful CBRN information.

Anthropic, Activating AI Safety Level 3 Protections, 2025

Suggest a correction Something wrong, out of date or missing, such as an organisation? Opens a GitHub issue (free account needed).