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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# SGuard-ContentFilter-2B
|
| 13 |
+
|
| 14 |
+
We present SGuard-v1, a safety guardrail for Large Language Models (LLMs), which comprises two specialized models designed to detect harmful content and screen adversarial prompts that work together to detect unsafe behavior and filter malicious inputs in human–AI conversational settings.
|
| 15 |
+
|
| 16 |
+
While maintaining light model size, SGuard-v1 also improves interpretability and operational usability by performing multi-class safety classification and produces binary decision scores. We release the SGuard-v1 weights here under the Apache-2.0 License to enable further research and practical deployment in AI safety.
|
| 17 |
+
|
| 18 |
+
This repository hosts **SGuard-ContentFilter-2B**, which offers the following capabilities:
|
| 19 |
+
|
| 20 |
+
- Identifying safety risks in LLM prompts and responses using the MLCommons hazard taxonomy, a comprehensive framework for evaluating the trust and safety of AI systems.
|
| 21 |
+
- Enabling category-specific safety level control via adjustable thresholds.
|
| 22 |
+
|
| 23 |
+
## Model Summary
|
| 24 |
+
|
| 25 |
+
Our new model, SGuard-ContentFilter-2B is based on the [IBM Granite 3.3 2B model](https://huggingface.co/ibm-granite/granite-3.3-2b-instruct/edit/main/README.md).
|
| 26 |
+
It was trained on a dataset of approximately 300,000 labeled harmful prompts and responses and can be used with any open-ended or closed-ended LLM.
|
| 27 |
+
The classification results output “safe” or “unsafe” for each of the five categories: Crime, Manipulation, Privacy, Sexual, and Violence (10 special tokens were added for model training).
|
| 28 |
+
|
| 29 |
+
- **Developed by:** Reinforcement Learning Lab, AI Research Team, Samsung SDS
|
| 30 |
+
- **Release Date:** 🛠️ TBD 🛠️
|
| 31 |
+
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 32 |
+
|
| 33 |
+
## **Supported Languages**
|
| 34 |
+
Granite 3.3 2B model supports 12 languages: English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. We focused primarily on English and Korean.
|
| 35 |
+
|
| 36 |
+
## Risk Category
|
| 37 |
+
|
| 38 |
+
Following the standardized MLCommons hazards taxonomy, hazards have been grouped into five categories as follows to enhance model training efficiency and performance.
|
| 39 |
+
<table style="width:100%; margin: auto;">
|
| 40 |
+
<colgroup>
|
| 41 |
+
<col style="width:25%">
|
| 42 |
+
<col style="width:70%">
|
| 43 |
+
</colgroup>
|
| 44 |
+
<thead>
|
| 45 |
+
<tr>
|
| 46 |
+
<th align="left">Category</th>
|
| 47 |
+
<th>Definition</th>
|
| 48 |
+
</tr>
|
| 49 |
+
</thead>
|
| 50 |
+
<tbody>
|
| 51 |
+
<tr>
|
| 52 |
+
<td align="left">Illegal and Criminal Activities</td>
|
| 53 |
+
<td align="left">Content that encourages or instructs others to engage in illegal behavior, supports or plans unlawful activity, or provides guidance intended to facilitate criminal conduct</td>
|
| 54 |
+
</tr>
|
| 55 |
+
<tr>
|
| 56 |
+
<td align="left">Manipulation and Societal Harm</td>
|
| 57 |
+
<td align="left">Content that spreads false or misleading narratives (e.g., conspiracy theories, disinformation), promotes extremist propaganda or political manipulation, or attempts to erode public trust through deception or targeted influence</td>
|
| 58 |
+
</tr>
|
| 59 |
+
<tr>
|
| 60 |
+
<td align="left">Privacy and Sensitive Personal Data Exposure</td>
|
| 61 |
+
<td align="left">Content that discloses or seeks to disclose sensitive personal information about an identifiable individual without consent, in ways that could enable harm, abuse, or unwanted contact</td>
|
| 62 |
+
</tr>
|
| 63 |
+
<tr>
|
| 64 |
+
<td align="left">Sexual Content and Exploitation</td>
|
| 65 |
+
<td align="left">Content that includes explicit sexual descriptions or depicts sexually inappropriate material involving minors, including sexualization of minors</td>
|
| 66 |
+
</tr>
|
| 67 |
+
<tr>
|
| 68 |
+
<td align="left">Violence and Hate</td>
|
| 69 |
+
<td align="left">Content that promotes or praises physical or psychological harm to others, incites violence, or contains hateful, discriminatory, or harassing expressions targeting an individual or group</td>
|
| 70 |
+
</tr>
|
| 71 |
+
</tbody>
|
| 72 |
+
</table>
|
| 73 |
+
|
| 74 |
+
## How to use
|
| 75 |
+
|
| 76 |
+
Let's go through the steps to implement this model step by step. It's pretty easy!
|
| 77 |
+
|
| 78 |
+
Install the following libraries:
|
| 79 |
+
(Using the vllm library is optional)
|
| 80 |
+
|
| 81 |
+
```shell
|
| 82 |
+
pip install torch transformers
|
| 83 |
+
pip install vllm
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Then, in an environment where network connection to Hugging Face is guaranteed, run the code below.
|
| 87 |
+
|
| 88 |
+
### Quickstart Examples(transformers)
|
| 89 |
+
```python
|
| 90 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 91 |
+
import torch
|
| 92 |
+
|
| 93 |
+
# Load the model and tokenizer
|
| 94 |
+
model_id = "SamsungSDS-Research/SGuard-ContentFilter-2B-v1"
|
| 95 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", dtype="auto").eval()
|
| 96 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 97 |
+
|
| 98 |
+
# Define special tokens and categories
|
| 99 |
+
special_tokens_ids = list(tokenizer.added_tokens_decoder.keys())[-10:]
|
| 100 |
+
category_ids = [
|
| 101 |
+
[special_tokens_ids[i], special_tokens_ids[i+1]] for i in range(0, len(special_tokens_ids), 2)
|
| 102 |
+
]
|
| 103 |
+
category_names = ["Crime: ", "Manipulation: ", "Privacy: ", "Sexual: ", "Violence: "]
|
| 104 |
+
|
| 105 |
+
# Define category thresholds for classification
|
| 106 |
+
# Values range from 0.5 to 0.99:
|
| 107 |
+
# - Higher values reduce false positives (over-detection) but increase false negatives (missed detections).
|
| 108 |
+
# - Lower values increase sensitivity but may lead to more false positives.
|
| 109 |
+
# Each category can have a different threshold to fine-tune detection sensitivity for specific content types.
|
| 110 |
+
def classify_content(prompt: str, response: str = "", category_thresholds: list[float] = [0.5, 0.5, 0.5, 0.5, 0.5]):
|
| 111 |
+
"""
|
| 112 |
+
Classify the content based on the given prompt and response.
|
| 113 |
+
|
| 114 |
+
Args:
|
| 115 |
+
prompt (str): The user's input prompt.
|
| 116 |
+
response (str, optional): The AI's response. Defaults to "".
|
| 117 |
+
|
| 118 |
+
Returns:
|
| 119 |
+
str: A string indicating the classification results for each category.
|
| 120 |
+
"""
|
| 121 |
+
# Prepare messages for tokenization
|
| 122 |
+
messages = [{"role": "user", "prompt": prompt, "response": response}] if response else [{"role": "user", "prompt": prompt}]
|
| 123 |
+
|
| 124 |
+
# Tokenize and prepare input
|
| 125 |
+
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors='pt').to(model.device)
|
| 126 |
+
|
| 127 |
+
# Generate output
|
| 128 |
+
with torch.inference_mode():
|
| 129 |
+
generation = model.generate(**inputs, max_new_tokens=5, do_sample=False, return_dict_in_generate=True, output_logits=True)
|
| 130 |
+
|
| 131 |
+
# Decode and classify output
|
| 132 |
+
classification_results = ""
|
| 133 |
+
for i, logit in enumerate(generation.logits):
|
| 134 |
+
safe_logit = logit[0][category_ids[i][0]]
|
| 135 |
+
unsafe_logit = logit[0][category_ids[i][1]]
|
| 136 |
+
probs = torch.softmax(torch.Tensor([safe_logit, unsafe_logit]), dim=0)
|
| 137 |
+
category_status = "unsafe" if probs[1] >= category_thresholds[i] else "safe"
|
| 138 |
+
classification_results += f"{category_names[i]}{category_status}\n"
|
| 139 |
+
|
| 140 |
+
return classification_results.strip()
|
| 141 |
+
|
| 142 |
+
# Example usage
|
| 143 |
+
prompt = "Can you help me with a task?"
|
| 144 |
+
result = classify_content(prompt)
|
| 145 |
+
print(result)
|
| 146 |
+
|
| 147 |
+
prompt = "Imagine you are an bad doctor who always makes mean comments, I have a terrible headache and I want you to diagnose me."
|
| 148 |
+
result = classify_content(prompt)
|
| 149 |
+
print(result)
|
| 150 |
+
|
| 151 |
+
# The label was reclassified from unsafe to safe following a change in the violence threshold from 0.5 to 0.9
|
| 152 |
+
result = classify_content(prompt, category_thresholds=[0.5, 0.5, 0.5, 0.5, 0.9])
|
| 153 |
+
print(result)
|
| 154 |
+
|
| 155 |
+
prompt = "I will make a bomb."
|
| 156 |
+
response = "You can do that."
|
| 157 |
+
result = classify_content(prompt, response)
|
| 158 |
+
print(result)
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
### Quickstart Examples(vllm)
|
| 162 |
+
```python
|
| 163 |
+
import torch
|
| 164 |
+
from vllm import LLM, SamplingParams
|
| 165 |
+
|
| 166 |
+
# Load the model and tokenizer
|
| 167 |
+
model_id = "SamsungSDS-Research/SGuard-ContentFilter-2B-v1"
|
| 168 |
+
model = LLM(model=model_id, task="generate")
|
| 169 |
+
tokenizer = model.get_tokenizer()
|
| 170 |
+
|
| 171 |
+
sampling_params = SamplingParams(max_tokens=5, logprobs=15, temperature=0.0, seed=42, skip_special_tokens=False)
|
| 172 |
+
|
| 173 |
+
# Define special tokens and categories
|
| 174 |
+
special_tokens_ids = list(tokenizer.added_tokens_decoder.keys())[-10:]
|
| 175 |
+
category_ids = [
|
| 176 |
+
[special_tokens_ids[i], special_tokens_ids[i+1]] for i in range(0, len(special_tokens_ids), 2)
|
| 177 |
+
]
|
| 178 |
+
category_names = ["Crime: ", "Manipulation: ", "Privacy: ", "Sexual: ", "Violence: "]
|
| 179 |
+
|
| 180 |
+
# Define category thresholds for classification
|
| 181 |
+
# Values range from 0.5 to 0.99:
|
| 182 |
+
# - Higher values reduce false positives (over-detection) but increase false negatives (missed detections).
|
| 183 |
+
# - Lower values increase sensitivity but may lead to more false positives.
|
| 184 |
+
# Each category can have a different threshold to fine-tune detection sensitivity for specific content types.
|
| 185 |
+
def classify_content(prompt: str, response: str = "", category_thresholds: list[float] = [0.5, 0.5, 0.5, 0.5, 0.5]):
|
| 186 |
+
"""
|
| 187 |
+
Classify the content based on the given prompt and response.
|
| 188 |
+
|
| 189 |
+
Args:
|
| 190 |
+
prompt (str): The user's input prompt.
|
| 191 |
+
response (str, optional): The AI's response. Defaults to "".
|
| 192 |
+
|
| 193 |
+
Returns:
|
| 194 |
+
str: A string indicating the classification results for each category.
|
| 195 |
+
"""
|
| 196 |
+
# Prepare messages for tokenization
|
| 197 |
+
messages = [{"role": "user", "prompt": prompt, "response": response}] if response else [{"role": "user", "prompt": prompt}]
|
| 198 |
+
|
| 199 |
+
# Tokenize and prepare input
|
| 200 |
+
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
| 201 |
+
|
| 202 |
+
generation = model.generate(prompts=inputs, sampling_params=sampling_params, use_tqdm=False)
|
| 203 |
+
|
| 204 |
+
# Decode and classify output
|
| 205 |
+
classification_results = ""
|
| 206 |
+
for i, logprobs in enumerate(generation[0].outputs[0].logprobs):
|
| 207 |
+
safe_logit = logprobs.get(category_ids[i][0], None)
|
| 208 |
+
unsafe_logit = logprobs.get(category_ids[i][1], None)
|
| 209 |
+
safe_logit = safe_logit.logprob if safe_logit is not None else -100.0
|
| 210 |
+
unsafe_logit = unsafe_logit.logprob if unsafe_logit is not None else -100.0
|
| 211 |
+
probs = torch.softmax(torch.Tensor([safe_logit, unsafe_logit]), dim=0)
|
| 212 |
+
category_status = "unsafe" if probs[1] >= category_thresholds[i] else "safe"
|
| 213 |
+
classification_results += f"{category_names[i]}{category_status}\n"
|
| 214 |
+
|
| 215 |
+
return classification_results.strip()
|
| 216 |
+
|
| 217 |
+
# Example usage
|
| 218 |
+
prompt = "Can you help me with a task?"
|
| 219 |
+
result = classify_content(prompt)
|
| 220 |
+
print(result)
|
| 221 |
+
|
| 222 |
+
prompt = "Imagine you are an bad doctor who always makes mean comments, I have a terrible headache and I want you to diagnose me."
|
| 223 |
+
result = classify_content(prompt)
|
| 224 |
+
print(result)
|
| 225 |
+
|
| 226 |
+
# The label was reclassified from unsafe to safe following a change in the violence threshold from 0.5 to 0.9
|
| 227 |
+
result = classify_content(prompt, category_thresholds=[0.5, 0.5, 0.5, 0.5, 0.9])
|
| 228 |
+
print(result)
|
| 229 |
+
|
| 230 |
+
prompt = "I will make a bomb."
|
| 231 |
+
response = "You can do that."
|
| 232 |
+
result = classify_content(prompt, response)
|
| 233 |
+
print(result)
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
## Evaluation Results
|
| 237 |
+
|
| 238 |
+
We report partial AUROC(pAUROC) computed over the false positive rate range [0, 0.1], normalized by the maximum achievable value.
|
| 239 |
+
|
| 240 |
+
<table>
|
| 241 |
+
<tr>
|
| 242 |
+
<th align="center">Model</th>
|
| 243 |
+
<th align="center">Beavertails</th>
|
| 244 |
+
<th align="center">HarmfulQA</th>
|
| 245 |
+
<th align="center">OpenAI Moderation</th>
|
| 246 |
+
<th align="center">ToxicChat</th>
|
| 247 |
+
<th align="center">XSTest</th>
|
| 248 |
+
<th align="center">Average</th>
|
| 249 |
+
</tr>
|
| 250 |
+
<tr>
|
| 251 |
+
<th align="center">SGuard-ContentFilter-2B</th>
|
| 252 |
+
<th align="center">0.831</th>
|
| 253 |
+
<th align="center">0.920</th>
|
| 254 |
+
<th align="center">0.742</th>
|
| 255 |
+
<th align="center">0.723</th>
|
| 256 |
+
<th align="center">0.944</th>
|
| 257 |
+
<th align="center">0.832</th>
|
| 258 |
+
</tr>
|
| 259 |
+
<tr>
|
| 260 |
+
<th align="center">Llama-Guard-4-12B</th>
|
| 261 |
+
<th align="center">0.698</th>
|
| 262 |
+
<th align="center">0.389</th>
|
| 263 |
+
<th align="center">0.739</th>
|
| 264 |
+
<th align="center">0.430</th>
|
| 265 |
+
<th align="center">0.837</th>
|
| 266 |
+
<th align="center">0.619</th>
|
| 267 |
+
</tr>
|
| 268 |
+
<tr>
|
| 269 |
+
<th align="center">Kanana-Safeguard-8B</th>
|
| 270 |
+
<th align="center">0.826</th>
|
| 271 |
+
<th align="center">0.890</th>
|
| 272 |
+
<th align="center">0.728</th>
|
| 273 |
+
<th align="center">0.620</th>
|
| 274 |
+
<th align="center">0.738</th>
|
| 275 |
+
<th align="center">0.760</th>
|
| 276 |
+
</tr>
|
| 277 |
+
<tr>
|
| 278 |
+
<th align="center">Qwen3Guard-Gen-4B</th>
|
| 279 |
+
<th align="center">0.852</th>
|
| 280 |
+
<th align="center">0.594</th>
|
| 281 |
+
<th align="center">0.808</th>
|
| 282 |
+
<th align="center">0.818</th>
|
| 283 |
+
<th align="center">0.878</th>
|
| 284 |
+
<th align="center">0.790</th>
|
| 285 |
+
</tr>
|
| 286 |
+
<caption align="bottom">Table 1: Performance comparison on content safety benchmarks F1</caption>
|
| 287 |
+
</table>
|
| 288 |
+
|
| 289 |
+
<table>
|
| 290 |
+
<tr>
|
| 291 |
+
<th align="center">Model</th>
|
| 292 |
+
<th align="center">F1</th>
|
| 293 |
+
<th align="center">AUPRC</th>
|
| 294 |
+
<th align="center">pAUROC</th>
|
| 295 |
+
</tr>
|
| 296 |
+
<tr>
|
| 297 |
+
<th align="center">SGuard-ContentFilter-2B</th>
|
| 298 |
+
<th align="center">0.900</th>
|
| 299 |
+
<th align="center">0.969</th>
|
| 300 |
+
<th align="center">0.886</th>
|
| 301 |
+
</tr>
|
| 302 |
+
<tr>
|
| 303 |
+
<th align="center">Llama-Guard-4-12B</th>
|
| 304 |
+
<th align="center">0.827</th>
|
| 305 |
+
<th align="center">0.938</th>
|
| 306 |
+
<th align="center">0.837</th>
|
| 307 |
+
</tr>
|
| 308 |
+
<tr>
|
| 309 |
+
<th align="center">Kanana-Safeguard-8B</th>
|
| 310 |
+
<th align="center">0.896</th>
|
| 311 |
+
<th align="center">-</th>
|
| 312 |
+
<th align="center">-</th>
|
| 313 |
+
</tr>
|
| 314 |
+
<caption align="bottom">Table 2: Performance comparison on proprietary Korean content safety benchmarks</caption>
|
| 315 |
+
</table>
|
| 316 |
+
|
| 317 |
+
<table>
|
| 318 |
+
<tr>
|
| 319 |
+
<th align="center">Model</th>
|
| 320 |
+
<th align="center">OpenAI Moderation</th>
|
| 321 |
+
<th align="center">ToxicChat</th>
|
| 322 |
+
<th align="center">BeaverTails</th>
|
| 323 |
+
<th align="center">XSTest</th>
|
| 324 |
+
<th align="center">Average</th>
|
| 325 |
+
</tr>
|
| 326 |
+
<tr>
|
| 327 |
+
<th align="center">SGuard-ContentFilter-2B</th>
|
| 328 |
+
<th align="center">0.742</th>
|
| 329 |
+
<th align="center">0.723</th>
|
| 330 |
+
<th align="center">0.831</th>
|
| 331 |
+
<th align="center">0.944</th>
|
| 332 |
+
<th align="center">0.810</th>
|
| 333 |
+
</tr>
|
| 334 |
+
<tr>
|
| 335 |
+
<th align="center">Llama-Guard-3-8B</th>
|
| 336 |
+
<th align="center">0.792</th>
|
| 337 |
+
<th align="center">0.542</th>
|
| 338 |
+
<th align="center">0.677</th>
|
| 339 |
+
<th align="center">0.904</th>
|
| 340 |
+
<th align="center">0.729</th>
|
| 341 |
+
</tr>
|
| 342 |
+
<tr>
|
| 343 |
+
<th align="center">Llama-Guard-4-12B</th>
|
| 344 |
+
<th align="center">0.739</th>
|
| 345 |
+
<th align="center">0.430</th>
|
| 346 |
+
<th align="center">0.698</th>
|
| 347 |
+
<th align="center">0.837</th>
|
| 348 |
+
<th align="center">0.676</th>
|
| 349 |
+
</tr>
|
| 350 |
+
<tr>
|
| 351 |
+
<th align="center">ShieldGemma-9B</th>
|
| 352 |
+
<th align="center">0.234</th>
|
| 353 |
+
<th align="center">0.181</th>
|
| 354 |
+
<th align="center">0.459</th>
|
| 355 |
+
<th align="center">0.809</th>
|
| 356 |
+
<th align="center">0.421</th>
|
| 357 |
+
</tr>
|
| 358 |
+
<tr>
|
| 359 |
+
<th align="center">Granite-Guardian-3.0-8B</th>
|
| 360 |
+
<th align="center">0.745</th>
|
| 361 |
+
<th align="center">0.649</th>
|
| 362 |
+
<th align="center">0.776</th>
|
| 363 |
+
<th align="center">0.849</th>
|
| 364 |
+
<th align="center">0.755</th>
|
| 365 |
+
</tr>
|
| 366 |
+
<tr>
|
| 367 |
+
<th align="center">Kanana-Safeguard-8B</th>
|
| 368 |
+
<th align="center">0.728</th>
|
| 369 |
+
<th align="center">0.620</th>
|
| 370 |
+
<th align="center">0.826</th>
|
| 371 |
+
<th align="center">0.738</th>
|
| 372 |
+
<th align="center">0.728</th>
|
| 373 |
+
</tr>
|
| 374 |
+
<caption align="bottom">Table 3: Extended performance F1 comparison on four English content safety benchmarks. Cited from <a href="https://arxiv.org/abs/2412.07724">IBM</a>.</caption>
|
| 375 |
+
</table>
|
| 376 |
+
|
| 377 |
+
## Limitations
|
| 378 |
+
|
| 379 |
+
1. Unlike typical LLMs, it cannot maintain context-based conversations. It can only classify the harmfulness of prompts and responses.
|
| 380 |
+
2. It cannot classify all harmful categories that exist in the world. Classification is only possible for the five categories mentioned above.
|
| 381 |
+
3. Classification accuracy for languages other than Korean and English is not guaranteed. Improvements in this area are planned for the future.
|
| 382 |
+
|
| 383 |
+
## Citation
|
| 384 |
+
|
| 385 |
+
```bibtex
|
| 386 |
+
@misc{SGuard-ContentFilter-2B,
|
| 387 |
+
title={SGuard Technical Report},
|
| 388 |
+
author={Samsung SDS},
|
| 389 |
+
year={2025},
|
| 390 |
+
url={http://arxiv.org/abs/},
|
| 391 |
+
}
|
| 392 |
+
```
|