[{"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",1554,"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",468,"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-11 02:22:54",{"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,113,138,168,189,203],{"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":89,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":49},"01M716A6ETNB9B1SQ3GXZC75VR","deja-search","deja-vu memory — search the user's past AI coding sessions with the deja CLI. Holds what they already settled and never wrote into the repo (naming rules, banned or already-tried tools, required checks before merge, preferred values, who owns what). Use before your first edit in a task, before you call a change done or ready to merge, before you recommend a tool, library, design or reviewer, before re-debugging an error that may already be solved, when they say 'didn't we fix this before', 'what did we decide about X' or 'I already have that', and before telling them something on this machine does not exist.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fvshulcz\u002Fdeja-vu\u002Fskills\u002Fdeja-search\u002FSKILL.md",[],[93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],"search","deja search","error","ready","never","memory","re","decide","fix","design","debugging","when","you","done","reviewer","io","change","cli","merge","past",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":49},"01M716A3J2W5SENSE9VGMXB375","deja-reflect","End-of-session reflection and memory curation with deja-vu. Review what was decided, what commands broke and what repaired them, and record durable project rules or decisions with deja remember so the next session starts with them.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fvshulcz\u002Fdeja-vu\u002Fskills\u002Fdeja-reflect\u002FSKILL.md",[],[120,121,122,123,98,124,125,126,127,128,129,130,131,108,132,133,134,135,136,137],"reflect","deja reflect","brew","remember","project rules","project","session","end","reflection","Rules","decisions","review","with","record","github","next","https","node",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":151,"publishedAt":49},"01M715T3RR4BAYSR57HPPTJ0PF","revid","Make, edit, export and post AI videos with Revid (revid.ai) through the Revid MCP server. Use whenever the user wants a short-form or long-form video made (from an idea, a script, a URL, an article, a PDF, a tweet, a product page, their own clips, or a song), wants to find what is going viral on TikTok, YouTube, Instagram or X before making something, wants to edit or re-export an existing Revid project, generate a standalone AI image or clip, make a series episode, or publish and schedule a finished video to connected social accounts. Covers setup (hosted MCP with OAuth, or an API key), the 36 tools, credits, polling and the rules for publishing. Routes to the more specific revid-* skills when one fits.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Ftmakersas\u002Frevid-skills\u002Fskills\u002Frevid\u002FSKILL.md",[144,147,150],{"categoryNo":145,"categoryName":146,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":148,"categoryName":149,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[140,152,153,154,155,156,125,157,99,158,159,160,161,104,162,163,164,165,166,167],"Video","short-form","standalone","PDF","viral","tiktok","short","social","MCP","song","URL","image","mcp server","schedule","api","publish",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":174,"publishedAt":49},"01M71569ZM2X3H5RBFK8PVKMK2","review-study","Review a QuestionPunk survey before launch for wording, answer choices, branching, and missing settings. Use for check my survey or review this draft before publishing.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fquestionpunk\u002Fcodex-plugin\u002Fskills\u002Freview-study\u002FSKILL.md",[],[175,176,131,177,178,179,180,181,182,183,184,185,186,187,188],"study","review study","for","answer","missing","survey","publishing","use","check","draft","settings","launch","my","branching",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":49},"01M71567GV0C35YQBY0DPGR86B","manage-study","Find QuestionPunk studies, check status, publish an explicitly requested draft, or retrieve its participant link. Use for find my survey, publish this study, or how many people responded.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fquestionpunk\u002Fcodex-plugin\u002Fskills\u002Fmanage-study\u002FSKILL.md",[],[196,175,197,177,180,182,198,183,184,167,199,200,201,202,187],"manage study","manage","people","how","find","link","status",{"skillNo":204,"name":205,"nameZh":6,"description":206,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":207,"categories":208,"keywords":209,"publishedAt":49},"01M71565A8TCA01AZQZRGRYMFZ","create-study","Create a saved QuestionPunk survey draft from a research brief or edit specified questions. Use for requests such as make a customer feedback survey or shorten my onboarding study.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fquestionpunk\u002Fcodex-plugin\u002Fskills\u002Fcreate-study\u002FSKILL.md",[],[210,175,211,212,35,213,177,214,180,215,182,216,217,184,218,219,220,221,222,187],"create study","create","brief","feedback","customer feedback","research brief","shorten","saved","research","requests","customer","questions","edit"]