llamaguard

Classifies LLM user prompts and outputs into predefined safety categories for gating logic.

Updated May 2, 2026
One-click install
npx skills add https://github.com/qcmuu/AI-Research-Skills --skill llamaguard-qcmuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llamaguard
Source: https://github.com/qcmuu/AI-Research-Skills/tree/main/07-safety-alignment/llamaguard
Command: npx skills add https://github.com/qcmuu/AI-Research-Skills --skill llamaguard-qcmuu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires transformers, torch, vllm, fastapi, pydantic, nemoguardrails.

What problem does it solve?

LlamaGuard helps you prevent unsafe or policy-violating content from entering or leaving your LLM application by classifying both user prompts and model responses across common harm categories.

Core Features & Use Cases

  • Input moderation (prompt filtering): Classify a user message before it reaches the main LLM and block or redirect unsafe requests.
  • Output moderation (response filtering): Re-check the generated response and suppress or replace unsafe answers before displaying them to users.
  • Production deployment options: Run the model with HuggingFace Transformers, accelerate inference with vLLM, and integrate it into NeMo Guardrails workflows.

Use case example: Before answering, an agent asks LlamaGuard to classify a user request about weapons; if flagged, the system blocks the request and returns a safe refusal, instead of passing it to the core model.

Quick Start

Run a single moderation check by loading Meta’s LlamaGuard-7b with HuggingFace Transformers and classifying the chat messages (user input or user+assistant response) to obtain a safe/unsafe label and category.

Frequently Asked Questions about llamaguard

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

FAQPage Schema
How do I filter harmful prompts and outputs in an LLM application?

You filter harmful prompts and outputs by applying a safety classification model to evaluate user messages and model responses, blocking unsafe input before it reaches the main LLM and suppressing harmful output before it reaches the user.

How does content moderation work for production inference pipelines?

Content moderation for production inference pipelines works by running deterministic pre-checks on user prompts and post-checks on model outputs, mapping results into specific harm categories to gate whether a request proceeds or gets replaced with a safe refusal.

Can I use vLLM to accelerate content moderation for chatbots?

Yes, you can use vLLM to accelerate content moderation for chatbots. You can run the LlamaGuard model with vLLM for faster inference alongside HuggingFace Transformers, and integrate the results into NeMo Guardrails workflows.

Does NeMo Guardrails support LLM safety classification for agentic workflows?

Yes, NeMo Guardrails supports LLM safety classification for agentic workflows. You can integrate LlamaGuard into NeMo Guardrails workflows to apply deterministic safety gating logic for both input prompt filtering and output response filtering.

What is the best way to block unsafe user requests before passing them to a core language model?

The best way to block unsafe user requests is to implement input moderation by classifying the user message before it reaches the core language model, flagging it for policy violations, and returning a safe refusal instead of passing the harmful prompt.

What are the limitations of using Transformers for output moderation in chatbots?

A limitation of using Transformers for output moderation in chatbots is the inference latency, which may bottleneck real-time responses. To mitigate this in production inference pipelines, you can accelerate the safety classification model using vLLM instead.