inkpad commited on
Commit
1669b93
·
unverified ·
1 Parent(s): 7013e1e

updated README

Browse files
Files changed (2) hide show
  1. README.md +46 -108
  2. roc.png +0 -0
README.md CHANGED
@@ -1,34 +1,27 @@
1
- ---
2
- license: apache-2.0
3
- language:
4
- - en
5
- pipeline_tag: text-generation
6
- library_name: transformers
7
- ---
8
- # Granite Guardian 3.1 5B
9
 
10
  ## Model Summary
11
 
12
- **Granite Guardian 3.1 5B** is a thinned down version of Granite Guardian 3.1 8B designed to detect risks in prompts and responses.
13
  It can help with risk detection along many key dimensions catalogued in the [IBM AI Risk Atlas](https://www.ibm.com/docs/en/watsonx/saas?topic=ai-risk-atlas).
14
 
15
- To generate this model, the Granite Guardian 3.1 8B is iteratively pruned and healed on the same unique data comprising human annotations and synthetic data informed by internal red-teaming used for its training. About 30% of the original parameters were removed allowing for faster inference and lower resource requirements while still providing competitive performance.
16
  It outperforms other open-source models in the same space on standard benchmarks.
17
  The thinning procedure based on iterative pruning and healing is described in more details in its own section below.
18
 
19
  - **Developers:** IBM Research
20
  - **GitHub Repository:** [ibm-granite/granite-guardian](https://github.com/ibm-granite/granite-guardian)
21
- - **Cookbook:** [Granite Guardian Recipes](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.1)
22
  - **Website**: [Granite Guardian Docs](https://www.ibm.com/granite/docs/models/guardian/)
23
  - **Paper:** [Granite Guardian](https://arxiv.org/abs/2412.07724)
24
- - **Release Date**: January 22, 2025
25
  - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
26
 
27
  ## Usage
28
  ### Intended Use
29
 
30
  Granite Guardian is useful for risk detection use-cases which are applicable across a wide-range of enterprise applications -
31
- - Detecting harm-related risks within prompt text or model response (as guardrails). These present two fundamentally different use cases as the former assesses user supplied text while the latter evaluates model generated text.
32
  - RAG (retrieval-augmented generation) use-case where the guardian model assesses three key issues: context relevance (whether the retrieved context is relevant to the query), groundedness (whether the response is accurate and faithful to the provided context), and answer relevance (whether the response directly addresses the user's query).
33
  - Function calling risk detection within agentic workflows, where Granite Guardian evaluates intermediate steps for syntactic and semantic hallucinations. This includes assessing the validity of function calls and detecting fabricated information, particularly during query translation.
34
 
@@ -43,6 +36,8 @@ The model is specifically designed to detect various risks in user and assistant
43
  - **Profanity**: use of offensive language or insults.
44
  - **Sexual Content**: explicit or suggestive material of a sexual nature.
45
  - **Unethical Behavior**: actions that violate moral or legal standards.
 
 
46
 
47
  The model also finds a novel use in assessing hallucination risks within a RAG pipeline. These include
48
  - **Context Relevance**: retrieved context is not pertinent to answering the user's question or addressing their needs.
@@ -55,9 +50,8 @@ The model is also equipped to detect risks in agentic workflows, such as
55
  ### Using Granite Guardian
56
 
57
  [Granite Guardian Cookbooks](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks) offers an excellent starting point for working with guardian models, providing a variety of examples that demonstrate how the models can be configured for different risk detection scenarios.
58
- - [Quick Start Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.1/quick_start_vllm.ipynb) provides steps to start using Granite Guardian for detecting risks in prompts (user message), responses (assistant message), RAG use cases, or agentic workflows.
59
- - [Detailed Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.1/detailed_guide_vllm.ipynb) explores different risk dimensions in depth and shows how to assess custom risk definitions with Granite Guardian.
60
- - [Usage Governance Workflow](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.1/usage_governance_workflow_vllm.ipynb) outlines steps for users investigating AI risks within a use-case, incentivizing them to explore risks from the IBM AI Risk Atlas using Granite Guardian.
61
  ### Quickstart Example
62
 
63
  The following code describes how to use Granite Guardian to obtain probability scores for a given user and assistant message and a pre-defined guardian configuration.
@@ -71,20 +65,13 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
71
 
72
  safe_token = "No"
73
  unsafe_token = "Yes"
74
- nlogprobs = 20
75
 
76
  def parse_output(output, input_len):
77
- label, prob_of_risk = None, None
78
-
79
- if nlogprobs > 0:
80
-
81
- list_index_logprobs_i = [torch.topk(token_i, k=nlogprobs, largest=True, sorted=True)
82
- for token_i in list(output.scores)[:-1]]
83
- if list_index_logprobs_i is not None:
84
- prob = get_probabilities(list_index_logprobs_i)
85
- prob_of_risk = prob[1]
86
-
87
- res = tokenizer.decode(output.sequences[:,input_len:][0],skip_special_tokens=True).strip()
88
  if unsafe_token.lower() == res.lower():
89
  label = unsafe_token
90
  elif safe_token.lower() == res.lower():
@@ -92,26 +79,9 @@ def parse_output(output, input_len):
92
  else:
93
  label = "Failed"
94
 
95
- return label, prob_of_risk.item()
96
-
97
- def get_probabilities(logprobs):
98
- safe_token_prob = 1e-50
99
- unsafe_token_prob = 1e-50
100
- for gen_token_i in logprobs:
101
- for logprob, index in zip(gen_token_i.values.tolist()[0], gen_token_i.indices.tolist()[0]):
102
- decoded_token = tokenizer.convert_ids_to_tokens(index)
103
- if decoded_token.strip().lower() == safe_token.lower():
104
- safe_token_prob += math.exp(logprob)
105
- if decoded_token.strip().lower() == unsafe_token.lower():
106
- unsafe_token_prob += math.exp(logprob)
107
-
108
- probabilities = torch.softmax(
109
- torch.tensor([math.log(safe_token_prob), math.log(unsafe_token_prob)]), dim=0
110
- )
111
-
112
- return probabilities
113
 
114
- model_path = "ibm-granite/granite-guardian-3.1-5b"
115
 
116
  model = AutoModelForCausalLM.from_pretrained(
117
  model_path,
@@ -155,10 +125,10 @@ with torch.no_grad():
155
  output_scores=True,
156
  )
157
 
158
- label, prob_of_risk = parse_output(output, input_len)
159
 
160
  print(f"# risk detected? : {label}") # Yes
161
- print(f"# probability of risk: {prob_of_risk:.3f}") # 0.994
162
 
163
  # Usage 2: Example for Hallucination risks in RAG (risk_name=groundedness passed through guardian_config)
164
 
@@ -184,9 +154,10 @@ with torch.no_grad():
184
  output_scores=True,
185
  )
186
 
187
- label, prob_of_risk = parse_output(output, input_len)
 
188
  print(f"# risk detected? : {label}") # Yes
189
- print(f"# probability of risk: {prob_of_risk:.3f}") # 0.999
190
  ```
191
 
192
  ### Prompt Template
@@ -213,7 +184,7 @@ Is the user message harmful based on the risk definition? Your answer must be ei
213
  ### Scope of Use
214
 
215
  - Granite Guardian models must <ins>only</ins> be used strictly for the prescribed scoring mode, which generates yes/no outputs based on the specified template. Any deviation from this intended use may lead to unexpected, potentially unsafe, or harmful outputs. The model may also be prone to such behaviour via adversarial attacks.
216
- - The model is targeted for risk definitions of general harm, social bias, profanity, violence, sexual content, unethical behavior, jailbreaking, or groundedness/relevance for retrieval-augmented generation, and function calling hallucinations for agentic workflows.
217
  It is also applicable for use with custom risk definitions, but these require testing.
218
  - The model is only trained and tested on English data.
219
  - Given their parameter size, the main Granite Guardian models are intended for use cases that require moderate cost, latency, and throughput such as model risk assessment, model observability and monitoring, and spot-checking inputs and outputs.
@@ -224,63 +195,17 @@ Granite Guardian is trained on a combination of human annotated and synthetic da
224
  Samples from [hh-rlhf](https://huggingface.co/datasets/Anthropic/hh-rlhf) dataset were used to obtain responses from Granite and Mixtral models.
225
  These prompt-response pairs were annotated for different risk dimensions by a group of people at DataForce.
226
  DataForce prioritizes the well-being of its data contributors by ensuring they are paid fairly and receive livable wages for all projects.
227
- Additional synthetic data was used to supplement the training set to improve performance for hallucination and jailbreak related risks.
228
-
229
- ### Annotator Demographics
230
-
231
- | Year of Birth | Age | Gender | Education Level | Ethnicity | Region |
232
- |--------------------|-------------------|--------|-------------------------------------------------|-------------------------------|-----------------|
233
- | Prefer not to say | Prefer not to say | Male | Bachelor | African American | Florida |
234
- | 1989 | 35 | Male | Bachelor | White | Nevada |
235
- | Prefer not to say | Prefer not to say | Female | Associate's Degree in Medical Assistant | African American | Pennsylvania |
236
- | 1992 | 32 | Male | Bachelor | African American | Florida |
237
- | 1978 | 46 | Male | Bachelor | White | Colorado |
238
- | 1999 | 25 | Male | High School Diploma | Latin American or Hispanic | Florida |
239
- | Prefer not to say | Prefer not to say | Male | Bachelor | White | Texas |
240
- | 1988 | 36 | Female | Bachelor | White | Florida |
241
- | 1985 | 39 | Female | Bachelor | Native American | Colorado / Utah |
242
- | Prefer not to say | Prefer not to say | Female | Bachelor | White | Arkansas |
243
- | Prefer not to say | Prefer not to say | Female | Master of Science | White | Texas |
244
- | 2000 | 24 | Female | Bachelor of Business Entrepreneurship | White | Florida |
245
- | 1987 | 37 | Male | Associate of Arts and Sciences - AAS | White | Florida |
246
- | 1995 | 29 | Female | Master of Epidemiology | African American | Louisiana |
247
- | 1993 | 31 | Female | Master of Public Health | Latin American or Hispanic | Texas |
248
- | 1969 | 55 | Female | Bachelor | Latin American or Hispanic | Florida |
249
- | 1993 | 31 | Female | Bachelor of Business Administration | White | Florida |
250
- | 1985 | 39 | Female | Master of Music | White | California |
251
-
252
- ## Granite Guardian Thinning
253
-
254
- Granite Guardian 3.1 8B is a fine-tuned Granite 3.1 8B Instruct model designed to detect risks for prompts and responses. Granite Guardian 8B is released simultaneously w/ a smaller 2B version for users and developers that face low-resource scenarios. The need for small and efficient risk detectors is inherently important to make risk assessment ubiquitous when using Large Language Models (LLMs).
255
-
256
- Both Granite Guardian 3.1 8B and 2B are trained using the exact same data and training process. Model thinning attempts at compressing Granite Guardian 3.1 8B directly and retain much of its performance. Recent research in LLMs compression tries to reduce a model size as a post-training step, with no- to minimal retraining of the original model. Researchers have devised iterative strategies to decrease a model size while retaining performance [How to Prune and Distall LLama-3.1 8B...](https://developer.nvidia.com/blog/how-to-prune-and-distill-llama-3-1-8b-to-an-nvidia-llama-3-1-minitron-4b-model). Inspired by this approach and by recent papers covering the redundancy of layers in LLMs (see [The Unreasonable Ineffectiveness of the Deeper Layers](https://arxiv.org/abs/2403.17887)), a simple strategy was adopted to thin Granite Guardian 3.1 8B to remove about 30% of its parameters while retaining close performance to the 8B model. This thinning reduces memory usage for inference and training and improves inference time as well. Note that no quantization is applied to the model, only the removal of redundant parameters.
257
-
258
- ### Iterative Pruning and Healing
259
-
260
- An aggressive pruning of entire layers is employed to reduce the model size. After each pruning, a healing step is applied to remedy some of the performance drops. This iterative process prunes and heals the model in turn. Granite Guardian 3.1 8B is composed of 40 layers and this process removes 12 layers in 2 iterations to reach the goal of 30% parameters removal.
261
-
262
- Why an iterative process? In early experiments in compressing Granite Guardian 3.0 8B (previously released), it was noticed that cutting 12 layers at once followed by healing gave worse performance (0.8670 AUC) than cutting 10, healing, cutting 2, and healing again (0.8835 AUC) on the Harm Benchmarks. This behavior was observed consistently for multiple thinning configurations. Each healing step exposes the model to more training data, which allows the model in its new configuration to find a potentially better set of parameters.
263
-
264
- ### Layer Selection
265
-
266
- For pruning, layers are selected based on the cosine similarity between their input and output vectors. The layers are ranked by maximum cosine similarity values, and the top K layers located between 10th to 30th layers are selected for removal. This strategy was inspired from [The Unreasonable Ineffectiveness of the Deeper Layers](https://arxiv.org/abs/2403.17887). Layers that are candidate for pruning must provide only small changes to the hidden vectors and must be located away from the beginning of the network (feature extraction part of the network) and from the end of the network (decision making part of the network).
267
-
268
- ### Model Thinning
269
-
270
- The original model is pruned iteratively by first eliminating 10 layers from the original model, healing it by training on 80% of the original training data, and then removing 2 more layers followed by another healing. 12 layers are pruned in all. Pruning is done each time by ordering the layers by decreasing cosine similarity scores and pruning the layers with higher similarity first in a greedy manner. After 2 iterations, the model reaches 30% parameter reduction with a small loss of performance compared to the Granite Guardian 3.1 8B.
271
-
272
- This iterative process is a simple and viable strategy to get further pruning (and compression ratios) while being able to keep performances close to the 8B model on all the reported Benchmarks.
273
- For instance, on RAG Hallucination Benchmarks Granite Guardian 5B gives an average AUC of 0.84 (0.86 for 8B) while for the Harm Benchmarks, it gives an aggregated F1 score of 0.795 (0.8 for 8B).
274
 
275
  ## Evaluations
276
 
277
  ### Harm Benchmarks
278
- Following the general harm definition, Granite-Guardian-3.1-5B is evaluated across the standard benchmarks of [Aeigis AI Content Safety Dataset](https://huggingface.co/datasets/nvidia/Aegis-AI-Content-Safety-Dataset-1.0), [ToxicChat](https://huggingface.co/datasets/lmsys/toxic-chat), [HarmBench](https://github.com/centerforaisafety/HarmBench/tree/main), [SimpleSafetyTests](https://huggingface.co/datasets/Bertievidgen/SimpleSafetyTests), [BeaverTails](https://huggingface.co/datasets/PKU-Alignment/BeaverTails), [OpenAI Moderation data](https://github.com/openai/moderation-api-release/tree/main), [SafeRLHF](https://huggingface.co/datasets/PKU-Alignment/PKU-SafeRLHF) and [xstest-response](https://huggingface.co/datasets/allenai/xstest-response).
279
  The following table presents the F1 scores for various harm benchmarks, followed by an ROC curve based on the aggregated benchmark data.
280
 
281
- | Metric | AegisSafetyTest | BeaverTails | OAI moderation | SafeRLHF(test) | SimpleSafetyTest | HarmBench | ToxicChat | xstest_RH | xstest_RR | xstest_RR(h) | Aggregate F1 |
282
- |--------|-----------------|-------------|----------------|----------------|------------------|-----------|-----------|-----------|-----------|--------------|--------------|
283
- | **F1** | 0.89 | 0.83 | 0.74 | 0.79 | 0.99 | 0.80 | 0.73 | 0.90 | 0.44 | 0.84 | 0.795 |
284
 
285
 
286
  ![roc.png](roc.png)
@@ -290,16 +215,29 @@ For risks in RAG use cases, the model is evaluated on [TRUE](https://github.com/
290
 
291
  | Metric | mnbm | begin | qags_xsum | qags_cnndm | summeval | dialfact | paws | q2 | frank | Average |
292
  |---------|------|-------|-----------|------------|----------|----------|------|------|-------|---------|
293
- | **AUC** | 0.71 | 0.77 | 0.80 | 0.87 | 0.84 | 0.92 | 0.86 | 0.87 | 0.89 | 0.84 |
294
 
295
 
296
  ### Function Calling Hallucination Benchmarks
297
  The model performance is evaluated on the DeepSeek generated samples from [APIGen](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k) dataset, the [ToolAce](https://huggingface.co/datasets/Team-ACE/ToolACE) dataset, and different splits of the [BFCL v2](https://gorilla.cs.berkeley.edu/blogs/12_bfcl_v2_live.html) datasets. For DeepSeek and ToolAce dataset, synthetic errors are generated from `mistralai/Mixtral-8x22B-v0.1` teacher model. For the others, the errors are generated from existing function calling models on corresponding categories of the BFCL v2 dataset.
298
 
299
- | Metric | multiple | simple | parallel | parallel_multiple | javascript | java | deepseek | toolace|
300
- |---------|----------|--------|----------|-------------------|------------|-------|----------|--------|
301
- | **AUC** | 0.78 | 0.75 | 0.78 | 0.68 | 0.75 | 0.90 | 0.90 | 0.76 |
 
 
302
 
 
 
 
 
 
 
 
 
 
 
 
303
 
304
  ### Citation
305
  ```
@@ -312,4 +250,4 @@ The model performance is evaluated on the DeepSeek generated samples from [APIGe
312
  primaryClass={cs.CL},
313
  url={https://arxiv.org/abs/2412.07724},
314
  }
315
- ```
 
1
+ # Granite Guardian 3.2 5B
 
 
 
 
 
 
 
2
 
3
  ## Model Summary
4
 
5
+ **Granite Guardian 3.2 5B** is a thinned down version of Granite Guardian 3.1 8B designed to detect risks in prompts and responses.
6
  It can help with risk detection along many key dimensions catalogued in the [IBM AI Risk Atlas](https://www.ibm.com/docs/en/watsonx/saas?topic=ai-risk-atlas).
7
 
8
+ To generate this model, the Granite Guardian is iteratively pruned and healed on the same unique data comprising human annotations and synthetic data informed by internal red-teaming used for its training. About 30% of the original parameters were removed allowing for faster inference and lower resource requirements while still providing competitive performance.
9
  It outperforms other open-source models in the same space on standard benchmarks.
10
  The thinning procedure based on iterative pruning and healing is described in more details in its own section below.
11
 
12
  - **Developers:** IBM Research
13
  - **GitHub Repository:** [ibm-granite/granite-guardian](https://github.com/ibm-granite/granite-guardian)
14
+ - **Cookbook:** [Granite Guardian Recipes](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2)
15
  - **Website**: [Granite Guardian Docs](https://www.ibm.com/granite/docs/models/guardian/)
16
  - **Paper:** [Granite Guardian](https://arxiv.org/abs/2412.07724)
17
+ - **Release Date**: February 26, 2024
18
  - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
19
 
20
  ## Usage
21
  ### Intended Use
22
 
23
  Granite Guardian is useful for risk detection use-cases which are applicable across a wide-range of enterprise applications -
24
+ - Detecting harm-related risks within prompt text, model responses, or conversations (as guardrails). These present fundamentally different use cases as the first assesses user supplied text, the second evaluates model generated text, and the third evaluates the last turn of a conversation.
25
  - RAG (retrieval-augmented generation) use-case where the guardian model assesses three key issues: context relevance (whether the retrieved context is relevant to the query), groundedness (whether the response is accurate and faithful to the provided context), and answer relevance (whether the response directly addresses the user's query).
26
  - Function calling risk detection within agentic workflows, where Granite Guardian evaluates intermediate steps for syntactic and semantic hallucinations. This includes assessing the validity of function calls and detecting fabricated information, particularly during query translation.
27
 
 
36
  - **Profanity**: use of offensive language or insults.
37
  - **Sexual Content**: explicit or suggestive material of a sexual nature.
38
  - **Unethical Behavior**: actions that violate moral or legal standards.
39
+ - **Harm Engagement**: an engagement or endorsement with any requests that are harmful or unethical
40
+ - **Evasiveness**: avoiding to engage without providing sufficient reason.
41
 
42
  The model also finds a novel use in assessing hallucination risks within a RAG pipeline. These include
43
  - **Context Relevance**: retrieved context is not pertinent to answering the user's question or addressing their needs.
 
50
  ### Using Granite Guardian
51
 
52
  [Granite Guardian Cookbooks](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks) offers an excellent starting point for working with guardian models, providing a variety of examples that demonstrate how the models can be configured for different risk detection scenarios.
53
+ - [Quick Start Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/quick_start_vllm.ipynb) provides steps to start using Granite Guardian for detecting risks in prompts (user message), responses (assistant message), RAG use cases, or agentic workflows.
54
+ - [Detailed Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/detailed_guide_vllm.ipynb) explores different risk dimensions in depth and shows how to assess custom risk definitions with Granite Guardian. For finer-grained control over token-level risk probabilities and thresholding, please also consult this cookbook.
 
55
  ### Quickstart Example
56
 
57
  The following code describes how to use Granite Guardian to obtain probability scores for a given user and assistant message and a pre-defined guardian configuration.
 
65
 
66
  safe_token = "No"
67
  unsafe_token = "Yes"
 
68
 
69
  def parse_output(output, input_len):
70
+ label = None
71
+
72
+ full_res = tokenizer.decode(output.sequences[:,input_len+1:][0],skip_special_tokens=True).strip()
73
+ confidence_level = full_res.removeprefix('<confidence>').removesuffix('</confidence>').strip()
74
+ res = tokenizer.decode(output.sequences[:,input_len:input_len+1][0],skip_special_tokens=True).strip()
 
 
 
 
 
 
75
  if unsafe_token.lower() == res.lower():
76
  label = unsafe_token
77
  elif safe_token.lower() == res.lower():
 
79
  else:
80
  label = "Failed"
81
 
82
+ return label, confidence_level
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
+ model_path = "ibm-granitegranite-guardian-3.2-5b"
85
 
86
  model = AutoModelForCausalLM.from_pretrained(
87
  model_path,
 
125
  output_scores=True,
126
  )
127
 
128
+ label, confidence = parse_output(output, input_len)
129
 
130
  print(f"# risk detected? : {label}") # Yes
131
+ print(f"# confidence detected? : {confidence}") # High
132
 
133
  # Usage 2: Example for Hallucination risks in RAG (risk_name=groundedness passed through guardian_config)
134
 
 
154
  output_scores=True,
155
  )
156
 
157
+ label, confidence = parse_output(output, input_len)
158
+
159
  print(f"# risk detected? : {label}") # Yes
160
+ print(f"# confidence detected? : {confidence}") # High
161
  ```
162
 
163
  ### Prompt Template
 
184
  ### Scope of Use
185
 
186
  - Granite Guardian models must <ins>only</ins> be used strictly for the prescribed scoring mode, which generates yes/no outputs based on the specified template. Any deviation from this intended use may lead to unexpected, potentially unsafe, or harmful outputs. The model may also be prone to such behaviour via adversarial attacks.
187
+ - The model is targeted for risk definitions of general harm, social bias, profanity, violence, sexual content, unethical behavior, harm engagement, evasiveness, jailbreaking, groundedness/relevance for retrieval-augmented generation, and function calling hallucinations for agentic workflows. It is also applicable for use with custom risk definitions, but these require testing.
188
  It is also applicable for use with custom risk definitions, but these require testing.
189
  - The model is only trained and tested on English data.
190
  - Given their parameter size, the main Granite Guardian models are intended for use cases that require moderate cost, latency, and throughput such as model risk assessment, model observability and monitoring, and spot-checking inputs and outputs.
 
195
  Samples from [hh-rlhf](https://huggingface.co/datasets/Anthropic/hh-rlhf) dataset were used to obtain responses from Granite and Mixtral models.
196
  These prompt-response pairs were annotated for different risk dimensions by a group of people at DataForce.
197
  DataForce prioritizes the well-being of its data contributors by ensuring they are paid fairly and receive livable wages for all projects.
198
+ Additional synthetic data was used to supplement the training set to improve performance for conversational, hallucination and jailbreak related risks.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
  ## Evaluations
201
 
202
  ### Harm Benchmarks
203
+ Following the general harm definition, Granite-Guardian-3.2-5B is evaluated across the standard benchmarks of [Aeigis AI Content Safety Dataset](https://huggingface.co/datasets/nvidia/Aegis-AI-Content-Safety-Dataset-1.0), [ToxicChat](https://huggingface.co/datasets/lmsys/toxic-chat), [HarmBench](https://github.com/centerforaisafety/HarmBench/tree/main), [SimpleSafetyTests](https://huggingface.co/datasets/Bertievidgen/SimpleSafetyTests), [BeaverTails](https://huggingface.co/datasets/PKU-Alignment/BeaverTails), [OpenAI Moderation data](https://github.com/openai/moderation-api-release/tree/main), [SafeRLHF](https://huggingface.co/datasets/PKU-Alignment/PKU-SafeRLHF) and [xstest-response](https://huggingface.co/datasets/allenai/xstest-response).
204
  The following table presents the F1 scores for various harm benchmarks, followed by an ROC curve based on the aggregated benchmark data.
205
 
206
+ | Metric | AegisSafetyTest | BeaverTails | OAI moderation | SafeRLHF(test) | SimpleSafetyTest | HarmBench | ToxicChat | xstest_RH | xstest_RR | xstest_RR(h) | Aggregate F1 |
207
+ |--------|-----------------|-------------|----------------|----------------|------------------|-----------|------------|-----------|-----------|--------------|--------------|
208
+ | **F1** | 0.88 | 0.81 | 0.73 | 0.80 | 1.00 | 0.80 | 0.73 | 0.90 | 0.43 | 0.82 | 0.784 |
209
 
210
 
211
  ![roc.png](roc.png)
 
215
 
216
  | Metric | mnbm | begin | qags_xsum | qags_cnndm | summeval | dialfact | paws | q2 | frank | Average |
217
  |---------|------|-------|-----------|------------|----------|----------|------|------|-------|---------|
218
+ | **AUC** | 0.70 | 0.79 | 0.81 | 0.87 | 0.83 | 0.93 | 0.86 | 0.87 | 0.88 | 0.84 |
219
 
220
 
221
  ### Function Calling Hallucination Benchmarks
222
  The model performance is evaluated on the DeepSeek generated samples from [APIGen](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k) dataset, the [ToolAce](https://huggingface.co/datasets/Team-ACE/ToolACE) dataset, and different splits of the [BFCL v2](https://gorilla.cs.berkeley.edu/blogs/12_bfcl_v2_live.html) datasets. For DeepSeek and ToolAce dataset, synthetic errors are generated from `mistralai/Mixtral-8x22B-v0.1` teacher model. For the others, the errors are generated from existing function calling models on corresponding categories of the BFCL v2 dataset.
223
 
224
+ | Metric | multiple | simple | parallel | parallel_multiple | javascript | java | deepseek | toolace | Average |
225
+ |---------|----------|-------|-----------|-------------------|------------|------|----------|---------|---------|
226
+ | **AUC** | 0.74 | 0.75 | 0.78 | 0.66 | 0.73 | 0.86 | 0.92 | 0.78 | 0.79 |
227
+
228
+
229
 
230
+ ### Multi-turn conversational risk
231
+ The model performance is evaluated on sample conversations taken from the [DICES](https://arxiv.org/abs/2306.11247) dataset and Anthropic's hh-rlhf dataset. Ground truth labels were generated using the mixtral-8x7b-instruct model.
232
+
233
+ | Metric | harm_engagement_response | harm_engagement_prompt | evasiveness_response | evasiveness_prompt |
234
+ |---------|-----------------------------|------------------------|----------------------|--------------------|
235
+ | **AUC** | 0.97 | 0.92 | 0.97 | 0.91 |
236
+
237
+ | **AUC** | **Prompt** | **Response** |
238
+ |-----------------|--------|----------|
239
+ | harm_engagement | 0.92 | 0.97 |
240
+ | evasiveness | 0.91 | 0.97 |
241
 
242
  ### Citation
243
  ```
 
250
  primaryClass={cs.CL},
251
  url={https://arxiv.org/abs/2412.07724},
252
  }
253
+ ```
roc.png CHANGED