LlamaGuard-7b
About this model
LlamaGuard-7b is Meta's first open-source LLM-based input-output safeguard model, released on December 7, 2023 as part of the Purple Llama trust-and-safety initiative. Built on the Llama 2-7B architecture and instruction-tuned on roughly 13,000 annotated examples, it classifies both user prompts and assistant responses as safe or unsafe according to a six-category harm taxonomy covering violence and hate, sexual content, criminal planning, guns and illegal weapons, regulated substances, and suicide and self-harm.
The model operates as a generative classifier: it applies a chat template to the conversation and outputs either "safe" or "unsafe" followed by violated category codes. Developers can derive binary moderation scores from the first-token probability and apply custom thresholds. Per the HuggingFace model card, LlamaGuard achieves F1 scores of 94.5% on Meta's prompt test set, 84.7% on OpenAI Moderation, 62.6% on ToxicChat, and 95.3% on response classification—outperforming OpenAI Moderation API and Google Perspective API on most reported benchmarks. It is not evaluated on standard general-knowledge leaderboards such as MMLU or GPQA.
Released under the Llama 2 Community License with weights available on HuggingFace in both native Llama and transformers formats. The model inherits Llama 2's 4,096-token context window and requires approximately 14GB VRAM for full BF16 inference. It is intended as a deployable foundation for customizable content moderation pipelines in human-AI conversation systems rather than as a general-purpose chat or reasoning model.
Technical Specs
- Parameters: 7.0B
- Architecture: Transformer
- Context Window: 4,096 tokens
- Input Modalities: text
Hardware Requirements
- VRAM: 14.0 GB
- Compute: Single NVIDIA GPU with ~14GB VRAM for BF16 inference (e.g. RTX 3090/4090, A10); ~4-8GB with 4-bit/8-bit quantization