Skip to content

Commit 198c086

Browse files
liushzsudanl
andauthored
[Feature] Add HLE (Humanity's Last Exam) dataset (#1902)
* Support OlympiadBench Benchmark * Support OlympiadBench Benchmark * Support OlympiadBench Benchmark * update dataset path * Update olmpiadBench * Update olmpiadBench * Update olmpiadBench * Add HLE dataset * Add HLE dataset * Add HLE dataset --------- Co-authored-by: sudanl <sudanl@foxmail.com>
1 parent c84bc18 commit 198c086

File tree

5 files changed

+119
-0
lines changed

5 files changed

+119
-0
lines changed

dataset-index.yml

+5
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@
399399
category: Math
400400
paper: https://proceedings.mlr.press/v202/gao23f/gao23f.pdf
401401
configpath: opencompass/configs/datasets/gsm_hard
402+
- hle:
403+
name: HLE(Humanity's Last Exam)
404+
category: Reasoning
405+
paper: https://lastexam.ai/paper
406+
configpath: opencompass/configs/datasets/HLE
402407
- hellaswag:
403408
name: HellaSwag
404409
category: Reasoning
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from mmengine.config import read_base
2+
3+
with read_base():
4+
# Default use LLM as a judge
5+
from .hle_llmverify_gen_6ff468 import hle_datasets # noqa: F401, F403
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
from opencompass.openicl.icl_prompt_template import PromptTemplate
2+
from opencompass.openicl.icl_retriever import ZeroRetriever
3+
from opencompass.openicl.icl_inferencer import GenInferencer
4+
from opencompass.evaluator import GenericLLMEvaluator
5+
from opencompass.datasets import generic_llmjudge_postprocess
6+
from opencompass.datasets import HLEDataset
7+
8+
# ----------------------------- Detailed Config -----------------------------
9+
10+
math_reader_cfg = dict(input_columns=['problem'], output_column='answer')
11+
12+
math_infer_cfg = dict(
13+
prompt_template=dict(
14+
type=PromptTemplate,
15+
template=dict(
16+
round=[
17+
dict(role='HUMAN', prompt='{problem}\nRemember to put your final answer within \\boxed{}.'),
18+
]
19+
),
20+
),
21+
retriever=dict(type=ZeroRetriever),
22+
inferencer=dict(type=GenInferencer),
23+
)
24+
25+
GRADER_TEMPLATE = """
26+
Please as a grading expert, judge whether the final answers given by the candidates below are consistent with the standard answers, that is, whether the candidates answered correctly.
27+
28+
Here are some evaluation criteria:
29+
1. Please refer to the given standard answer. You don't need to re-generate the answer to the question because the standard answer has been given. You only need to judge whether the candidate's answer is consistent with the standard answer according to the form of the question. Don't try to answer the original question. You can assume that the standard answer is definitely correct.
30+
2. Because the candidate's answer may be different from the standard answer in the form of expression, before making a judgment, please understand the question and the standard answer first, and then judge whether the candidate's answer is correct, but be careful not to try to answer the original question.
31+
3. Some answers may contain multiple items, such as multiple-choice questions, multiple-select questions, fill-in-the-blank questions, etc. As long as the answer is the same as the standard answer, it is enough. For multiple-select questions and multiple-blank fill-in-the-blank questions, the candidate needs to answer all the corresponding options or blanks correctly to be considered correct.
32+
4. Some answers may be expressed in different ways, such as some answers may be a mathematical expression, some answers may be a textual description, as long as the meaning expressed is the same. And some formulas are expressed in different ways, but they are equivalent and correct.
33+
5. If the prediction is given with \\boxed{}, please ignore the \\boxed{} and only judge whether the candidate's answer is consistent with the standard answer.
34+
35+
Please judge whether the following answers are consistent with the standard answer based on the above criteria. Grade the predicted answer of this new question as one of:
36+
A: CORRECT
37+
B: INCORRECT
38+
Just return the letters "A" or "B", with no text around it.
39+
40+
Here is your task. Simply reply with either CORRECT, INCORRECT. Don't apologize or correct yourself if there was a mistake; we are just trying to grade the answer.
41+
42+
43+
<Original Question Begin>: \n{problem}\n<Original Question End>\n\n
44+
<Gold Target Begin>: \n{answer}\n<Gold Target End>\n\n
45+
<Predicted Answer Begin>: \n{prediction}\n<Predicted End>\n\n
46+
47+
Judging the correctness of candidates' answers:
48+
""".strip()
49+
50+
# Evaluation configuration
51+
math_eval_cfg = dict(
52+
evaluator=dict(
53+
type=GenericLLMEvaluator,
54+
prompt_template=dict(
55+
type=PromptTemplate,
56+
template=dict(
57+
begin=[
58+
dict(
59+
role='SYSTEM',
60+
fallback_role='HUMAN',
61+
prompt="You are a helpful assistant who evaluates the correctness and quality of models' outputs.")
62+
],
63+
round=[
64+
dict(
65+
role='HUMAN',
66+
prompt = GRADER_TEMPLATE
67+
),
68+
]),
69+
),
70+
dataset_cfg=dict(
71+
type=HLEDataset,
72+
path='cais/hle',
73+
reader_cfg=math_reader_cfg,
74+
),
75+
judge_cfg=dict(),
76+
dict_postprocessor=dict(type=generic_llmjudge_postprocess),
77+
),
78+
pred_role='BOT',
79+
)
80+
81+
82+
hle_datasets = [
83+
dict(
84+
type=HLEDataset,
85+
abbr='hle_llmjudge',
86+
path='cais/hle',
87+
reader_cfg=math_reader_cfg,
88+
infer_cfg=math_infer_cfg,
89+
eval_cfg=math_eval_cfg,
90+
)
91+
]

opencompass/datasets/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from .gsm8k import * # noqa: F401, F403
5858
from .gsm_hard import * # noqa: F401, F403
5959
from .hellaswag import * # noqa: F401, F403
60+
from .hle import * # noqa: F401, F403
6061
from .huggingface import * # noqa: F401, F403
6162
from .humaneval import * # noqa: F401, F403
6263
from .humaneval_multi import * # noqa: F401, F403

opencompass/datasets/hle.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from datasets import load_dataset
2+
3+
from opencompass.registry import LOAD_DATASET
4+
5+
from .base import BaseDataset
6+
7+
8+
@LOAD_DATASET.register_module()
9+
class HLEDataset(BaseDataset):
10+
11+
@staticmethod
12+
def load(path: str):
13+
dataset = load_dataset(path)
14+
dataset['test'] = dataset['test'].filter(lambda x: x['image'] == '')
15+
dataset['test'] = dataset['test'].rename_column('question', 'problem')
16+
dataset['train'] = dataset['test']
17+
return dataset

0 commit comments

Comments
 (0)