Agent skill · security · zechenzhangagi

llamaguard

Meta's 7-8B specialized moderation model for LLM input/output filtering. 6 safety categories - violence/hate, sexual content, weapons, substances, self-harm, criminal planning. 94-95% accuracy. Deploy with vLLM, HuggingFace, Sagemaker. Integrates with NeMo Guardrails.

Why this skill is useful

Adds a specialized moderation model with executable scripts for input/output filtering that enhances AI safety capabilities.

What it needs

Requires torch, transformers, vllm installed locally. Requires huggingface account access. About 4k tokens when loaded. Last updated 2026-06-16. 11,472 stars on the source repository.

What this skill does

LlamaGuard - AI Content Moderation Quick start LlamaGuard is a 7-8B parameter model specialized for content safety classification. Installation: Basic usage: Common workflows Workflow 1: Input filtering (prompt moderation) Check user prompts before LLM: Safety categories: S1: Violence & Hate S2: Sexual Content S3: Guns & Illegal Weapons S4: Regulated Substances S5: Suicide & Self-Harm S6: Criminal Planning Workflow 2: Output filtering (response moderation) Check LLM responses before showing to user: Workflow 3: vLLM deployment (fast inference) Production-ready serving: Throughput: ~50-100 requests/sec on single A100 Workflow 4: API endpoint (FastAPI) Serve as moderation API: Usage: Workflow 5: NeMo Guardrails integration Use with NVIDIA Guardrails: When to use vs alternatives Use LlamaGuard when: Need pre-trained moderation model Want high accuracy (94-95%) Have GPU resources (7-8B model) Need detailed safety categories Building production LLM apps Model versions: LlamaGuard 1 (7B): Original, 6 categories LlamaGuard 2 (8B): Improved, 6 categories LlamaGuard 3 (8B): Latest (2024), enhanced Use alternatives instead: OpenAI Moderation API: Simpler, API-based, free Perspective API: Google's toxicity detection NeMo Guardrails: More comprehensive safety framework Constitutional AI: Training-time safety Common issues Issue: Model access denied Login to HuggingFace: Accept license on model page: https://huggingface.co/meta-llama/LlamaGuard-7b Issue: High latency (>500ms) Use vLLM for 10× speedup: Enable tensor parallelism: Issue: False positives Use threshold-based filtering: Issue: OOM on GPU Use 8-bit quantization: Advanced topics Custom categories: See references/custom-categories.md for fine-tuning LlamaGuard with domain-specific safety categories. Performance benchmarks: See references/benchmarks.md for accuracy comparison with other moderation APIs and latency optimization. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills zechenzhangagi/llamaguard

View the source on GitHub

Browse the @skills marketplace