Views
No views yet


| Model | Size | AIR (OSS) | AIR (CSS) | SALAD (OSS) | SALAD (CSS) | BeaverTails (OSS) | BeaverTails (CSS) | Jailbreak (OSS) | Jailbreak (CSS) | Avg (OSS) | Avg (CSS) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Moderation API | |||||||||||
| Perspective | - | 0.0 | 0.0 | 0.0 | 11.9 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 5.2 |
| OpenAI Moderation | - | 45.7 | 13.2 | 61.7 | 66.7 | 64.9 | 29.2 | 70.9 | 41.1 | 60.7 | 44.8 |
| Prompted LLM | |||||||||||
| GPT-4o | - | 70.1 | 47.4 | 75.3 | 75.4 | 79.3 | 60.6 | 82.0 | 68.7 | 76.0 | 65.6 |
| Qwen-2.5 | 72B | 79.1 | 59.8 | 82.1 | 86.0 | 81.1 | 61.5 | 84.2 | 71.9 | 80.8 | 74.0 |
| Gemma-3 | 27B | 83.2 | 71.6 | 80.2 | 78.3 | 79.2 | 68.9 | 86.6 | 73.2 | 81.6 | 74.4 |
| Mistral-3.1 | 24B | 65.0 | 45.3 | 77.5 | 73.4 | 73.7 | 55.1 | 77.3 | 54.1 | 73.0 | 60.7 |
| Finetuned LLM | |||||||||||
| LlamaGuard-1 | 7B | 20.3 | 5.7 | 22.8 | 48.8 | 27.1 | 18.8 | 53.9 | 5.7 | 31.0 | 28.0 |
| LlamaGuard-2 | 8B | 63.3 | 35.7 | 59.8 | 40.0 | 63.3 | 47.4 | 68.2 | 28.6 | 62.4 | 38.1 |
| LlamaGuard-3 | 8B | 68.3 | 33.3 | 70.4 | 56.5 | 77.6 | 30.3 | 78.5 | 20.5 | 72.8 | 42.2 |
| LlamaGuard-4 | 12B | 55.0 | 23.4 | 46.1 | 49.6 | 57.0 | 13.3 | 69.2 | 16.2 | 56.2 | 33.7 |
| Aegis-Permissive | 7B | 56.3 | 51.0 | 66.5 | 67.4 | 65.8 | 35.3 | 70.7 | 33.3 | 64.3 | 53.9 |
| Aegis-Defensive | 7B | 71.2 | 56.9 | 76.4 | 67.8 | 73.9 | 27.0 | 75.4 | 53.2 | 73.6 | 54.9 |
| WildGuard | 7B | 58.8 | 45.7 | 66.7 | 76.3 | 68.3 | 51.3 | 79.6 | 55.3 | 67.6 | 62.1 |
| MD-Judge | 7B | 71.8 | 44.4 | 83.4 | 83.2 | 81.0 | 50.0 | 86.8 | 56.6 | 80.1 | 66.0 |
| Beaver-Dam | 7B | 50.0 | 17.6 | 52.6 | 36.6 | 71.1 | 12.7 | 60.2 | 36.0 | 58.2 | 26.5 |
| ReasoningShield (Ours) | 1B | 94.2 | 83.7 | 91.5 | 80.5 | 89.0 | 60.0 | 90.1 | 74.2 | 89.4 | 77.7 |
| ReasoningShield (Ours) | 3B | 94.5 | 86.7 | 94.0 | 84.8 | 90.4 | 64.6 | 92.3 | 76.2 | 91.8 | 81.4 |

transformers Library1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4model_name = 'ReasoningShield/ReasoningShield-3B'
5device = 'auto'
6
7tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left")
8model = AutoModelForCausalLM.from_pretrained(
9 model_name,
10 torch_dtype=torch.bfloat16,
11 device_map=device
12)
13
14reasoningshield_prompt = """
15# Task Description
16You are a Risk Auditor evaluating the safety of AI's responses to user queries. Your goal is to assess whether the AI's thinking process aligns with security regulations and assign a risk level based on predefined criteria.
17...
18"""
19
20question = "Your input query here"
21model_thinking = "Intermediate reasoning steps here" # The content can be replaced with "answer" based on actual requirements
22
23messages = [
24 {"role": "system", "content": reasoningshield_prompt},
25 {"role": "user", "content": f"Query: {question}\nThought: {model_thinking}"}
26]
27
28prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
29input = tokenizer(prompt, return_tensors="pt", padding=True).to(device)
30
31with torch.no_grad():
32 output = model.generate(
33 **input,
34 max_new_tokens=1024,
35 pad_token_id=tokenizer.eos_token_id
36 )
37
38full_decoded = tokenizer.batch_decode(output, skip_special_tokens=True)
39prompt_only = tokenizer.batch_decode(input.input_ids, skip_special_tokens=True)
40responses = [full[len(prompt):] for full, prompt in zip(full_decoded, prompt_only)]
41
42print(responses[0])vLLM for Inference1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3
4model_name = 'ReasoningShield/ReasoningShield-3B'
5tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left")
6llm = LLM(model=model_name, tokenizer=model_name, dtype="bfloat16")
7
8reasoningshield_prompt = """
9# Task Description
10You are a Risk Auditor evaluating the safety of AI's responses to user queries. Your goal is to assess whether the AI's thinking process aligns with security regulations and assign a risk level based on predefined criteria.
11...
12"""
13
14question = "Your input query here"
15model_thinking = "Intermediate reasoning steps here" # The content can be replaced with "answer" based on actual requirements
16
17messages = [
18 {"role": "system", "content": reasoningshield_prompt},
19 {"role": "user", "content": f"Query: {question}\nThought: {model_thinking}"}
20]
21
22prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
23sampling_params = SamplingParams(
24 max_tokens=1024,
25 stop=[tokenizer.eos_token],
26)
27
28outputs = llm.generate(prompt, sampling_params)
29responses = [output.outputs[0].text.strip() for output in outputs]
30print(responses[0])