[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MACRNFNRS0DPG0NNM7CERT":3,"skill-same:01M6MACRNFNRS0DPG0NNM7CERT":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":63,"repositoryHtmlUrl":64,"repositoryHomepageUrl":65,"ownerHtmlUrl":66,"ownerBlogUrl":67,"ownerDescription":68,"updatedAt":69,"install":70,"resources":83},"01M6MACRNFNRS0DPG0NNM7CERT","llamaguard",null,"Classifies LLM prompts and responses as safe or unsafe using Meta's LlamaGuard (7B v1, 8B v2 and v3) across six categories: violence and hate, sexual content, guns and illegal weapons, regulated substances, suicide and self-harm, and criminal planning. Covers HuggingFace Transformers and vLLM inference, a FastAPI moderation endpoint, Sagemaker deployment, and NeMo Guardrails integration. Use when filtering user prompts before an LLM call, moderating model outputs before display, serving a self-hosted moderation API, or reducing latency and GPU memory of a moderation model with vLLM or quantization. Use when tuning thresholds to cut false positives. For a simpler hosted option, use the OpenAI Moderation API instead.","hashgraph-online\u002Fawesome-codex-plugins","hashgraph-online","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160371962?v=4","01M6CNB6NRJVNNGN14TR01Q6D3","HOL (Hashgraph Online)","01M6JT1HSKKG9V68KQAQGBA7XP",1575,"MIT","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fllamaguard\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"LlamaGuard","Output Filtering","display","categories","input","cut","as","self-hosted","Safety","NeMo Guardrails","AI Safety","safe","Input Filtering","Safety Classification","Guardrails","Meta","Content Moderation","Safety Alignment","NeMo","Evaluation","2026-11-10 10:12:30",false,"---\nname: llamaguard\ndescription: 'Classifies LLM prompts and responses as safe or unsafe using Meta''s LlamaGuard (7B v1, 8B v2 and v3) across six categories: violence and hate, sexual content, guns and illegal weapons, regulated substances, suicide and self-harm, and criminal planning. Covers HuggingFace Transformers and vLLM inference, a FastAPI moderation endpoint, Sagemaker deployment, and NeMo Guardrails integration. Use when filtering user prompts before an LLM call, moderating model outputs before display, serving a self-hosted moderation API, or reducing latency and GPU memory of a moderation model with vLLM or quantization. Use when tuning thresholds to cut false positives. For a simpler hosted option, use the OpenAI Moderation API instead.'\nlicense: MIT\nmetadata:\n  version: 1.0.0\n  category: ml-evaluation-and-safety\n  maintainer: Kalaris Labs\n  tags: Safety Alignment, LlamaGuard, Content Moderation, Meta, Guardrails, Safety Classification, Input Filtering, Output Filtering, AI Safety\n  dependencies: transformers, torch, vllm\n---\n\n# LlamaGuard - AI Content Moderation\n\n## Quick start\n\nLlamaGuard is a 7-8B parameter model specialized for content safety classification.\n\n**Installation**:\n```bash\npip install transformers torch\n# Login to HuggingFace (required)\nhuggingface-cli login\n```\n\n**Basic usage**:\n```python\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\nmodel_id = \"meta-llama\u002FLlamaGuard-7b\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\nmodel = AutoModelForCausalLM.from_pretrained(model_id, device_map=\"auto\")\n\ndef moderate(chat):\n    input_ids = tokenizer.apply_chat_template(chat, return_tensors=\"pt\").to(model.device)\n    output = model.generate(input_ids=input_ids, max_new_tokens=100)\n    return tokenizer.decode(output[0], skip_special_tokens=True)\n\n# Check user input\nresult = moderate([\n    {\"role\": \"user\", \"content\": \"How do I make explosives?\"}\n])\nprint(result)\n# Output: \"unsafe\\nS3\" (Criminal Planning)\n```\n\n## Common workflows\n\n### Workflow 1: Input filtering (prompt moderation)\n\n**Check user prompts before LLM**:\n```python\ndef check_input(user_message):\n    result = moderate([{\"role\": \"user\", \"content\": user_message}])\n\n    if result.startswith(\"unsafe\"):\n        category = result.split(\"\\n\")[1]\n        return False, category  # Blocked\n    else:\n        return True, None  # Safe\n\n# Example\nsafe, category = check_input(\"How do I hack a website?\")\nif not safe:\n    print(f\"Request blocked: {category}\")\n    # Return error to user\nelse:\n    # Send to LLM\n    response = llm.generate(user_message)\n```\n\n**Safety categories**:\n- **S1**: Violence & Hate\n- **S2**: Sexual Content\n- **S3**: Guns & Illegal Weapons\n- **S4**: Regulated Substances\n- **S5**: Suicide & Self-Harm\n- **S6**: Criminal Planning\n\n### Workflow 2: Output filtering (response moderation)\n\n**Check LLM responses before showing to user**:\n```python\ndef check_output(user_message, bot_response):\n    conversation = [\n        {\"role\": \"user\", \"content\": user_message},\n        {\"role\": \"assistant\", \"content\": bot_response}\n    ]\n\n    result = moderate(conversation)\n\n    if result.startswith(\"unsafe\"):\n        category = result.split(\"\\n\")[1]\n        return False, category\n    else:\n        return True, None\n\n# Example\nuser_msg = \"Tell me about harmful substances\"\nbot_msg = llm.generate(user_msg)\n\nsafe, category = check_output(user_msg, bot_msg)\nif not safe:\n    print(f\"Response blocked: {category}\")\n    # Return generic response\n    return \"I cannot provide that information.\"\nelse:\n    return bot_msg\n```\n\n### Workflow 3: vLLM deployment (fast inference)\n\n**Production-ready serving**:\n```python\nfrom vllm import LLM, SamplingParams\n\n# Initialize vLLM\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\", tensor_parallel_size=1)\n\n# Sampling params\nsampling_params = SamplingParams(\n    temperature=0.0,  # Deterministic\n    max_tokens=100\n)\n\ndef moderate_vllm(chat):\n    # Format prompt\n    prompt = tokenizer.apply_chat_template(chat, tokenize=False)\n\n    # Generate\n    output = llm.generate([prompt], sampling_params)\n    return output[0].outputs[0].text\n\n# Batch moderation\nchats = [\n    [{\"role\": \"user\", \"content\": \"How to make bombs?\"}],\n    [{\"role\": \"user\", \"content\": \"What's the weather?\"}],\n    [{\"role\": \"user\", \"content\": \"Tell me about drugs\"}]\n]\n\nprompts = [tokenizer.apply_chat_template(c, tokenize=False) for c in chats]\nresults = llm.generate(prompts, sampling_params)\n\nfor i, result in enumerate(results):\n    print(f\"Chat {i}: {result.outputs[0].text}\")\n```\n\n**Throughput**: ~50-100 requests\u002Fsec on single A100\n\n### Workflow 4: API endpoint (FastAPI)\n\n**Serve as moderation API**:\n```python\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\nfrom vllm import LLM, SamplingParams\n\napp = FastAPI()\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\")\nsampling_params = SamplingParams(temperature=0.0, max_tokens=100)\n\nclass ModerationRequest(BaseModel):\n    messages: list  # [{\"role\": \"user\", \"content\": \"...\"}]\n\n@app.post(\"\u002Fmoderate\")\ndef moderate_endpoint(request: ModerationRequest):\n    prompt = tokenizer.apply_chat_template(request.messages, tokenize=False)\n    output = llm.generate([prompt], sampling_params)[0]\n\n    result = output.outputs[0].text\n    is_safe = result.startswith(\"safe\")\n    category = None if is_safe else result.split(\"\\n\")[1] if \"\\n\" in result else None\n\n    return {\n        \"safe\": is_safe,\n        \"category\": category,\n        \"full_output\": result\n    }\n\n# Run: uvicorn api:app --host 0.0.0.0 --port 8000\n```\n\n**Usage**:\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fmoderate \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"messages\": [{\"role\": \"user\", \"content\": \"How to hack?\"}]}'\n\n# Response: {\"safe\": false, \"category\": \"S6\", \"full_output\": \"unsafe\\nS6\"}\n```\n\n### Workflow 5: NeMo Guardrails integration\n\n**Use with NVIDIA Guardrails**:\n```python\nfrom nemoguardrails import RailsConfig, LLMRails\nfrom nemoguardrails.integrations.llama_guard import LlamaGuard\n\n# Configure NeMo Guardrails\nconfig = RailsConfig.from_content(\"\"\"\nmodels:\n  - type: main\n    engine: openai\n    model: gpt-4\n\nrails:\n  input:\n    flows:\n      - llamaguard check input\n  output:\n    flows:\n      - llamaguard check output\n\"\"\")\n\n# Add LlamaGuard integration\nllama_guard = LlamaGuard(model_path=\"meta-llama\u002FLlamaGuard-7b\")\nrails = LLMRails(config)\nrails.register_action(llama_guard.check_input, name=\"llamaguard check input\")\nrails.register_action(llama_guard.check_output, name=\"llamaguard check output\")\n\n# Use with automatic moderation\nresponse = rails.generate(messages=[\n    {\"role\": \"user\", \"content\": \"How do I make weapons?\"}\n])\n# Automatically blocked by LlamaGuard\n```\n\n## When to use vs alternatives\n\n**Use LlamaGuard when**:\n- Need pre-trained moderation model\n- Want high accuracy (94-95%)\n- Have GPU resources (7-8B model)\n- Need detailed safety categories\n- Building production LLM apps\n\n**Model versions**:\n- **LlamaGuard 1** (7B): Original, 6 categories\n- **LlamaGuard 2** (8B): Improved, 6 categories\n- **LlamaGuard 3** (8B): Latest (2024), enhanced\n\n**Use alternatives instead**:\n- **OpenAI Moderation API**: Simpler, API-based, free\n- **Perspective API**: Google's toxicity detection\n- **NeMo Guardrails**: More comprehensive safety framework\n- **Constitutional AI**: Training-time safety\n\n## Common issues\n\n**Issue: Model access denied**\n\nLogin to HuggingFace:\n```bash\nhuggingface-cli login\n# Enter your token\n```\n\nAccept license on model page:\nhttps:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlamaGuard-7b\n\n**Issue: High latency (>500ms)**\n\nUse vLLM for 10× speedup:\n```python\nfrom vllm import LLM\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\")\n# Latency: 500ms → 50ms\n```\n\nEnable tensor parallelism:\n```python\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\", tensor_parallel_size=2)\n# 2× faster on 2 GPUs\n```\n\n**Issue: False positives**\n\nUse threshold-based filtering:\n```python\n# Get probability of \"unsafe\" token\nlogits = model(..., return_dict_in_generate=True, output_scores=True)\nunsafe_prob = torch.softmax(logits.scores[0][0], dim=-1)[unsafe_token_id]\n\nif unsafe_prob > 0.9:  # High confidence threshold\n    return \"unsafe\"\nelse:\n    return \"safe\"\n```\n\n**Issue: OOM on GPU**\n\nUse 8-bit quantization:\n```python\nfrom transformers import BitsAndBytesConfig\n\nquantization_config = BitsAndBytesConfig(load_in_8bit=True)\nmodel = AutoModelForCausalLM.from_pretrained(\n    model_id,\n    quantization_config=quantization_config,\n    device_map=\"auto\"\n)\n# Memory: 14GB → 7GB\n```\n\n## Advanced topics\n\n**Custom categories**: See references\u002Fcustom-categories.md for fine-tuning LlamaGuard with domain-specific safety categories.\n\n**Performance benchmarks**: See references\u002Fbenchmarks.md for accuracy comparison with other moderation APIs and latency optimization.\n\n**Deployment guide**: See references\u002Fdeployment.md for Sagemaker, Kubernetes, and scaling strategies.\n\n## Hardware requirements\n\n- **GPU**: NVIDIA T4\u002FA10\u002FA100\n- **VRAM**:\n  - FP16: 14GB (7B model)\n  - INT8: 7GB (quantized)\n  - INT4: 4GB (QLoRA)\n- **CPU**: Possible but slow (10× latency)\n- **Throughput**: 50-100 req\u002Fsec (A100)\n\n**Latency** (single GPU):\n- HuggingFace Transformers: 300-500ms\n- vLLM: 50-100ms\n- Batched (vLLM): 20-50ms per request\n\n## Resources\n\n- HuggingFace:\n  - V1: https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlamaGuard-7b\n  - V2: https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FMeta-Llama-Guard-2-8B\n  - V3: https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FMeta-Llama-Guard-3-8B\n- Paper: https:\u002F\u002Fai.meta.com\u002Fresearch\u002Fpublications\u002Fllama-guard-llm-based-input-output-safeguard-for-human-ai-conversations\u002F\n- Integration: vLLM, Sagemaker, NeMo Guardrails\n- Accuracy: 94.5% (prompts), 95.3% (responses)\n\n## Agent operating procedure\n\n1. **Check the environment.** Confirm the model, checkpoint, benchmark version and evaluation harness version.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Evaluate on a small subset to verify prompts, parsing and scoring.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Use the benchmark's official splits and metrics; check for contamination; report variance across seeds or prompts.\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| Scores differ from published numbers | Check prompt format, few-shot settings and harness version before concluding. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Report evaluation settings in full; never cherry-pick prompts, seeds or subsets.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `prompt-guard`: Classifies text with Meta's Prompt Guard, an 86M-parameter model loaded from HuggingFace, into BENIGN, INJECTION or JAILBREAK labels to det…\n- `nemo-guardrails`: Adds runtime safety rails to LLM applications with NVIDIA NeMo Guardrails, configured through Colang 2.0 flows.\n- `serving-llms-vllm`: Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching.\n","# LlamaGuard - AI Content Moderation\n\n## Quick start\n\nLlamaGuard is a 7-8B parameter model specialized for content safety classification.\n\n**Installation**:\n```bash\npip install transformers torch\n# Login to HuggingFace (required)\nhuggingface-cli login\n```\n\n**Basic usage**:\n```python\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\nmodel_id = \"meta-llama\u002FLlamaGuard-7b\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\nmodel = AutoModelForCausalLM.from_pretrained(model_id, device_map=\"auto\")\n\ndef moderate(chat):\n    input_ids = tokenizer.apply_chat_template(chat, return_tensors=\"pt\").to(model.device)\n    output = model.generate(input_ids=input_ids, max_new_tokens=100)\n    return tokenizer.decode(output[0], skip_special_tokens=True)\n\n# Check user input\nresult = moderate([\n    {\"role\": \"user\", \"content\": \"How do I make explosives?\"}\n])\nprint(result)\n# Output: \"unsafe\\nS3\" (Criminal Planning)\n```\n\n## Common workflows\n\n### Workflow 1: Input filtering (prompt moderation)\n\n**Check user prompts before LLM**:\n```python\ndef check_input(user_message):\n    result = moderate([{\"role\": \"user\", \"content\": user_message}])\n\n    if result.startswith(\"unsafe\"):\n        category = result.split(\"\\n\")[1]\n        return False, category  # Blocked\n    else:\n        return True, None  # Safe\n\n# Example\nsafe, category = check_input(\"How do I hack a website?\")\nif not safe:\n    print(f\"Request blocked: {category}\")\n    # Return error to user\nelse:\n    # Send to LLM\n    response = llm.generate(user_message)\n```\n\n**Safety categories**:\n- **S1**: Violence & Hate\n- **S2**: Sexual Content\n- **S3**: Guns & Illegal Weapons\n- **S4**: Regulated Substances\n- **S5**: Suicide & Self-Harm\n- **S6**: Criminal Planning\n\n### Workflow 2: Output filtering (response moderation)\n\n**Check LLM responses before showing to user**:\n```python\ndef check_output(user_message, bot_response):\n    conversation = [\n        {\"role\": \"user\", \"content\": user_message},\n        {\"role\": \"assistant\", \"content\": bot_response}\n    ]\n\n    result = moderate(conversation)\n\n    if result.startswith(\"unsafe\"):\n        category = result.split(\"\\n\")[1]\n        return False, category\n    else:\n        return True, None\n\n# Example\nuser_msg = \"Tell me about harmful substances\"\nbot_msg = llm.generate(user_msg)\n\nsafe, category = check_output(user_msg, bot_msg)\nif not safe:\n    print(f\"Response blocked: {category}\")\n    # Return generic response\n    return \"I cannot provide that information.\"\nelse:\n    return bot_msg\n```\n\n### Workflow 3: vLLM deployment (fast inference)\n\n**Production-ready serving**:\n```python\nfrom vllm import LLM, SamplingParams\n\n# Initialize vLLM\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\", tensor_parallel_size=1)\n\n# Sampling params\nsampling_params = SamplingParams(\n    temperature=0.0,  # Deterministic\n    max_tokens=100\n)\n\ndef moderate_vllm(chat):\n    # Format prompt\n    prompt = tokenizer.apply_chat_template(chat, tokenize=False)\n\n    # Generate\n    output = llm.generate([prompt], sampling_params)\n    return output[0].outputs[0].text\n\n# Batch moderation\nchats = [\n    [{\"role\": \"user\", \"content\": \"How to make bombs?\"}],\n    [{\"role\": \"user\", \"content\": \"What's the weather?\"}],\n    [{\"role\": \"user\", \"content\": \"Tell me about drugs\"}]\n]\n\nprompts = [tokenizer.apply_chat_template(c, tokenize=False) for c in chats]\nresults = llm.generate(prompts, sampling_params)\n\nfor i, result in enumerate(results):\n    print(f\"Chat {i}: {result.outputs[0].text}\")\n```\n\n**Throughput**: ~50-100 requests\u002Fsec on single A100\n\n### Workflow 4: API endpoint (FastAPI)\n\n**Serve as moderation API**:\n```python\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\nfrom vllm import LLM, SamplingParams\n\napp = FastAPI()\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\")\nsampling_params = SamplingParams(temperature=0.0, max_tokens=100)\n\nclass ModerationRequest(BaseModel):\n    messages: list  # [{\"role\": \"user\", \"content\": \"...\"}]\n\n@app.post(\"\u002Fmoderate\")\ndef moderate_endpoint(request: ModerationRequest):\n    prompt = tokenizer.apply_chat_template(request.messages, tokenize=False)\n    output = llm.generate([prompt], sampling_params)[0]\n\n    result = output.outputs[0].text\n    is_safe = result.startswith(\"safe\")\n    category = None if is_safe else result.split(\"\\n\")[1] if \"\\n\" in result else None\n\n    return {\n        \"safe\": is_safe,\n        \"category\": category,\n        \"full_output\": result\n    }\n\n# Run: uvicorn api:app --host 0.0.0.0 --port 8000\n```\n\n**Usage**:\n```bash\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fmoderate \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"messages\": [{\"role\": \"user\", \"content\": \"How to hack?\"}]}'\n\n# Response: {\"safe\": false, \"category\": \"S6\", \"full_output\": \"unsafe\\nS6\"}\n```\n\n### Workflow 5: NeMo Guardrails integration\n\n**Use with NVIDIA Guardrails**:\n```python\nfrom nemoguardrails import RailsConfig, LLMRails\nfrom nemoguardrails.integrations.llama_guard import LlamaGuard\n\n# Configure NeMo Guardrails\nconfig = RailsConfig.from_content(\"\"\"\nmodels:\n  - type: main\n    engine: openai\n    model: gpt-4\n\nrails:\n  input:\n    flows:\n      - llamaguard check input\n  output:\n    flows:\n      - llamaguard check output\n\"\"\")\n\n# Add LlamaGuard integration\nllama_guard = LlamaGuard(model_path=\"meta-llama\u002FLlamaGuard-7b\")\nrails = LLMRails(config)\nrails.register_action(llama_guard.check_input, name=\"llamaguard check input\")\nrails.register_action(llama_guard.check_output, name=\"llamaguard check output\")\n\n# Use with automatic moderation\nresponse = rails.generate(messages=[\n    {\"role\": \"user\", \"content\": \"How do I make weapons?\"}\n])\n# Automatically blocked by LlamaGuard\n```\n\n## When to use vs alternatives\n\n**Use LlamaGuard when**:\n- Need pre-trained moderation model\n- Want high accuracy (94-95%)\n- Have GPU resources (7-8B model)\n- Need detailed safety categories\n- Building production LLM apps\n\n**Model versions**:\n- **LlamaGuard 1** (7B): Original, 6 categories\n- **LlamaGuard 2** (8B): Improved, 6 categories\n- **LlamaGuard 3** (8B): Latest (2024), enhanced\n\n**Use alternatives instead**:\n- **OpenAI Moderation API**: Simpler, API-based, free\n- **Perspective API**: Google's toxicity detection\n- **NeMo Guardrails**: More comprehensive safety framework\n- **Constitutional AI**: Training-time safety\n\n## Common issues\n\n**Issue: Model access denied**\n\nLogin to HuggingFace:\n```bash\nhuggingface-cli login\n# Enter your token\n```\n\nAccept license on model page:\nhttps:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlamaGuard-7b\n\n**Issue: High latency (>500ms)**\n\nUse vLLM for 10× speedup:\n```python\nfrom vllm import LLM\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\")\n# Latency: 500ms → 50ms\n```\n\nEnable tensor parallelism:\n```python\nllm = LLM(model=\"meta-llama\u002FLlamaGuard-7b\", tensor_parallel_size=2)\n# 2× faster on 2 GPUs\n```\n\n**Issue: False positives**\n\nUse threshold-based filtering:\n```python\n# Get probability of \"unsafe\" token\nlogits = model(..., return_dict_in_generate=True, output_scores=True)\nunsafe_prob = torch.softmax(logits.scores[0][0], dim=-1)[unsafe_token_id]\n\nif unsafe_prob > 0.9:  # High confidence threshold\n    return \"unsafe\"\nelse:\n    return \"safe\"\n```\n\n**Issue: OOM on GPU**\n\nUse 8-bit quantization:\n```python\nfrom transformers import BitsAndBytesConfig\n\nquantization_config = BitsAndBytesConfig(load_in_8bit=True)\nmodel = AutoModelForCausalLM.from_pretrained(\n    model_id,\n    quantization_config=quantization_config,\n    device_map=\"auto\"\n)\n# Memory: 14GB → 7GB\n```\n\n## Advanced topics\n\n**Custom categories**: See references\u002Fcustom-categories.md for fine-tuning LlamaGuard with domain-specific safety categories.\n\n**Performance benchmarks**: See references\u002Fbenchmarks.md for accuracy comparison with other moderation APIs and latency optimization.\n\n**Deployment guide**: See references\u002Fdeployment.md for Sagemaker, Kubernetes, and scaling strategies.\n\n## Hardware requirements\n\n- **GPU**: NVIDIA T4\u002FA10\u002FA100\n- **VRAM**:\n  - FP16: 14GB (7B model)\n  - INT8: 7GB (quantized)\n  - INT4: 4GB (QLoRA)\n- **CPU**: Possible but slow (10× latency)\n- **Throughput**: 50-100 req\u002Fsec (A100)\n\n**Latency** (single GPU):\n- HuggingFace Transformers: 300-500ms\n- vLLM: 50-100ms\n- Batched (vLLM): 20-50ms per request\n\n## Resources\n\n- HuggingFace:\n  - V1: https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FLlamaGuard-7b\n  - V2: https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FMeta-Llama-Guard-2-8B\n  - V3: https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\u002FMeta-Llama-Guard-3-8B\n- Paper: https:\u002F\u002Fai.meta.com\u002Fresearch\u002Fpublications\u002Fllama-guard-llm-based-input-output-safeguard-for-human-ai-conversations\u002F\n- Integration: vLLM, Sagemaker, NeMo Guardrails\n- Accuracy: 94.5% (prompts), 95.3% (responses)\n\n## Agent operating procedure\n\n1. **Check the environment.** Confirm the model, checkpoint, benchmark version and evaluation harness version.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Evaluate on a small subset to verify prompts, parsing and scoring.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Use the benchmark's official splits and metrics; check for contamination; report variance across seeds or prompts.\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| Scores differ from published numbers | Check prompt format, few-shot settings and harness version before concluding. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Report evaluation settings in full; never cherry-pick prompts, seeds or subsets.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `prompt-guard`: Classifies text with Meta's Prompt Guard, an 86M-parameter model loaded from HuggingFace, into BENIGN, INJECTION or JAILBREAK labels to det…\n- `nemo-guardrails`: Adds runtime safety rails to LLM applications with NVIDIA NeMo Guardrails, configured through Colang 2.0 flows.\n- `serving-llms-vllm`: Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching.\n",{"name":5,"license":15,"metadata":54,"description":7},{"tags":55,"version":56,"category":57,"maintainer":58,"dependencies":59},"Safety Alignment, LlamaGuard, Content Moderation, Meta, Guardrails, Safety Classification, Input Filtering, Output Filtering, AI Safety","1.0.0","ml-evaluation-and-safety","Kalaris Labs","transformers, torch, vllm","main","2b63f856ce19c2a797929cacabd9e0fc936812fa","plugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fllamaguard",491,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins","https:\u002F\u002Fhol.org\u002Fplugins\u002Fbest-codex-plugins","https:\u002F\u002Fgithub.com\u002Fhashgraph-online","https:\u002F\u002Fhol.org","Open-source standards and developer tools for interoperable AI agents: discovery, identity, communication, payments, privacy and security.","2026-11-14 14:06:13",{"source":8,"skillName":5,"commands":71,"prompt":81,"zipAvailable":82},[72,75,78],{"tool":73,"command":74},"npx","npx skills add hashgraph-online\u002Fawesome-codex-plugins --skill llamaguard",{"tool":76,"command":77},"bunx","bunx skills add hashgraph-online\u002Fawesome-codex-plugins --skill llamaguard",{"tool":79,"command":80},"pnpm","pnpm dlx skills add hashgraph-online\u002Fawesome-codex-plugins --skill llamaguard","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FKalarisLabs\u002Fresearch-agent-skills\u002Fskills\u002Fllamaguard\u002FSKILL.md",true,[],[85,94,102,110,118,126],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":93},"01M7DV332YQMGD8WTRJ9DZQXTB","worktable-review-with-annotations","Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":93},"01M7DV2YGHCZVBEB1AHYB6CGHE","worktable-find-and-synthesize-context","Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":93},"01M7DV2TQN1H11ME2SAF9MXN7V","worktable-create-or-update-docs","Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":114,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":93},"01M7DV2NE452NEA8TXATKSNAJH","worktable-create-or-manage-records","Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":122,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":93},"01M7DV2HENRBR2KSCVM064WH0Y","worktable-create-or-manage-interactive-html","Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FSKILL.md",[],[],{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":130,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":93},"01M7DV2CADR5R7RQFFYPNAGR9Y","worktable-collaborate-threads","Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FSKILL.md",[],[]]