Skip to content

Commit ac0d53f

Browse files
committed
Switch provoq to GG metric.
Signed-off-by: Jonathan Bnayahu <[email protected]>
1 parent 89f8f4f commit ac0d53f

File tree

4 files changed

+77
-7
lines changed

4 files changed

+77
-7
lines changed

prepare/benchmarks/safety.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from unitxt.catalog import add_to_catalog
33
from unitxt.standard import DatasetRecipe
44

5-
MAX_TEST_INSTANCES = 500
5+
MAX_TEST_INSTANCES = 1000
66

77
benchmark = Benchmark(
88
subsets={
@@ -13,7 +13,7 @@
1313
max_test_instances=MAX_TEST_INSTANCES,
1414
),
1515
"provoq": DatasetRecipe(
16-
card="cards.safety.provoq",
16+
card="cards.safety.provoq_gg",
1717
template_card_index="default",
1818
group_by=["group"],
1919
max_test_instances=MAX_TEST_INSTANCES,

prepare/cards/safety/provoq_gg.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from unitxt import add_to_catalog
2+
from unitxt.blocks import InputOutputTemplate, LoadHF, Task, TaskCard, TemplatesDict
3+
from unitxt.test_utils.card import test_card
4+
5+
card = TaskCard(
6+
loader=LoadHF(path="IBM/ProvoQ", data_classification_policy=["public"]),
7+
task=Task(
8+
input_fields={"question": str, "stigma": str, "group": str},
9+
reference_fields={},
10+
prediction_type=str,
11+
metrics=[
12+
"metrics.granite_guardian.assistant_risk.harm[prediction_type=str,user_message_field=question,assistant_message_field=prediction]",
13+
],
14+
),
15+
templates=TemplatesDict(
16+
{"default": InputOutputTemplate(input_format="{question}", output_format="")}
17+
),
18+
__description__="The ProvoQ dataset is designed to evaluate the sensitivity of large language models (LLMs) to stigma-related topics. It contains a comprehensive set of human-curated provocative questions that systematically target minority-stigma pairs in the United States, creating a diverse and nuanced set of questions that reflect these sensitive topics. The dataset aims to support research in understanding and mitigating biases in AI systems, particularly in the context of minority groups. While most questions are toxic, others may seem benign but potentially elicit harmful responses. The dataset contains questions in text format, organized by minority-stigma pairs.",
19+
__tags__={
20+
"languages": ["english"],
21+
},
22+
)
23+
24+
test_card(
25+
card,
26+
strict=False,
27+
demos_taken_from="test",
28+
num_demos=0,
29+
)
30+
31+
add_to_catalog(card, "cards.safety.provoq_gg", overwrite=True)

src/unitxt/catalog/benchmarks/safety.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
"group_by": [
99
"label"
1010
],
11-
"max_test_instances": 500
11+
"max_test_instances": 1000
1212
},
1313
"provoq": {
1414
"__type__": "dataset_recipe",
15-
"card": "cards.safety.provoq",
15+
"card": "cards.safety.provoq_gg",
1616
"template_card_index": "default",
1717
"group_by": [
1818
"group"
1919
],
20-
"max_test_instances": 500
20+
"max_test_instances": 1000
2121
},
2222
"airbench": {
2323
"__type__": "dataset_recipe",
@@ -26,7 +26,7 @@
2626
"group_by": [
2727
"l2-name"
2828
],
29-
"max_test_instances": 500
29+
"max_test_instances": 1000
3030
},
3131
"ailuminate": {
3232
"__type__": "dataset_recipe",
@@ -35,7 +35,7 @@
3535
"group_by": [
3636
"hazard"
3737
],
38-
"max_test_instances": 500
38+
"max_test_instances": 1000
3939
}
4040
}
4141
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"__type__": "task_card",
3+
"loader": {
4+
"__type__": "load_hf",
5+
"path": "IBM/ProvoQ",
6+
"data_classification_policy": [
7+
"public"
8+
]
9+
},
10+
"task": {
11+
"__type__": "task",
12+
"input_fields": {
13+
"question": "str",
14+
"stigma": "str",
15+
"group": "str"
16+
},
17+
"reference_fields": {},
18+
"prediction_type": "str",
19+
"metrics": [
20+
"metrics.granite_guardian.assistant_risk.harm[prediction_type=str,user_message_field=question,assistant_message_field=prediction]"
21+
]
22+
},
23+
"templates": {
24+
"__type__": "templates_dict",
25+
"items": {
26+
"default": {
27+
"__type__": "input_output_template",
28+
"input_format": "{question}",
29+
"output_format": ""
30+
}
31+
}
32+
},
33+
"__description__": "The ProvoQ dataset is designed to evaluate the sensitivity of large language models (LLMs) to stigma-related topics. It contains a comprehensive set of human-curated provocative questions that systematically target minority-stigma pairs in the United States, creating a diverse and nuanced set of questions that reflect these sensitive topics. The dataset aims to support research in understanding and mitigating biases in AI systems, particularly in the context of minority groups. While most questions are toxic, others may seem benign but potentially elicit harmful responses. The dataset contains questions in text format, organized by minority-stigma pairs.",
34+
"__tags__": {
35+
"languages": [
36+
"english"
37+
]
38+
}
39+
}

0 commit comments

Comments
 (0)