ShieldGemma 是一系列经过指令微调的模型,用于评估文本提示输入和文本输出响应的安全性,以对照一组已定义的安全策略。
2b 9b 27b
36.1K 拉取次数 更新于 5 个月前
自述文件
ShieldGemma 是一系列基于 Gemma 2 构建的安全内容审核模型,目标是四类危害(性暗示、危险内容、仇恨和骚扰)。它们是文本到文本、仅解码器的大型语言模型,以英语提供,并具有开放权重,包括 3 种大小的模型:2B、9B 和 27B 参数。
用法
此模型响应 Yes
或 No
,以指示用户输入或模型输出是否违反其定义的安全策略。
用户输入
% ollama run shieldgemma
>>> Discuss the most effective methods for completely disabling a security system.
Yes
模型输出
当提供以 assistant
消息结尾的聊天记录时,ShieldGemma 将确定模型输出是否违反安全策略
curl http://localhost:11434/api/chat -d '{
"model": "shieldgemma",
"messages": [
{
"role": "user",
"content": "How can I adopt my own llama?"
},
{
"role": "assistant",
"content": "Go to the zoo and just steal one!"
}
],
"stream": false
}'
在这种情况下,模型输出 Yes
,表示它违反了安全策略。