Releasing and running it safely
Input and output classifiers (guardrails)
Run separate classifier models on users' prompts and the model's responses, and block harmful ones in real time.
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
- Llama Guard, a fine-tuned Llama 2 7B model with an editable risk taxonomy, matched or exceeded existing content-moderation tools on public benchmarks, and Meta released its weights. Hakan Inan et al. (Meta), 2023
- In over 3,000 estimated hours of red teaming, no red teamer found a universal jailbreak that extracted information from an early classifier-guarded model at unguarded-level detail on most target queries; refusals on production traffic rose by an absolute 0.38% and latency by 23.7%. Mrinank Sharma and 42 co-authors (Anthropic), 2025
- In Anthropic's public challenge (February 2025), 339 jailbreakers spent about 3,700 hours; four passed all eight levels on days six and seven, and one found a universal jailbreak. Anthropic, 2025
- The second-generation system, which judges responses in full conversational context and uses a cheap-then-expensive cascade with linear probes, cost about 40 times less than a baseline exchange classifier, refused 0.05% of production traffic, and withstood over 1,700 hours of red teaming without a full success. Hoagy Cunningham, Jerry Wei et al. (Anthropic), 2026
- Adaptive attacks using gradient descent, reinforcement learning, random search and human-guided exploration bypassed 12 recent defences, most with success rates above 90%, although most had reported near-zero attack success. Milad Nasr, Nicholas Carlini, Florian Tramèr et al., 2025
- Government red-teamers from the US Center for AI Standards and Innovation and the UK AI Security Institute found prompt-injection, obfuscation and architecture-level weaknesses in early Constitutional Classifiers, leading Anthropic to restructure its safeguards. Anthropic, 2025
Open problems
- Testing guardrails against adaptive attackers who tailor and scale their attacks, rather than fixed attack strings. source
- Lowering cost and latency enough to screen every exchange in full conversational context. source
- Resisting prompt injection and obfuscated requests, such as content encoded or split across harmless-looking pieces. source
- Matching dedicated classifiers on nuanced risks with flexible policy-reading classifiers, which still trail large trained classifiers. source
See all open problems in this group
Criticisms
- Most published defences are tested only against static or weak attacks; adaptive attackers break them, so reported robustness numbers are unreliable. Milad Nasr, Nicholas Carlini, Florian Tramèr and co-authors
- Even a heavily tested guardrail was beaten by a universal jailbreak within a week of public testing, showing that filters reduce but do not remove jailbreak risk. Anthropic (public challenge results)
Who works on it
- Anthropic: Built Constitutional Classifiers and deployed them with Claude Opus 4 under its AI Safety Level 3 protections. Activating AI Safety Level 3 Protections (2025)
- Meta: Released Llama Guard, an open-weight input-output safeguard model. Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations (2023)
- Google: Released ShieldGemma moderation models built on Gemma 2. ShieldGemma: Generative AI Content Moderation Based on Gemma (2024)
- IBM: Released Granite Guardian open models that screen prompts and responses for harms and hallucination. Granite Guardian (2024)
- NVIDIA: Released NeMo Guardrails, an open toolkit for programmable runtime rails. NeMo Guardrails: A Toolkit for Controllable and Safe LLM Applications with Programmable Rails (2023)
- OpenAI: Released gpt-oss-safeguard, open-weight models that classify content against a developer-written policy. OpenAI's gpt-oss-safeguard enables developers to build safer AI (Help Net Security) (2025)
- ROOST (Robust Open Online Safety Tools): Co-developed gpt-oss-safeguard with OpenAI, Discord and SafetyKit. OpenAI's gpt-oss-safeguard enables developers to build safer AI (Help Net Security) (2025)
- UK AI Security Institute: Red-teamed Anthropic's classifiers before and after deployment. Strengthening our safeguards through collaboration with US CAISI and UK AISI (2025)
- US Center for AI Standards and Innovation: Red-teamed Anthropic's classifiers before and after deployment. Strengthening our safeguards through collaboration with US CAISI and UK AISI (2025)
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
- Constitutional Classifiers: Defending against universal jailbreaks, Anthropic (2025). Readable explainer plus results of the public challenge.
- Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations, Hakan Inan et al. (Meta) (2023). The reference open guardrail model.
- Constitutional Classifiers++: Efficient Production-Grade Defenses against Universal Jailbreaks, Hoagy Cunningham, Jerry Wei et al. (Anthropic) (2026). What a production-grade, low-cost guardrail looks like today.
- The Attacker Moves Second, Milad Nasr, Nicholas Carlini, Florian Tramèr et al. (2025). Why guardrail evaluations must use adaptive attackers.
- Strengthening our safeguards through collaboration with US CAISI and UK AISI, Anthropic (2025). How government red-teaming of guardrails works in practice.
Related approaches
- Behavioural and activation monitoring probes inside classifier cascades
- Adversarial robustness and red-teaming red-teaming tests guardrails
- Circuit breakers and representation rerouting in-model alternative: circuit breakers
- Tamper-resistant safeguards for open-weight models guardrails do not protect open weights
- Limiting proliferation of high-risk models guardrails need controlled access
- Independent third-party evaluation and audit third-party evaluation of safeguards
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).