Overview
Llama Guard 3 is a content-safety classifier from Meta, released in July 2024 alongside Llama 3.1. Instead of chatting, it reads a user prompt or a model response and outputs a verdict: “safe”, or “unsafe” followed by the codes of the hazard categories it violates. Developers put it in front of and behind a chatbot or agent as a moderation layer. The main model is a fine-tuned version of Llama 3.1 8B; Meta later added a smaller Llama Guard 3 1B for on-device use and a Llama Guard 3 11B Vision model that also checks images.
How it works
The model is trained to classify text against a taxonomy aligned with the MLCommons AI safety hazard categories. Llama Guard 3 uses 14 categories, labelled S1 to S14: violent crimes, non-violent crimes, sex-related crimes, child sexual exploitation, defamation, specialized advice, privacy, intellectual property, indiscriminate weapons, hate, suicide and self-harm, sexual content, elections, and code interpreter abuse. The last two were added for tool-using and election-related applications.
Because it is a language model, the policy is written into the prompt. Developers can remove categories they do not need or describe their own, and the model will classify against the categories it is given, though accuracy is best on the ones it was trained on. It supports eight languages (English, French, German, Hindi, Italian, Portuguese, Spanish and Thai) and can check both the input to a system and the output, which is useful for catching harmful responses as well as malicious prompts.
The 1B version was produced by pruning and distilling the 8B model, and Meta also released a quantized build for mobile hardware. In the Ollama library the default llama-guard3:8b download is about 4.9 GB and the 1B build about 1.6 GB.
Strengths
- Open weights under the Llama 3.1 Community License, so it can run locally, with no per-call fees.
- Covers both sides of a conversation: prompts and responses.
- Configurable policy, since categories are passed in the prompt.
- Small enough to run beside a main model without large extra cost.
Limitations
Classifiers make mistakes in both directions: they block harmless requests and miss harmful ones, especially with novel phrasing, long contexts or adversarial attacks. Llama Guard 3 is not designed to stop prompt injection hidden in documents or tool output, which needs separate defences. The license includes Meta’s acceptable use policy and conditions for very large services. Its categories reflect one taxonomy; organisations with different rules need to test it against their own policies.
Typical uses
Moderation layers for chatbots and agents, filtering user inputs and model outputs, and screening data. It works best as one part of a set of guardrails that also includes system prompts, access controls and human review.
Alternatives
Google’s ShieldGemma offers a similar open classifier family built on Gemma. Hosted moderation endpoints from model providers are an alternative for teams that do not want to run their own classifier.
Specifications are taken from the model card on Hugging Face, the Ollama library and Meta’s announcement. Classifier accuracy depends on the policy and data; see how AI benchmarks work.