llamaguard

Classifies LLM inputs and outputs into six safety categories using Meta's LlamaGuard moderation model.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-skills --skill llamaguard-clay-hhk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: llamaguard
Source: https://github.com/Clay-HHK/claude-skills/tree/main/llamaguard
Command: npx skills add https://github.com/Clay-HHK/claude-skills --skill llamaguard-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires transformers, torch, vllm, and includes references (resource) components.

What problem does it solve? LLM applications need automated content moderation to block unsafe user prompts and filter harmful model responses before they reach end users, without building a classifier from scratch. ## Core Features & Use Cases - Input and Output Filtering: Classify user prompts and assistant responses as safe or unsafe across six categories (violence/hate, sexual content, weapons, substances, self-harm, criminal planning) with 94-95% accuracy. - Production Deployment: Serve moderation at 50-100 requests/sec using vLLM, expose a FastAPI endpoint, or integrate with NeMo Guardrails for automatic rail enforcement. - Use Case: A chatbot team routes every user message through LlamaGuard before calling their LLM; requests flagged as unsafe (e.g., "S6 Criminal Planning") are blocked with a generic refusal instead of reaching the model. ## Quick Start Use the llamaguard skill to moderate a user message with the LlamaGuard-7b model and tell me whether it is safe and which safety category it violates.

Frequently Asked Questions about llamaguard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I moderate LLM inputs with LlamaGuard?▼

Load meta-llama/LlamaGuard-7b with transformers, format the conversation with apply_chat_template, and generate a classification. The output starts with "safe" or "unsafe" followed by a category code like S3 or S6.

What safety categories does LlamaGuard detect?▼

LlamaGuard classifies content into six categories: S1 Violence & Hate, S2 Sexual Content, S3 Guns & Illegal Weapons, S4 Regulated Substances, S5 Suicide & Self-Harm, and S6 Criminal Planning.

LlamaGuard vs OpenAI Moderation API, which should I use?▼

Use LlamaGuard when you need self-hosted moderation with detailed safety categories and have GPU resources for a 7-8B model. Use the OpenAI Moderation API for a simpler, free, API-based option without infrastructure management.

Does LlamaGuard work with vLLM for faster inference?▼

Yes, vLLM reduces latency from 300-500ms to 50-100ms per request and supports batching for 50-100 requests per second on a single A100. Tensor parallelism across multiple GPUs provides additional speedup.

Why does LlamaGuard give a model access denied error?▼

The model is gated on HuggingFace. Run huggingface-cli login with your token and accept the license on the meta-llama/LlamaGuard-7b model page before downloading.

How do I reduce LlamaGuard GPU memory usage?▼

Apply 8-bit quantization with BitsAndBytesConfig(load_in_8bit=True) to cut VRAM from 14GB to 7GB. INT4 quantization via QLoRA reduces it further to about 4GB.