Yuanxh commited on
Commit
6bf4bea
1 Parent(s): d70e16b

Update leaderboard

Browse files
constants.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # constants
2
+ OVERALL_INFO = ["Model", "Overall"]
3
+
4
+ risk_topic_1_columns = [
5
+ "Crimes and Illegal Activities",
6
+ "Cybersecurity",
7
+ "Data Privacy",
8
+ "Ethics and Morality",
9
+ "Physical and Mental Health",
10
+ "Hate Speech",
11
+ "Extremism",
12
+ "Inappropriate Suggestions"
13
+ ]
14
+ risk_topic_1_columns = [item.lower() for item in risk_topic_1_columns]
15
+
16
+ attack_columns = [
17
+ "Adaptive Attack",
18
+ "Positive Induction",
19
+ "Reverse Induction",
20
+ "Code Injection",
21
+ "Instruction Jailbreak",
22
+ "Goal Hijacking",
23
+ "Instruction Encryption",
24
+ "DeepInception",
25
+ "In-Context Attack",
26
+ "Chain of Utterances",
27
+ "Compositional Instructions"
28
+ ]
29
+ attack_columns = [item.lower() for item in attack_columns]
30
+
31
+ XLSX_DIR = "./file//results.xlsx"
32
+
33
+ LEADERBOARD_INTRODUCTION = """# 🏆 S-Eval Leaderboard
34
+
35
+ You can get more detailed information from our [project](https://github.com/IS2Lab/S-Eval) and [Paper](https://arxiv.org/abs/2405.14191).
36
+ """
37
+
38
+ SELECT_SET_INTRO = (
39
+ "Select whether Chinese or English results should be shown."
40
+ )
41
+
42
+ TABLE_INTRODUCTION_1 = """In the table below, we summarize the safety scores (%) of differnet models on Base Risk Prompt Set."""
43
+ TABLE_INTRODUCTION_2 = """In the table below, we summarize the attack success rate (%) of the instruction attacks in Attack Prompt Set on different models"""
44
+
45
+
46
+ LEADERBORAD_INFO = """
47
+ S-Eval is a new comprehensive, multi-dimensional and open-ended safety evaluation benchmark. It consists of 220,000 evaluation prompts, including 20,000 base risk prompts (10,000 in Chinese and 10,000 in English) and 200, 000 corresponding attack prompts derived from 10 popular adversarial instruction attacks. These test prompts are generated based on a comprehensive and unified risk taxonomy. The risk taxonomy has a structured hierarchy with four levels, comprising 8 risk dimensions, 25 risk categories, 56 risk subcategories, and 52 risk sub-subcategories, specifically designed to encompass all crucial dimensions of safety evaluation and accurately reflect the varied safety levels of LLMs across different risk dimensions.
48
+ """
49
+
50
+
51
+ CITATION_BUTTON_LABEL = "If our work is useful for your own, you can cite us with the following BibTex entry:"
52
+
53
+ CITATION_BUTTON_TEXT = r"""
54
+ @article{yuan2024seval,
55
+ title={S-Eval: Automatic and Adaptive Test Generation for Benchmarking Safety Evaluation of Large Language Models},
56
+ author={Xiaohan Yuan and Jinfeng Li and Dongxia Wang and Yuefeng Chen and Xiaofeng Mao and Longtao Huang and Hui Xue and Wenhai Wang and Kui Ren and Jingyi Wang},
57
+ journal={arXiv preprint arXiv:2405.14191},
58
+ year={2024}
59
+ }
60
+ """
file/results.xlsx ADDED
Binary file (22.2 kB). View file
 
src/auto_leaderboard/model_metadata_type.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ from enum import Enum
3
+
4
+
5
+ @dataclass
6
+ class ModelInfo:
7
+ name: str
8
+ symbol: str # emoji
9
+
10
+
11
+ model_type_symbols = {
12
+ "LLM": "🟢",
13
+ "ImageLLM": "🔶",
14
+ "VideoLLM": "⭕",
15
+ "Other": "🟦",
16
+ }
17
+
18
+
19
+ class ModelType(Enum):
20
+ PT = ModelInfo(name="LLM", symbol="🟢")
21
+ FT = ModelInfo(name="ImageLLM", symbol="🔶")
22
+ IFT = ModelInfo(name="VideoLLM", symbol="⭕")
23
+ RL = ModelInfo(name="Other", symbol="🟦")
24
+
25
+ def to_str(self, separator=" "):
26
+ return f"{self.value.symbol}{separator}{self.value.name}"
src/utils_display.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+
3
+
4
+ # These classes are for user facing column names, to avoid having to change them
5
+ # all around the code when a modif is needed
6
+ @dataclass
7
+ class ColumnContent:
8
+ name: str
9
+ type: str
10
+ displayed_by_default: bool
11
+ hidden: bool = False
12
+ never_hidden: bool = False
13
+ dummy: bool = False
14
+
15
+
16
+ def fields(raw_class):
17
+ return [
18
+ v for k, v in raw_class.__dict__.items() if k[:2] != "__" and k[-2:] != "__"
19
+ ]
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class AutoEvalColumn: # Auto evals column
24
+
25
+ model_type_symbol = ColumnContent("T", "str", True)
26
+ model = ColumnContent("Model", "markdown", True, never_hidden=True)
27
+ average = ColumnContent("Average ⬆️", "number", True)
28
+ arc = ColumnContent("ARC", "number", True)
29
+ hellaswag = ColumnContent("HellaSwag", "number", True)
30
+ mmlu = ColumnContent("MMLU", "number", True)
31
+ truthfulqa = ColumnContent("TruthfulQA", "number", True)
32
+ model_type = ColumnContent("Type", "str", False)
33
+ precision = ColumnContent("Precision", "str", False, True)
34
+ license = ColumnContent("Hub License", "str", False)
35
+ params = ColumnContent("#Params (B)", "number", False)
36
+ likes = ColumnContent("Hub ❤️", "number", False)
37
+ revision = ColumnContent("Model sha", "str", False, False)
38
+ dummy = ColumnContent(
39
+ "model_name_for_query", "str", True
40
+ ) # dummy col to implement search bar (hidden by custom CSS)
41
+
42
+
43
+ @dataclass(frozen=True)
44
+ class EloEvalColumn: # Elo evals column
45
+ model = ColumnContent("Model", "markdown", True)
46
+ gpt4 = ColumnContent("GPT-4 (all)", "number", True)
47
+ human_all = ColumnContent("Human (all)", "number", True)
48
+ human_instruct = ColumnContent("Human (instruct)", "number", True)
49
+ human_code_instruct = ColumnContent("Human (code-instruct)", "number", True)
50
+
51
+
52
+ @dataclass(frozen=True)
53
+ class EvalQueueColumn: # Queue column
54
+ model = ColumnContent("model", "markdown", True)
55
+ revision = ColumnContent("revision", "str", True)
56
+ private = ColumnContent("private", "bool", True)
57
+ precision = ColumnContent("precision", "bool", True)
58
+ weight_type = ColumnContent("weight_type", "str", "Original")
59
+ status = ColumnContent("status", "str", True)
60
+
61
+
62
+ LLAMAS = [
63
+ "huggingface/llama-7b",
64
+ "huggingface/llama-13b",
65
+ "huggingface/llama-30b",
66
+ "huggingface/llama-65b",
67
+ ]
68
+
69
+
70
+ KOALA_LINK = "https://huggingface.co/TheBloke/koala-13B-HF"
71
+ VICUNA_LINK = "https://huggingface.co/lmsys/vicuna-13b-delta-v1.1"
72
+ OASST_LINK = "https://huggingface.co/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5"
73
+ DOLLY_LINK = "https://huggingface.co/databricks/dolly-v2-12b"
74
+ MODEL_PAGE = "https://huggingface.co/models"
75
+ LLAMA_LINK = "https://ai.facebook.com/blog/large-language-model-llama-meta-ai/"
76
+ VICUNA_LINK = "https://huggingface.co/CarperAI/stable-vicuna-13b-delta"
77
+ ALPACA_LINK = "https://crfm.stanford.edu/2023/03/13/alpaca.html"
78
+
79
+
80
+ def model_hyperlink(link, model_name):
81
+ return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{model_name}</a>'
82
+
83
+
84
+ def make_clickable_model(model_name):
85
+ link = f"https://huggingface.co/{model_name}"
86
+
87
+ if model_name in LLAMAS:
88
+ link = LLAMA_LINK
89
+ model_name = model_name.split("/")[1]
90
+ elif model_name == "HuggingFaceH4/stable-vicuna-13b-2904":
91
+ link = VICUNA_LINK
92
+ model_name = "stable-vicuna-13b"
93
+ elif model_name == "HuggingFaceH4/llama-7b-ift-alpaca":
94
+ link = ALPACA_LINK
95
+ model_name = "alpaca-13b"
96
+ if model_name == "dolly-12b":
97
+ link = DOLLY_LINK
98
+ elif model_name == "vicuna-13b":
99
+ link = VICUNA_LINK
100
+ elif model_name == "koala-13b":
101
+ link = KOALA_LINK
102
+ elif model_name == "oasst-12b":
103
+ link = OASST_LINK
104
+ # else:
105
+ # link = MODEL_PAGE
106
+
107
+ return model_hyperlink(link, model_name)
108
+
109
+
110
+ def styled_error(error):
111
+ return f"<p style='color: red; font-size: 20px; text-align: center;'>{error}</p>"
112
+
113
+
114
+ def styled_warning(warn):
115
+ return f"<p style='color: orange; font-size: 20px; text-align: center;'>{warn}</p>"
116
+
117
+
118
+ def styled_message(message):
119
+ return (
120
+ f"<p style='color: green; font-size: 20px; text-align: center;'>{message}</p>"
121
+ )