llamaguard
仓库创建 2025年11月3日最近提交 1 个月前SkillHot 收录 20 天前
▸ 精选理由
高准确率、低延迟的审查模型,便于在 RAG/应用层加入安全过滤。
▸ 风险提示
需下载模型权重并登录 HuggingFace,仍存在误判与漏判风险。
这个 Skill 做什么
Meta 的中小型模型用于输入/输出内容安全分类与审查过滤。
一种轻量级的内容安全分类模型(7–8B),能把 LLM 的输入/输出按暴力/仇恨、性内容、武器、违禁物质、自伤、犯罪计划等六类做判断和拦截。在构建安全管道、预过滤提示词或后处理生成文本时用,适合做线上审核节点。优点是准确率高(94–95%),能配合 vLLM、HuggingFace、Sagemaker 部署,并可接入 NeMo Guardrails。
▸ 展开 SKILL.md 英文原文
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.
1.1w
Stars
817
Forks
40
仓库内 Skill
+704
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/Orchestra-Research/AI-Research-SKILLs/main/07-safety-alignment/llamaguard/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/Orchestra-Research/AI-Research-SKILLs/main/07-safety-alignment/llamaguard/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# LlamaGuard - AI Content Moderation
## Quick start
LlamaGuard is a 7-8B parameter model specialized for content safety classification.
**Installation**:
```bash
pip install transformers torch
# Login to HuggingFace (required)
huggingface-cli login
```
**Basic usage**:
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "meta-llama/LlamaGuard-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
def moderate(chat):
input_ids = tokenizer.apply_chat_template(chat, return_tensors="pt").to(model.device)
output = model.generate(input_ids=input_ids, max_new_tokens=100)
returnvia SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有