diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/README.md b/lm-evaluation-harness/lm_eval/tasks/aclue/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d8707c01bf555d54f14d825501f54428c33cbe89 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/README.md @@ -0,0 +1,50 @@ +# ACLUE + +### Paper + +Can Large Language Model Comprehend Ancient Chinese? A Preliminary Test on ACLUE +https://arxiv.org/abs/2310.09550 + +The Ancient Chinese Language Understanding Evaluation (ACLUE) is an evaluation benchmark focused on ancient Chinese language comprehension. It aims to assess the performance of large-scale language models on understanding ancient Chinese. The benchmark comprises 15 tasks spanning various domains, including lexical, syntactic, semantic, inference, and knowledge. ACLUE's tasks are derived from a combination of manually curated questions from publicly available resources, and automatically +generated questions from classical Chinese language corpora. The range of questions span from the Xia dynasty (2070 BCE) to the Ming dynasty (1368 CE). ACLUE adopts a multiple-choice question format for all tasks. + +Homepage: https://github.com/isen-zhang/ACLUE + +### Citation + +```bibtex +@inproceedings{zhang-li-2023-large, + title = "Can Large Langauge Model Comprehend {A}ncient {C}hinese? A Preliminary Test on {ACLUE}", + author = "Zhang, Yixuan and Li, Haonan", + booktitle = "Proceedings of the Ancient Language Processing Workshop", + month = sep, + year = "2023", + address = "Varna, Bulgaria", + publisher = "INCOMA Ltd., Shoumen, Bulgaria", + url = "https://aclanthology.org/2023.alp-1.9", + pages = "80--87" +} +``` + +### Groups and Tasks + +#### Groups + +- `aclue`: All 15 subjects of the ACLUE dataset, evaluated following the methodology in CMMLU's original implementation. + +#### Tasks + +The following tasks evaluate subjects in the ACLUE dataset using loglikelihood-based multiple-choice scoring: +- `aclue_{subject_english}` + +### Checklist + +* [x] Is the task an existing benchmark in the literature? + * [x] Have you referenced the original paper that introduced the task? + * [x] If yes, does the original paper provide a reference implementation? + * [x] Yes, original implementation contributed by author of the benchmark + +If other tasks on this dataset are already supported: +* [x] Is the "Main" variant of this task clearly denoted? +* [x] Have you provided a short sentence in a README on what each new variant adds / evaluates? +* [x] Have you noted which, if any, published evaluation setups are matched by this variant? diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/_default_template_yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/_default_template_yaml new file mode 100644 index 0000000000000000000000000000000000000000..d93ce382d57e8a449868deb79ab544551f7e605b --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/_default_template_yaml @@ -0,0 +1,19 @@ +group: aclue +dataset_path: tyouisen/aclue +test_split: test +fewshot_split: dev +fewshot_config: + sampler: first_n +output_type: multiple_choice +doc_to_text: "{{Question.strip()}}\nA. {{A}}\nB. {{B}}\nC. {{C}}\nD. {{D}}\n答案:" +doc_to_choice: ["A", "B", "C", "D"] +doc_to_target: "{{['A', 'B', 'C', 'D'].index(Answer)}}" +metric_list: + - metric: acc + aggregation: mean + higher_is_better: true + - metric: acc_norm + aggregation: mean + higher_is_better: true +metadata: + version: 0.0 diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/_generate_configs.py b/lm-evaluation-harness/lm_eval/tasks/aclue/_generate_configs.py new file mode 100644 index 0000000000000000000000000000000000000000..182ac51b98f17181a35afccbc887338304216d33 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/_generate_configs.py @@ -0,0 +1,81 @@ +""" +Take in a YAML, and output all other splits with this YAML +""" +import argparse +import os + +import yaml +from tqdm import tqdm + +from lm_eval.utils import eval_logger + + +SUBJECTS = { + "古文单字多义": "polysemy_resolution", + "诗词情感分类": "poetry_sentiment_analysis", + "古汉语命名体识别": "named_entity_recognition", + "古汉语知识": "basic_ancient_chinese", + "古诗词上下句预测": "poetry_context_prediction", + "古文断句": "sentence_segmentation", + "对联": "couplet_prediction", + "古诗词曲鉴赏": "poetry_appreciate", + "国学常识": "ancient_chinese_culture", + "古音学": "ancient_phonetics", + "通假字": "homographic_character_resolution", + "古代文学知识": "ancient_literature", + "医古文": "ancient_medical", + "古诗词质量评估": "poetry_quality_assessment", + "古文阅读理解": "reading_comprehension", +} + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument("--base_yaml_path", required=True) + parser.add_argument("--save_prefix_path", default="aclue") + parser.add_argument("--cot_prompt_path", default=None) + parser.add_argument("--task_prefix", default="") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + + # get filename of base_yaml so we can `"include": ` it in our other YAMLs. + base_yaml_name = os.path.split(args.base_yaml_path)[-1] + with open(args.base_yaml_path, encoding="utf-8") as f: + base_yaml = yaml.full_load(f) + + if args.cot_prompt_path is not None: + import json + + with open(args.cot_prompt_path, encoding="utf-8") as f: + cot_file = json.load(f) + + for subject_zh, subject_eng in tqdm(SUBJECTS.items()): + if args.cot_prompt_path is not None: + description = cot_file[subject_eng] + else: + description = ( + f"以下是关于{subject_zh}的单项选择题,请直接给出正确答案的选项。\n\n" + ) + + yaml_dict = { + "include": base_yaml_name, + "task": f"aclue_{args.task_prefix}_{subject_eng}" + if args.task_prefix != "" + else f"aclue_{subject_eng}", + "dataset_name": subject_eng, + "description": description, + } + + file_save_path = args.save_prefix_path + f"_{subject_eng}.yaml" + eval_logger.info(f"Saving yaml for subset {subject_eng} to {file_save_path}") + with open(file_save_path, "w", encoding="utf-8") as yaml_file: + yaml.dump( + yaml_dict, + yaml_file, + width=float("inf"), + allow_unicode=True, + default_style='"', + ) diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_chinese_culture.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_chinese_culture.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c9f52077dedd24ce500247a4b606eea83fac6320 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_chinese_culture.yaml @@ -0,0 +1,4 @@ +"dataset_name": "ancient_chinese_culture" +"description": "以下是关于国学常识的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_ancient_chinese_culture" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_literature.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_literature.yaml new file mode 100644 index 0000000000000000000000000000000000000000..641befa3aa1920d8dca1c7007a4fe8cd24ab8e77 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_literature.yaml @@ -0,0 +1,4 @@ +"dataset_name": "ancient_literature" +"description": "以下是关于古代文学知识的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_ancient_literature" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_medical.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_medical.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bceaa702c53a1526fc84cf8f5141570352581a44 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_medical.yaml @@ -0,0 +1,4 @@ +"dataset_name": "ancient_medical" +"description": "以下是关于医古文的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_ancient_medical" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_phonetics.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_phonetics.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2fe908e531a07466a66f58f2f5009d5111d5a02d --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_ancient_phonetics.yaml @@ -0,0 +1,4 @@ +"dataset_name": "ancient_phonetics" +"description": "以下是关于古音学的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_ancient_phonetics" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_basic_ancient_chinese.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_basic_ancient_chinese.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5afb88be88b8778fde06cff3a2084bce14397174 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_basic_ancient_chinese.yaml @@ -0,0 +1,4 @@ +"dataset_name": "basic_ancient_chinese" +"description": "以下是关于古汉语知识的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_basic_ancient_chinese" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_couplet_prediction.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_couplet_prediction.yaml new file mode 100644 index 0000000000000000000000000000000000000000..63124eed8eb2c2987e7145ee4633e010407641be --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_couplet_prediction.yaml @@ -0,0 +1,4 @@ +"dataset_name": "couplet_prediction" +"description": "以下是关于对联的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_couplet_prediction" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_homographic_character_resolution.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_homographic_character_resolution.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7d50e35d5f31badfc13b1815fffa487b3fc64c82 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_homographic_character_resolution.yaml @@ -0,0 +1,4 @@ +"dataset_name": "homographic_character_resolution" +"description": "以下是关于通假字的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_homographic_character_resolution" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_named_entity_recognition.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_named_entity_recognition.yaml new file mode 100644 index 0000000000000000000000000000000000000000..566e93019b994528bb003f46fb458ed725ef8af1 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_named_entity_recognition.yaml @@ -0,0 +1,4 @@ +"dataset_name": "named_entity_recognition" +"description": "以下是关于古汉语命名体识别的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_named_entity_recognition" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_appreciate.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_appreciate.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4642992674a1f159fe101859dead4509df6c8166 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_appreciate.yaml @@ -0,0 +1,4 @@ +"dataset_name": "poetry_appreciate" +"description": "以下是关于古诗词曲鉴赏的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_poetry_appreciate" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_context_prediction.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_context_prediction.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1b408b659657b4677e056f93c59f2a59ef60cb95 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_context_prediction.yaml @@ -0,0 +1,4 @@ +"dataset_name": "poetry_context_prediction" +"description": "以下是关于古诗词上下句预测的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_poetry_context_prediction" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_quality_assessment.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_quality_assessment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a7a7bee2c4ca59e0dc7b2f3fdc08371a9a585d42 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_quality_assessment.yaml @@ -0,0 +1,4 @@ +"dataset_name": "poetry_quality_assessment" +"description": "以下是关于古诗词质量评估的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_poetry_quality_assessment" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_sentiment_analysis.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_sentiment_analysis.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6e1367f8043d7e1e9ebcd01dfbaacfbdeb0f9fec --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_poetry_sentiment_analysis.yaml @@ -0,0 +1,4 @@ +"dataset_name": "poetry_sentiment_analysis" +"description": "以下是关于诗词情感分类的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_poetry_sentiment_analysis" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_polysemy_resolution.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_polysemy_resolution.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ee0deea16f6bcb6906fd68e2e65bf72ea276e74a --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_polysemy_resolution.yaml @@ -0,0 +1,4 @@ +"dataset_name": "polysemy_resolution" +"description": "以下是关于古文单字多义的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_polysemy_resolution" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_reading_comprehension.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_reading_comprehension.yaml new file mode 100644 index 0000000000000000000000000000000000000000..92f2455d8089bcc3b7d1ff8b99c03144b5b7d61d --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_reading_comprehension.yaml @@ -0,0 +1,4 @@ +"dataset_name": "reading_comprehension" +"description": "以下是关于古文阅读理解的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_reading_comprehension" diff --git a/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_sentence_segmentation.yaml b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_sentence_segmentation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9d81c3fe6eae35a6adc888d9c73430aa891bfe86 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/aclue/aclue_sentence_segmentation.yaml @@ -0,0 +1,4 @@ +"dataset_name": "sentence_segmentation" +"description": "以下是关于古文断句的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "aclue_sentence_segmentation" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/date_understanding.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/date_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..18c264b08595b818809fa76b61acbf78af55b4c1 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/date_understanding.yaml @@ -0,0 +1,5 @@ +"dataset_name": "date_understanding" +"description": "Infer the date from context.\n\n" +"doc_to_text": "Q: Today is Christmas Eve of 1937. What is the date 10 days ago in MM/DD/YYYY?\nOptions:\n(A) 12/14/2026\n(B) 12/14/1950\n(C) 12/14/2007\n(D) 12/14/1937\n(E) 07/14/1938\n(F) 12/14/1988\nA: (D)\n\nQ: Tomorrow is 11/12/2019. What is the date one year ago from today in MM/DD/YYYY?\nOptions:\n(A) 09/04/2018\n(B) 11/11/2018\n(C) 08/25/2018\n(D) 11/02/2018\n(E) 11/04/2018\nA: (B)\n\nQ: Jane and John married on Jan 2, 1958. It is their 5-year anniversary today. What is the date tomorrow in MM/DD/YYYY?\nOptions:\n(A) 01/11/1961\n(B) 01/03/1963\n(C) 01/18/1961\n(D) 10/14/1960\n(E) 01/03/1982\n(F) 12/03/1960\nA: (B)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_date_understanding" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/geometric_shapes.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/geometric_shapes.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eeda74188d3e000ead5adcee9c5dcb1aa42e673b --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/geometric_shapes.yaml @@ -0,0 +1,5 @@ +"dataset_name": "geometric_shapes" +"description": "Name geometric shapes from their SVG paths.\n\n" +"doc_to_text": "Q: This SVG path element draws a\nOptions:\n(A) circle\n(B) heptagon\n(C) hexagon\n(D) kite\n(E) line\n(F) octagon\n(G) pentagon\n(H) rectangle\n(I) sector\n(J) triangle\nA: (F)\n\nQ: This SVG path element draws a\nOptions:\n(A) circle\n(B) heptagon\n(C) hexagon\n(D) kite\n(E) line\n(F) octagon\n(G) pentagon\n(H) rectangle\n(I) sector\n(J) triangle\nA: (G)\n\nQ: This SVG path element draws a\nOptions:\n(A) circle\n(B) heptagon\n(C) hexagon\n(D) kite\n(E) line\n(F) octagon\n(G) pentagon\n(H) rectangle\n(I) sector\n(J) triangle\nA: (D)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_geometric_shapes" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/movie_recommendation.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/movie_recommendation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7621a383fbefd641192d210ef1c332c695a965ab --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/movie_recommendation.yaml @@ -0,0 +1,5 @@ +"dataset_name": "movie_recommendation" +"description": "Recommend movies similar to the given list of movies.\n\n" +"doc_to_text": "Q: Find a movie similar to Star Wars Episode IV - A New Hope, Indiana Jones and the Last Crusade, Star Wars Episode V - The Empire Strikes Back, The Big Lebowski:\nOptions:\n(A) Tetsuo\n(B) the Ironman\n(C) The Princess Bride\n(D) The Barkley Marathons The Race That Eats Its Young\n(E) Bug\nA: (C)\n\nQ: Find a movie similar to Twister, The Silence of the Lambs, Independence Day, Braveheart:\nOptions:\n(A) They Shoot Horses\n(B) Don't They\n(C) Forrest Gump\n(D) The Salton Sea\n(E) Extreme Days\nA: (C)\n\nQ: Find a movie similar to Minority Report, Total Recall, Inside Out, Forrest Gump:\nOptions:\n(A) Phenomena\n(B) Lilting\n(C) Catwoman\n(D) Edge of Tomorrow\nA: (D)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_movie_recommendation" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/salient_translation_error_detection.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/salient_translation_error_detection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..51640dfe3759f4d02d3836a92293b9c2a204e262 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/salient_translation_error_detection.yaml @@ -0,0 +1,5 @@ +"dataset_name": "salient_translation_error_detection" +"description": "Detect the type of error in an English translation of a German source sentence.\n\n" +"doc_to_text": "Q: The following translations from German to English contain a particular error. That error will be one of the following types: Named Entities: An entity (names, places, locations, etc.) is changed to a different entity. Numerical Values: Numerical values (ordinals or cardinals), dates, and/or units are changed. Modifiers or Adjectives: The modifiers and adjectives pertaining to a noun are changed. Negation or Antonyms: Introduce or remove a negation or change comparatives to their antonyms. Facts: Trivial factual errors not pertaining to the above classes are introduced in the translations. Dropped Content: A significant clause in the translation is removed. Please identify that error. Source: In der Liste der Baudenkmale in Lenzen (Elbe) sind alle Baudenkmale der brandenburgischen Stadt Lenzen (Elbe) und ihrer Ortsteile aufgelistet.\nTranslation: In the list of architectural monuments in Lenzen all architectural monuments of the Brandenburg city of Lenzen and its districts are listed.\nThe translation contains an error pertaining to\nOptions:\n(A) Modifiers or Adjectives\n(B) Numerical Values\n(C) Negation or Antonyms\n(D) Named Entities\n(E) Dropped Content\n(F) Facts\nA: (D)\n\nQ: The following translations from German to English contain a particular error. That error will be one of the following types: Named Entities: An entity (names, places, locations, etc.) is changed to a different entity. Numerical Values: Numerical values (ordinals or cardinals), dates, and/or units are changed. Modifiers or Adjectives: The modifiers and adjectives pertaining to a noun are changed. Negation or Antonyms: Introduce or remove a negation or change comparatives to their antonyms. Facts: Trivial factual errors not pertaining to the above classes are introduced in the translations. Dropped Content: A significant clause in the translation is removed. Please identify that error. Source: Auf dieser Seite sind die Baudenkmäler der oberbayerischen Großen Kreisstadt Landsberg am Lech zusammengestellt.\nTranslation: On this page are compiled the architectural monuments of the town of Landsberg am Lech.\nThe translation contains an error pertaining to\nOptions:\n(A) Modifiers or Adjectives\n(B) Numerical Values\n(C) Negation or Antonyms\n(D) Named Entities\n(E) Dropped Content\n(F) Facts\nA: (E)\n\nQ: The following translations from German to English contain a particular error. That error will be one of the following types: Named Entities: An entity (names, places, locations, etc.) is changed to a different entity. Numerical Values: Numerical values (ordinals or cardinals), dates, and/or units are changed. Modifiers or Adjectives: The modifiers and adjectives pertaining to a noun are changed. Negation or Antonyms: Introduce or remove a negation or change comparatives to their antonyms. Facts: Trivial factual errors not pertaining to the above classes are introduced in the translations. Dropped Content: A significant clause in the translation is removed. Please identify that error. Source: Łeba ist eine Kleinstadt und ein Badeort im Powiat Lęborski der polnischen Woiwodschaft Pommern.\nTranslation: Eba is not a small town and seaside resort in the Powiat Léborski county of the Pomeranian Voivodeship of Poland.\nThe translation contains an error pertaining to\nOptions:\n(A) Modifiers or Adjectives\n(B) Numerical Values\n(C) Negation or Antonyms\n(D) Named Entities\n(E) Dropped Content\n(F) Facts\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_salient_translation_error_detection" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/snarks.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/snarks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1dbc1ca2768067fa3f44fd8727c1f5b811926584 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/snarks.yaml @@ -0,0 +1,5 @@ +"dataset_name": "snarks" +"description": "Determine which of two sentences is sarcastic.\n\nAccording to Cambridge University Dictionary, sarcasm is \"the use of remarks that clearly mean the opposite of what they say, made in order to hurt someone's feelings or to criticize something in a humorous way.\" Sarcastic sentences often contain satirical or ironic utterances, hyperboles, ambivalent or witty remarks.\n\n" +"doc_to_text": "Q: Which statement is sarcastic?\nOptions:\n(A) Yes, because having interests and actively researching them is a huge waste\n(B) Yes, because having interests and actively researching them is a huge deal\nA: (A)\n\nQ: Which statement is sarcastic?\nOptions:\n(A) No one is going to disagree with you on this. Avoiding ad hominem attacks really help your case\n(B) No one is going to disagree with you on this. Ad hominem attacks really help your case\nA: (B)\n\nQ: Which statement is sarcastic?\nOptions:\n(A) Consistency in the league's punishments? What do you think this is supposed to be, politics?\n(B) Consistency in the league's punishments? What do you think this is supposed to be, moral?\nA: (A)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_snarks" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/temporal_sequences.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/temporal_sequences.yaml new file mode 100644 index 0000000000000000000000000000000000000000..920631ba6403db50981e59c620b832700352ad4f --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/temporal_sequences.yaml @@ -0,0 +1,5 @@ +"dataset_name": "temporal_sequences" +"description": "Task description: Answer questions about which times certain events could have occurred.\n\n" +"doc_to_text": "Q: Today, Emily went to the museum. Between what times could they have gone?\nWe know that:\nEmily woke up at 1pm.\nElizabeth saw Emily reading at the library from 2pm to 4pm.\nJessica saw Emily watching a movie at the theater from 4pm to 5pm.\nLeslie saw Emily waiting at the airport from 5pm to 6pm.\nWilliam saw Emily buying clothes at the mall from 6pm to 7pm.\nThe museum was closed after 7pm.\nBetween what times could Emily have gone to the museum?\nOptions:\n(A) 1pm to 2pm\n(B) 6pm to 7pm\n(C) 5pm to 6pm\n(D) 2pm to 4pm\nA: (A)\n\nQ: Today, Elizabeth went to the amusement park. Between what times could they have gone?\nWe know that:\nElizabeth woke up at 7am.\nDavid saw Elizabeth fixing their computer at the electronic store from 1pm to 2pm.\nSarah saw Elizabeth playing tennis at the tennis court from 2pm to 3pm.\nSusan saw Elizabeth walking towards the Statue of Liberty from 3pm to 6pm.\nAndrew saw Elizabeth taking photos near the Eiffel Tower from 6pm to 9pm.\nEmily saw Elizabeth getting a coffee at the cafe from 9pm to 10pm.\nThe amusement park was closed after 10pm.\nBetween what times could Elizabeth have gone to the amusement park?\nOptions:\n(A) 7am to 1pm\n(B) 9pm to 10pm\n(C) 1pm to 2pm\n(D) 3pm to 6pm\nA: (A)\n\nQ: Today, Tiffany went to the beach. Between what times could they have gone?\nWe know that:\nTiffany woke up at 5am.\nBetty saw Tiffany getting a coffee at the cafe from 5am to 6am.\nJessica saw Tiffany working at the office from 6am to 9am.\nJohn saw Tiffany stretching at a yoga studio from 9am to 12pm.\nSean saw Tiffany sitting on a rooftop from 12pm to 2pm.\nSarah saw Tiffany playing tennis at the tennis court from 2pm to 3pm.\nThe beach was closed after 4pm.\nBetween what times could Tiffany have gone to the beach?\nOptions:\n(A) 9am to 12pm\n(B) 12pm to 2pm\n(C) 5am to 6am\n(D) 3pm to 4pm\nA: (D)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_temporal_sequences" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_five_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_five_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a5953369f137ebc04c7d741677c4ce97a0247ad9 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_five_objects.yaml @@ -0,0 +1,5 @@ +"dataset_name": "tracking_shuffled_objects_five_objects" +"description": "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n" +"doc_to_text": "Q: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a yellow ball, Bob has a blue ball, and Claire has a pink ball.\nAs the game progresses, pairs of players trade balls. First, Claire and Alice swap balls. Then, Alice and Bob swap balls. Finally, Claire and Bob swap balls. At the end of the game, Bob has the\nOptions:\n(A) yellow ball\n(B) blue ball\n(C) pink ball\nA: (A)\n\nQ: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a white ball, Bob has a purple ball, and Claire has a pink ball.\nAs the game progresses, pairs of players trade balls. First, Bob and Alice swap balls. Then, Bob and Claire swap balls. Finally, Bob and Alice swap balls. At the end of the game, Alice has the\nOptions:\n(A) white ball\n(B) purple ball\n(C) pink ball\nA: (C)\n\nQ: Alice, Bob, and Claire are dancers at a square dance. At the start of a song, they each have a partner: Alice is dancing with Lola, Bob is dancing with Rodrigo, and Claire is dancing with Patrick.\nThroughout the song, the dancers often trade partners. First, Alice and Bob switch partners. Then, Claire and Bob switch partners. Finally, Bob and Alice switch partners. At the end of the dance, Alice is dancing with\nOptions:\n(A) Lola\n(B) Rodrigo\n(C) Patrick\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_tracking_shuffled_objects_five_objects" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_three_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_three_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fb942582f247bfd59e42ab63b8eca80b9842269b --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_three_objects.yaml @@ -0,0 +1,5 @@ +"dataset_name": "tracking_shuffled_objects_three_objects" +"description": "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n" +"doc_to_text": "Q: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a yellow ball, Bob has a blue ball, and Claire has a pink ball.\nAs the game progresses, pairs of players trade balls. First, Claire and Alice swap balls. Then, Alice and Bob swap balls. Finally, Claire and Bob swap balls. At the end of the game, Bob has the\nOptions:\n(A) yellow ball\n(B) blue ball\n(C) pink ball\nA: (A)\n\nQ: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a white ball, Bob has a purple ball, and Claire has a pink ball.\nAs the game progresses, pairs of players trade balls. First, Bob and Alice swap balls. Then, Bob and Claire swap balls. Finally, Bob and Alice swap balls. At the end of the game, Alice has the\nOptions:\n(A) white ball\n(B) purple ball\n(C) pink ball\nA: (C)\n\nQ: Alice, Bob, and Claire are dancers at a square dance. At the start of a song, they each have a partner: Alice is dancing with Lola, Bob is dancing with Rodrigo, and Claire is dancing with Patrick.\nThroughout the song, the dancers often trade partners. First, Alice and Bob switch partners. Then, Claire and Bob switch partners. Finally, Bob and Alice switch partners. At the end of the dance, Alice is dancing with\nOptions:\n(A) Lola\n(B) Rodrigo\n(C) Patrick\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_tracking_shuffled_objects_three_objects" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/word_sorting.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/word_sorting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f2840db1e39fdedeee407a90b99bf073fcec7a4 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/fewshot/word_sorting.yaml @@ -0,0 +1,5 @@ +"dataset_name": "word_sorting" +"description": "Sort a list of words.\n\n" +"doc_to_text": "Q: Sort the following words alphabetically: List: oven costume counterpart\nA: costume counterpart oven\n\nQ: Sort the following words alphabetically: List: hypochlorite ponderosa phone credulity\nA: credulity hypochlorite phone ponderosa\n\nQ: Sort the following words alphabetically: List: newt arson parthia seismography mugho aspect census\nA: arson aspect census mugho newt parthia seismography\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_word_sorting" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/_zeroshot_template_yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/_zeroshot_template_yaml new file mode 100644 index 0000000000000000000000000000000000000000..728ccae1fba5287a914f4aca0bcfb8108aca9512 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/_zeroshot_template_yaml @@ -0,0 +1,27 @@ +group: bbh_zeroshot +dataset_path: lukaemon/bbh +output_type: generate_until +test_split: test +doc_to_target: "{{target}}" +metric_list: + - metric: exact_match + aggregation: mean + higher_is_better: true + ignore_case: true + # ignore_punctuation: true + regexes_to_ignore: + - "\\.$" + - "," + - "\n" + - "\\\\" + - '"' +generation_kwargs: + until: + - "" + - "Q:" + - "<|im_end|>" + do_sample: false + temperature: 0.0 +num_fewshot: 0 +metadata: + version: 2.0 diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/boolean_expressions.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/boolean_expressions.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fdaddf0e8463890cb0cafda99f31e4adea8b3eb1 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/boolean_expressions.yaml @@ -0,0 +1,16 @@ +"dataset_name": "boolean_expressions" +"description": "Evaluate the result of a random Boolean expression.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_boolean_expressions" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: "regex" + group_select: 0 + regex_pattern: "\\b(True|False)\\b" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/causal_judgement.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/causal_judgement.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c3a39e7f6ef8dee489a754a565127f3c09c395fd --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/causal_judgement.yaml @@ -0,0 +1,16 @@ +"dataset_name": "causal_judgement" +"description": "Answer questions about causal attribution.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_causal_judgement" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: "regex" + group_select: 0 + regex_pattern: "\\b(Yes|No|yes|no)\\b" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/date_understanding.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/date_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f00db0cfe08ba4d079c6d2723443f388b889275e --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/date_understanding.yaml @@ -0,0 +1,18 @@ +"dataset_name": "date_understanding" +"description": "Infer the date from context.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_date_understanding" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/disambiguation_qa.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/disambiguation_qa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0910a627b09b44dfc222e282f9255fa671736760 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/disambiguation_qa.yaml @@ -0,0 +1,18 @@ +"dataset_name": "disambiguation_qa" +"description": "Clarify the meaning of sentences with ambiguous pronouns.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_disambiguation_qa" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/dyck_languages.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/dyck_languages.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9350ea0f5863929c6f1bee8412b5881a5fe217f2 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/dyck_languages.yaml @@ -0,0 +1,15 @@ +"dataset_name": "dyck_languages" +"description": "Correctly close a Dyck-n word.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_dyck_languages" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: "regex" + group_select: 0 + regex_pattern: "(?<= )([\" \\[\\(<{}>\\)\\]]+)|([\" \\[\\(<{}>\\)\\]]+)" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/formal_fallacies.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/formal_fallacies.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1eaf622628a9447188aebaf95040bc37d0be42fa --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/formal_fallacies.yaml @@ -0,0 +1,16 @@ +"dataset_name": "formal_fallacies" +"description": "Distinguish deductively valid arguments from formal fallacies.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_formal_fallacies" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: "regex" + group_select: 0 + regex_pattern: "\\b(valid|invalid)\\b" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/geometric_shapes.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/geometric_shapes.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8a6a828a4c054a90cc077ed2c4352f8e816fb815 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/geometric_shapes.yaml @@ -0,0 +1,18 @@ +"dataset_name": "geometric_shapes" +"description": "Name geometric shapes from their SVG paths.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_geometric_shapes" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/hyperbaton.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/hyperbaton.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a795e8bbe9335e1730bf943017aabf72bcc05816 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/hyperbaton.yaml @@ -0,0 +1,18 @@ +"dataset_name": "hyperbaton" +"description": "Order adjectives correctly in English sentences.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_hyperbaton" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_five_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_five_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f06b02f303b2ec521600078c1aa8424108f23046 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_five_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "logical_deduction_five_objects" +"description": "A logical deduction task which requires deducing the order of a sequence of objects.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_logical_deduction_five_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_seven_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_seven_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3f9ff7eaa0fb655d34ca7d7e938c9f7df4737060 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_seven_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "logical_deduction_seven_objects" +"description": "A logical deduction task which requires deducing the order of a sequence of objects.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_logical_deduction_seven_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_three_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_three_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7bd19d7f5a68edd709764f68b39ad27f36387d72 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/logical_deduction_three_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "logical_deduction_three_objects" +"description": "A logical deduction task which requires deducing the order of a sequence of objects.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_logical_deduction_three_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/movie_recommendation.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/movie_recommendation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b54cbd8b4cc78c433bb0ff10a4104b08f10cfb66 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/movie_recommendation.yaml @@ -0,0 +1,17 @@ +"dataset_name": "movie_recommendation" +"description": "Recommend movies similar to the given list of movies.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_movie_recommendation" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/multistep_arithmetic_two.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/multistep_arithmetic_two.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ef6439f9b1c8357267398fa75da6d98fbd2cced8 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/multistep_arithmetic_two.yaml @@ -0,0 +1,16 @@ +"dataset_name": "multistep_arithmetic_two" +"description": "Solve multi-step arithmetic problems.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_multistep_arithmetic_two" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.NumberParseRegexFilter + group_select: 0 + regex_pattern: "([-0-9]+)" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/navigate.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/navigate.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7a7aeb1c45ce648803c4232262a778c92b8bf1cc --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/navigate.yaml @@ -0,0 +1,15 @@ +"dataset_name": "navigate" +"description": "Given a series of navigation instructions, determine whether one would end up back at the starting point.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_navigate" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: "regex" + group_select: 0 + regex_pattern: "\\b(Yes|No|yes|no)\\b" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/object_counting.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/object_counting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..09df4e148cf3e2f842de116fa16390545b365701 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/object_counting.yaml @@ -0,0 +1,15 @@ +"dataset_name": "object_counting" +"description": "Questions that involve enumerating objects and asking the model to count them.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_object_counting" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.NumberParseRegexFilter + group_select: 0 + regex_pattern: "([-0-9]+)" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/penguins_in_a_table.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/penguins_in_a_table.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3d565f49c8e18fb0f062f891fe095ba42c2ab050 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/penguins_in_a_table.yaml @@ -0,0 +1,17 @@ +"dataset_name": "penguins_in_a_table" +"description": "Answer questions about a table of penguins and their attributes.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_penguins_in_a_table" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/reasoning_about_colored_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/reasoning_about_colored_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..06ccf43e1d40a55d0ef261286c1a86f3d8cb4a1f --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/reasoning_about_colored_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "reasoning_about_colored_objects" +"description": "Answer extremely simple questions about the colors of objects on a surface.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_reasoning_about_colored_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/ruin_names.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/ruin_names.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a1ad23a5ed4479a33a7eade848e4a666eb4e3631 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/ruin_names.yaml @@ -0,0 +1,17 @@ +"dataset_name": "ruin_names" +"description": "Select the humorous edit that 'ruins' the input movie or musical artist name.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_ruin_names" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/salient_translation_error_detection.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/salient_translation_error_detection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..080cbd0571ed14c4064d11d2d0190a1976d8d5f5 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/salient_translation_error_detection.yaml @@ -0,0 +1,17 @@ +"dataset_name": "salient_translation_error_detection" +"description": "Detect the type of error in an English translation of a German source sentence.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_salient_translation_error_detection" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/snarks.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/snarks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..09d37d5cf4d37e808a08ce1071878e2a0316f339 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/snarks.yaml @@ -0,0 +1,17 @@ +"dataset_name": "snarks" +"description": "Determine which of two sentences is sarcastic.\n\nAccording to Cambridge University Dictionary, sarcasm is \"the use of remarks that clearly mean the opposite of what they say, made in order to hurt someone's feelings or to criticize something in a humorous way.\" Sarcastic sentences often contain satirical or ironic utterances, hyperboles, ambivalent or witty remarks.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_snarks" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/sports_understanding.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/sports_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8ba9ca85029ca44bcc3a499e621e6a02afe45d6d --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/sports_understanding.yaml @@ -0,0 +1,19 @@ +"dataset_name": "sports_understanding" +"description": "Determine whether an artificially constructed sentence relating to sports is plausible or not.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_sports_understanding" + +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MapRegexFilter + group_select: 0 + ignore_case: true + regex_pattern_to_value: + \b(no|not plausible)\b: "no" + \b(yes|plausible)\b: "yes" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/temporal_sequences.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/temporal_sequences.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9aa545c02dbc27918ba763dc9d4a6ed31f4a80c1 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/temporal_sequences.yaml @@ -0,0 +1,17 @@ +"dataset_name": "temporal_sequences" +"description": "Task description: Answer questions about which times certain events could have occurred.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_temporal_sequences" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_five_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_five_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..96900c9d32d3825823cfb84b1b2deecf68f0fc3d --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_five_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "tracking_shuffled_objects_five_objects" +"description": "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_tracking_shuffled_objects_five_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_seven_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_seven_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d45619c3c95a0771dbbf8cf08df42ada6e28cdcb --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_seven_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "tracking_shuffled_objects_seven_objects" +"description": "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_tracking_shuffled_objects_seven_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_three_objects.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_three_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1d8150ca4f98f0033600727b060cf8d488c3efe6 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/tracking_shuffled_objects_three_objects.yaml @@ -0,0 +1,17 @@ +"dataset_name": "tracking_shuffled_objects_three_objects" +"description": "A task requiring determining the final positions of a set of objects given their initial positions and a description of a sequence of swaps.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_tracking_shuffled_objects_three_objects" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: 0 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/utils.py b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a3c63df468de9edb7f6c04e31c17db5af9b92be3 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/utils.py @@ -0,0 +1,224 @@ +import collections +import re +import sys +import unicodedata + +from lm_eval.filters.extraction import Filter, RegexFilter + + +class ExtendedRegexFilter(RegexFilter): + punct_tbl = dict.fromkeys( + i for i in range(sys.maxunicode) if unicodedata.category(chr(i)).startswith("P") + ) + + def __init__( + self, + regex_pattern: str = r"#### (\-?[0-9\.\,]+)", + group_select=0, + fallback: str = "[invalid]", + ignore_case=False, + ignore_punctuation=False, + regexes_to_ignore=None, + ) -> None: + super().__init__(regex_pattern, group_select, fallback) + self.ignore_case = ignore_case + self.ignore_punctuation = ignore_punctuation + self.regexes_to_ignore = regexes_to_ignore + + def filter_ignores(self, st): + if self.regexes_to_ignore is not None: + for s in self.regexes_to_ignore: + st = re.sub(s, "", st) + + if self.ignore_case: + st = st.lower() + + if self.ignore_punctuation: + # https://stackoverflow.com/a/266162 + st = st.translate(self.punct_tbl) + return st + + def find_match(self, regex, resp, convert_dict={}): + match = regex.findall(resp) + if match: + match = match[self.group_select] + if isinstance(match, tuple): + match = [m for m in match if m][0] + match = match.strip() + if match and match in convert_dict: + match = convert_dict[match] + return match + + +class MapRegexFilter(ExtendedRegexFilter): + def __init__( + self, + regex_pattern_to_value: dict = {}, + group_select=0, + fallback: str = "[invalid]", + ignore_case=False, + ignore_punctuation=False, + regexes_to_ignore=None, + ) -> None: + """ + regex_pattern_to_value: Match the regex pattern and change the result into the value + group_select: Selects the (group_select)th match from the findall result. We use the whole regex_patterns, concatenated by | + ignore_case: Lowers the case of response before matching with the given regex + ignore_punctuation: Remove the punctuation before matching with the given regex + regexes_to_ignore: Remove these regexes before matching with the given regex + """ + super().__init__( + "|".join(list(regex_pattern_to_value.keys())), + group_select, + fallback, + ignore_case, + ignore_punctuation, + regexes_to_ignore, + ) + self.regex_to_value = { + re.compile(r): v for r, v in regex_pattern_to_value.items() + } + + def apply(self, resps, docs): + filtered_resps = [] + + for r in resps: + filtered = [] + for resp in r: + whole_match_considering_group_select = self.find_match( + self.regex, self.filter_ignores(resp) + ) + if whole_match_considering_group_select: + for regex, mapped_value in self.regex_to_value.items(): + match = self.find_match( + regex, + self.filter_ignores(whole_match_considering_group_select), + ) + if match: + match = mapped_value + break + if not whole_match_considering_group_select or not match: + match = self.fallback + + filtered.append(match) + filtered_resps.append(filtered) + + return filtered_resps + + +class NumberParseRegexFilter(ExtendedRegexFilter): + def apply(self, resps, docs): + # here, we assume we have a list, in which each element is + # a list of model responses for some particular input/target pair. + # so we process each of these (same input/target response sets) + # independently (and keep them a list.) + filtered_resps = [] + import regex + from word2number import w2n + + # https://www.reddit.com/r/regex/comments/11a38uk/parsing_numbers_written_out_as_english_words + english_number_regex = regex.compile( + "((?:(?:zero|one|two|three|four|five|(?:twen|thir|for|fif|six|seven|nine)(?|teen|ty)|eight(?:|een|y)|ten|eleven|twelve|fourteen|hundred|thousand|(?:m|b|tr)illion)(?:zero|one|two|three|four|five|(?:twen|thir|for|fif|six|seven|nine)(?:|teen|ty)|eight(?|een|y)|ten|eleven|twelve|fourteen|hundred|thousand|(?:m|b|tr)illion|[^\S\r\n]|,|and|&)+)?(?:zero|one|two|three|four|five|(?:twen|thir|for|fif|six|seven|nine)(?|teen|ty)|eight(?|een|y)|ten|eleven|twelve|fourteen|hundred|thousand|(?:m|b|tr)illion))" + ) + + for r in resps: + filtered = [] + for resp in r: + match = self.find_match(self.regex, resp) + if not match: + match = self.find_match(english_number_regex, resp.lower()) + if match: + match = str(w2n.word_to_num(match)) + if not match: + match = self.fallback + filtered.append(match) + filtered_resps.append(filtered) + + return filtered_resps + + +class WordSortFilter(Filter): + """ """ + + def apply(self, resps, docs): + filtered_resps = [] + + for r, doc in zip(resps, docs): + words = doc["input"].split("List:")[1].strip().split() + regex = re.compile("|".join([f"\\b{w}\\b" for w in words])) + filtered = [] + for resp in r: + match = regex.findall(resp) + match.reverse() + ordered_words = reversed( + collections.OrderedDict(zip(match, [None] * len(match))) + ) + filtered.append(" ".join(ordered_words)) + filtered_resps.append(filtered) + + return filtered_resps + + +class MultiChoiceRegexFilter(ExtendedRegexFilter): + def __init__(self, *args, **kwargs): + """ + regex_pattern: The basic regex pattern to use. If fails to match, we will use the customized match procedure + - step 1 : We parse the choices between ([A-Z])s then try to find these choices in the response. + - step 2 : We parse the choice with regex :[\s]*([A-?]), where ? varies by number of choices. + group_select: Selects the (group_select)th match from the findall result. + ignore_case: Ignores the case during step 1 matching + ignore_punctuation: Remove the punctuation during step 1 matching + regexes_to_ignore: Remove these regexes during step 1 matching + """ + super().__init__(*args, **kwargs) + + def apply(self, resps, docs): + # here, we assume we have a list, in which each element is + # a list of model responses for some particular input/target pair. + # so we process each of these (same input/target response sets) + # independently (and keep them a list.) + + filtered_resps = [] + + for r, doc in zip(resps, docs): + fallback_regexes = [] + choice_to_alpha = {} + next_alpha = "A" + + without_paren_fallback_regexes = [] + without_paren_to_target = {} + + multiple_choices_regex = re.compile(r"\([A-Z]\)([^\n^(]*)") + match = multiple_choices_regex.findall(doc["input"]) + for m in match: + m = self.filter_ignores(m.strip()) + fallback_regexes.append(f"{re.escape(m)}") + choice_to_alpha[m] = f"({next_alpha})" + + without_paren_fallback_regexes.append(next_alpha) + without_paren_to_target[next_alpha] = f"({next_alpha})" + + next_alpha = chr(ord(next_alpha) + 1) + fallback_regex = re.compile("|".join(fallback_regexes)) + without_paren_fallback_regex = "|".join(without_paren_fallback_regexes) + without_paren_fallback_regex = re.compile( + f":[\s]*({without_paren_fallback_regex})" + ) + + filtered = [] + for resp in r: + match = self.find_match(self.regex, resp) + if not match: + match = self.find_match( + fallback_regex, self.filter_ignores(resp), choice_to_alpha + ) + if not match: + match = self.find_match( + without_paren_fallback_regex, resp, without_paren_to_target + ) + if not match: + match = self.fallback + filtered.append(match) + filtered_resps.append(filtered) + + return filtered_resps diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/web_of_lies.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/web_of_lies.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f2fa1c7d10d1352f5ef6a27cea07d365090a596f --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/web_of_lies.yaml @@ -0,0 +1,18 @@ +"dataset_name": "web_of_lies" +"description": "Evaluate a random boolean function expressed as a word problem.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_web_of_lies" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.MapRegexFilter + group_select: 0 + ignore_case: true + regex_pattern_to_value: + \b(no|does not tell the truth|is not telling the truth)\b: "no" + \b(yes|tells the truth|is telling the truth)\b: "yes" + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/word_sorting.yaml b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/word_sorting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b9b538d58649b653a0c2d2bdd824f9d8f81b1540 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/bbh/zeroshot/word_sorting.yaml @@ -0,0 +1,13 @@ +"dataset_name": "word_sorting" +"description": "Sort a list of words.\n\n" +"doc_to_text": "Q: {{input}}\nA:" +"include": "_zeroshot_template_yaml" +"task": "bbh_zeroshot_word_sorting" +filter_list: + - name: "strict-match" + filter: + - function: "take_first" + - name: "flexible-extract" + filter: + - function: !function utils.WordSortFilter + - function: "take_first" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/_generate_configs.py b/lm-evaluation-harness/lm_eval/tasks/cmmlu/_generate_configs.py new file mode 100644 index 0000000000000000000000000000000000000000..52081150cbe0dc7c12aa4fe7ef7a324b29d85ed7 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/_generate_configs.py @@ -0,0 +1,133 @@ +""" +Take in a YAML, and output all other splits with this YAML +""" +import argparse +import os + +import yaml +from tqdm import tqdm + +from lm_eval.utils import eval_logger + + +SUBJECTS = { + "agronomy": "农学", + "anatomy": "解剖学", + "ancient_chinese": "古汉语", + "arts": "艺术学", + "astronomy": "天文学", + "business_ethics": "商业伦理", + "chinese_civil_service_exam": "中国公务员考试", + "chinese_driving_rule": "中国驾驶规则", + "chinese_food_culture": "中国饮食文化", + "chinese_foreign_policy": "中国外交政策", + "chinese_history": "中国历史", + "chinese_literature": "中国文学", + "chinese_teacher_qualification": "中国教师资格", + "clinical_knowledge": "临床知识", + "college_actuarial_science": "大学精算学", + "college_education": "大学教育学", + "college_engineering_hydrology": "大学工程水文学", + "college_law": "大学法律", + "college_mathematics": "大学数学", + "college_medical_statistics": "大学医学统计", + "college_medicine": "大学医学", + "computer_science": "计算机科学", + "computer_security": "计算机安全", + "conceptual_physics": "概念物理学", + "construction_project_management": "建设工程管理", + "economics": "经济学", + "education": "教育学", + "electrical_engineering": "电气工程", + "elementary_chinese": "小学语文", + "elementary_commonsense": "小学常识", + "elementary_information_and_technology": "小学信息技术", + "elementary_mathematics": "初等数学", + "ethnology": "民族学", + "food_science": "食品科学", + "genetics": "遗传学", + "global_facts": "全球事实", + "high_school_biology": "高中生物", + "high_school_chemistry": "高中化学", + "high_school_geography": "高中地理", + "high_school_mathematics": "高中数学", + "high_school_physics": "高中物理学", + "high_school_politics": "高中政治", + "human_sexuality": "人类性行为", + "international_law": "国际法学", + "journalism": "新闻学", + "jurisprudence": "法理学", + "legal_and_moral_basis": "法律与道德基础", + "logical": "逻辑学", + "machine_learning": "机器学习", + "management": "管理学", + "marketing": "市场营销", + "marxist_theory": "马克思主义理论", + "modern_chinese": "现代汉语", + "nutrition": "营养学", + "philosophy": "哲学", + "professional_accounting": "专业会计", + "professional_law": "专业法学", + "professional_medicine": "专业医学", + "professional_psychology": "专业心理学", + "public_relations": "公共关系", + "security_study": "安全研究", + "sociology": "社会学", + "sports_science": "体育学", + "traditional_chinese_medicine": "中医中药", + "virology": "病毒学", + "world_history": "世界历史", + "world_religions": "世界宗教", +} + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument("--base_yaml_path", required=True) + parser.add_argument("--save_prefix_path", default="cmmlu") + parser.add_argument("--cot_prompt_path", default=None) + parser.add_argument("--task_prefix", default="") + return parser.parse_args() + + +if __name__ == "__main__": + args = parse_args() + + # get filename of base_yaml so we can `"include": ` it in our other YAMLs. + base_yaml_name = os.path.split(args.base_yaml_path)[-1] + with open(args.base_yaml_path, encoding="utf-8") as f: + base_yaml = yaml.full_load(f) + + if args.cot_prompt_path is not None: + import json + + with open(args.cot_prompt_path, encoding="utf-8") as f: + cot_file = json.load(f) + + for subject_eng, subject_zh in tqdm(SUBJECTS.items()): + if args.cot_prompt_path is not None: + description = cot_file[subject_eng] + else: + description = ( + f"以下是关于{subject_zh}的单项选择题,请直接给出正确答案的选项。\n\n" + ) + + yaml_dict = { + "include": base_yaml_name, + "task": f"cmmlu_{args.task_prefix}_{subject_eng}" + if args.task_prefix != "" + else f"cmmlu_{subject_eng}", + "dataset_name": subject_eng, + "description": description, + } + + file_save_path = args.save_prefix_path + f"_{subject_eng}.yaml" + eval_logger.info(f"Saving yaml for subset {subject_eng} to {file_save_path}") + with open(file_save_path, "w", encoding="utf-8") as yaml_file: + yaml.dump( + yaml_dict, + yaml_file, + width=float("inf"), + allow_unicode=True, + default_style='"', + ) diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_civil_service_exam.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_civil_service_exam.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dcf6c7e6eeb52f551442de521ed4cc4fdfd272f1 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_civil_service_exam.yaml @@ -0,0 +1,4 @@ +"dataset_name": "chinese_civil_service_exam" +"description": "以下是关于中国公务员考试的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_chinese_civil_service_exam" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_food_culture.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_food_culture.yaml new file mode 100644 index 0000000000000000000000000000000000000000..52400c56bc4b6e39af23137c179f53102b7009a6 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_food_culture.yaml @@ -0,0 +1,4 @@ +"dataset_name": "chinese_food_culture" +"description": "以下是关于中国饮食文化的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_chinese_food_culture" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_literature.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_literature.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4166c122c8c12a0268f67ed646e2c31698d7a40c --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_literature.yaml @@ -0,0 +1,4 @@ +"dataset_name": "chinese_literature" +"description": "以下是关于中国文学的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_chinese_literature" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_teacher_qualification.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_teacher_qualification.yaml new file mode 100644 index 0000000000000000000000000000000000000000..226e98a92e435abefc82c34fad8755c80ea42448 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_chinese_teacher_qualification.yaml @@ -0,0 +1,4 @@ +"dataset_name": "chinese_teacher_qualification" +"description": "以下是关于中国教师资格的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_chinese_teacher_qualification" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_education.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_education.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f1dc8a8a4fbc9664da04e2288cf782a9cc1e1877 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_education.yaml @@ -0,0 +1,4 @@ +"dataset_name": "education" +"description": "以下是关于教育学的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_education" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_logical.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_logical.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4c4ac2e12abb2fa29dd2e194f5f1b9417f61142b --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_logical.yaml @@ -0,0 +1,4 @@ +"dataset_name": "logical" +"description": "以下是关于逻辑学的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_logical" diff --git a/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_professional_medicine.yaml b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_professional_medicine.yaml new file mode 100644 index 0000000000000000000000000000000000000000..92fed45e74f9b69b2c7b595a4bb682318fe0b81c --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/cmmlu/cmmlu_default_professional_medicine.yaml @@ -0,0 +1,4 @@ +"dataset_name": "professional_medicine" +"description": "以下是关于专业医学的单项选择题,请直接给出正确答案的选项。\n\n" +"include": "_default_template_yaml" +"task": "cmmlu_professional_medicine" diff --git a/lm-evaluation-harness/lm_eval/tasks/logiqa/README.md b/lm-evaluation-harness/lm_eval/tasks/logiqa/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e9dff3c546f2cf690f1079130a8b9b61db492d78 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/logiqa/README.md @@ -0,0 +1,52 @@ +# LogiQA + +### Paper + +Title: `LogiQA: A Challenge Dataset for Machine Reading Comprehension with Logical Reasoning` + +Abstract: https://arxiv.org/abs/2007.08124 + +LogiQA is a dataset for testing human logical reasoning. It consists of 8,678 QA +instances, covering multiple types of deductive reasoning. Results show that state- +of-the-art neural models perform by far worse than human ceiling. The dataset can +also serve as a benchmark for reinvestigating logical AI under the deep learning +NLP setting. + +Homepage: https://github.com/lgw863/LogiQA-dataset + + +### Citation + +``` +@misc{liu2020logiqa, + title={LogiQA: A Challenge Dataset for Machine Reading Comprehension with Logical Reasoning}, + author={Jian Liu and Leyang Cui and Hanmeng Liu and Dandan Huang and Yile Wang and Yue Zhang}, + year={2020}, + eprint={2007.08124}, + archivePrefix={arXiv}, + primaryClass={cs.CL} +} +``` + +### Groups and Tasks + +#### Groups + +* Not part of a group yet + +#### Tasks + +* `logiqa` + +### Checklist + +For adding novel benchmarks/datasets to the library: +* [ ] Is the task an existing benchmark in the literature? + * [ ] Have you referenced the original paper that introduced the task? + * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test? + + +If other tasks on this dataset are already supported: +* [ ] Is the "Main" variant of this task clearly denoted? +* [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates? +* [ ] Have you noted which, if any, published evaluation setups are matched by this variant? diff --git a/lm-evaluation-harness/lm_eval/tasks/logiqa/logiqa.yaml b/lm-evaluation-harness/lm_eval/tasks/logiqa/logiqa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3e318b7d16053ff28069b91edddea095c2f0ca36 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/logiqa/logiqa.yaml @@ -0,0 +1,23 @@ +task: logiqa +dataset_path: EleutherAI/logiqa +dataset_name: logiqa +output_type: multiple_choice +training_split: train +validation_split: validation +test_split: test +doc_to_choice: "{{options}}" +doc_to_text: !function utils_logiqa.doc_to_text +doc_to_target: !function utils_logiqa.doc_to_target +doc_to_decontamination_query: "{{context}}" +should_decontaminate: true +metric_list: + - metric: acc + aggregation: mean + higher_is_better: true + - metric: acc_norm + aggregation: mean + higher_is_better: true +metadata: + version: 1.0 +dataset_kwargs: + trust_remote_code: true diff --git a/lm-evaluation-harness/lm_eval/tasks/logiqa/utils_logiqa.py b/lm-evaluation-harness/lm_eval/tasks/logiqa/utils_logiqa.py new file mode 100644 index 0000000000000000000000000000000000000000..c462db9115f8747097e3af4f4e7a3c5a1165a1bd --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/logiqa/utils_logiqa.py @@ -0,0 +1,24 @@ +# Copied from Master +def doc_to_text(doc) -> str: + """ + Passage: + Question: + Choices: + A. + B. + C. + D. + Answer: + """ + choices = ["a", "b", "c", "d"] + prompt = "Passage: " + doc["context"] + "\n" + prompt += "Question: " + doc["question"] + "\nChoices:\n" + for choice, option in zip(choices, doc["options"]): + prompt += f"{choice.upper()}. {option}\n" + prompt += "Answer:" + return prompt + + +def doc_to_target(doc) -> int: + choices = ["a", "b", "c", "d"] + return choices.index(doc["label"].strip()) diff --git a/lm-evaluation-harness/lm_eval/tasks/sciq/README.md b/lm-evaluation-harness/lm_eval/tasks/sciq/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4ce355bd41d6a4e9e8ca2aec1e4bc0b4f1a46663 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/sciq/README.md @@ -0,0 +1,49 @@ +# SciQ + +### Paper + +Title: `Crowdsourcing Multiple Choice Science Questions` + +Abstract: https://aclanthology.org/W17-4413.pdf + +The SciQ dataset contains 13,679 crowdsourced science exam questions about Physics, +Chemistry and Biology, among others. The questions are in multiple-choice format +with 4 answer options each. For the majority of the questions, an additional paragraph +with supporting evidence for the correct answer is provided. + +Homepage: https://allenai.org/data/sciq + + +### Citation + +``` +@inproceedings{Welbl2017CrowdsourcingMC, + title={Crowdsourcing Multiple Choice Science Questions}, + author={Johannes Welbl and Nelson F. Liu and Matt Gardner}, + booktitle={NUT@EMNLP}, + year={2017} +} +``` + +### Groups and Tasks + +#### Groups + +* Not part of a group yet. + +#### Tasks + +* `sciq` + +### Checklist + +For adding novel benchmarks/datasets to the library: +* [ ] Is the task an existing benchmark in the literature? + * [ ] Have you referenced the original paper that introduced the task? + * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test? + + +If other tasks on this dataset are already supported: +* [ ] Is the "Main" variant of this task clearly denoted? +* [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates? +* [ ] Have you noted which, if any, published evaluation setups are matched by this variant? diff --git a/lm-evaluation-harness/lm_eval/tasks/sciq/sciq.yaml b/lm-evaluation-harness/lm_eval/tasks/sciq/sciq.yaml new file mode 100644 index 0000000000000000000000000000000000000000..926d66b180bb0732390a94a1bb217bd868636fde --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/sciq/sciq.yaml @@ -0,0 +1,21 @@ +task: sciq +dataset_path: sciq +dataset_name: null +output_type: multiple_choice +training_split: train +validation_split: validation +test_split: test +doc_to_text: "{{support.lstrip()}}\nQuestion: {{question}}\nAnswer:" +doc_to_target: 3 +doc_to_choice: "{{[distractor1, distractor2, distractor3, correct_answer]}}" +should_decontaminate: true +doc_to_decontamination_query: "{{support}} {{question}}" +metric_list: + - metric: acc + aggregation: mean + higher_is_better: true + - metric: acc_norm + aggregation: mean + higher_is_better: true +metadata: + version: 1.0 diff --git a/lm-evaluation-harness/lm_eval/tasks/unscramble/README.md b/lm-evaluation-harness/lm_eval/tasks/unscramble/README.md new file mode 100644 index 0000000000000000000000000000000000000000..674974a79c2be292486b5cc2181e7695f630de20 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/unscramble/README.md @@ -0,0 +1,57 @@ +# Unscramble + +### Paper + +Language Models are Few-Shot Learners +https://arxiv.org/pdf/2005.14165.pdf + +Unscramble is a small battery of 5 “character manipulation” tasks. Each task +involves giving the model a word distorted by some combination of scrambling, +addition, or deletion of characters, and asking it to recover the original word. + +Homepage: https://github.com/openai/gpt-3/tree/master/data + + +### Citation + +``` +@inproceedings{NEURIPS2020_1457c0d6, + author = {Brown, Tom and Mann, Benjamin and Ryder, Nick and Subbiah, Melanie and Kaplan, Jared D and Dhariwal, Prafulla and Neelakantan, Arvind and Shyam, Pranav and Sastry, Girish and Askell, Amanda and Agarwal, Sandhini and Herbert-Voss, Ariel and Krueger, Gretchen and Henighan, Tom and Child, Rewon and Ramesh, Aditya and Ziegler, Daniel and Wu, Jeffrey and Winter, Clemens and Hesse, Chris and Chen, Mark and Sigler, Eric and Litwin, Mateusz and Gray, Scott and Chess, Benjamin and Clark, Jack and Berner, Christopher and McCandlish, Sam and Radford, Alec and Sutskever, Ilya and Amodei, Dario}, + booktitle = {Advances in Neural Information Processing Systems}, + editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin}, + pages = {1877--1901}, + publisher = {Curran Associates, Inc.}, + title = {Language Models are Few-Shot Learners}, + url = {https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf}, + volume = {33}, + year = {2020} +} +``` + +### Groups and Tasks + +#### Groups + +* `unscramble` + +#### Tasks + +* `anagrams1` - Anagrams of all but the first and last letter. +* `anagrams2` - Anagrams of all but the first and last 2 letters. +* `cycle_letters` - Cycle letters in a word. +* `random_insertion` - Random insertions in the word that must be removed. +* `reversed_words` - Words spelled backwards that must be reversed. + +### Checklist + +For adding novel benchmarks/datasets to the library: +* [x] Is the task an existing benchmark in the literature? + * [x] Have you referenced the original paper that introduced the task? + * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test? + + +If other tasks on this dataset are already supported: +* [x] Is the "Main" variant of this task clearly denoted? +* [x] Have you provided a short sentence in a README on what each new variant adds / evaluates? +* [x] Have you noted which, if any, published evaluation setups are matched by this variant? + * [x] Checked for equivalence with v0.3.0 LM Evaluation Harness diff --git a/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams1.yaml b/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..392fc78f94a15d7b4d0643e1dc414c9748280b0c --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams1.yaml @@ -0,0 +1,22 @@ +group: + - unscramble +task: anagrams1 +dataset_path: EleutherAI/unscramble +dataset_name: mid_word_1_anagrams +output_type: generate_until +test_split: validation +doc_to_text: "{{context}}" +doc_to_target: "{{completion}}" +generation_kwargs: + until: + - "\n" +metric_list: + - metric: exact_match + aggregation: mean + higher_is_better: true + ignore_case: false + ignore_punctuation: false +metadata: + version: 2.0 +dataset_kwargs: + trust_remote_code: true diff --git a/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams2.yaml b/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams2.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f1dbe6fb5fb25d45475babe4e6c3771d9c89fe9 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams2.yaml @@ -0,0 +1,22 @@ +group: + - unscramble +task: anagrams2 +dataset_path: EleutherAI/unscramble +dataset_name: mid_word_2_anagrams +output_type: generate_until +test_split: validation +doc_to_text: "{{context}}" +doc_to_target: "{{completion}}" +generation_kwargs: + until: + - "\n" +metric_list: + - metric: exact_match + aggregation: mean + higher_is_better: true + ignore_case: false + ignore_punctuation: false +metadata: + version: 2.0 +dataset_kwargs: + trust_remote_code: true diff --git a/lm-evaluation-harness/lm_eval/tasks/unscramble/cycle_letters.yaml b/lm-evaluation-harness/lm_eval/tasks/unscramble/cycle_letters.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dc7ccf977cb0b5f8e372739a2c53fa4bbf5c92d3 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/unscramble/cycle_letters.yaml @@ -0,0 +1,22 @@ +group: + - unscramble +task: cycle_letters +dataset_path: EleutherAI/unscramble +dataset_name: cycle_letters_in_word +output_type: generate_until +test_split: validation +doc_to_text: "{{context}}" +doc_to_target: "{{completion}}" +generation_kwargs: + until: + - "\n" +metric_list: + - metric: exact_match + aggregation: mean + higher_is_better: true + ignore_case: false + ignore_punctuation: false +metadata: + version: 2.0 +dataset_kwargs: + trust_remote_code: true diff --git a/lm-evaluation-harness/lm_eval/tasks/unscramble/random_insertion.yaml b/lm-evaluation-harness/lm_eval/tasks/unscramble/random_insertion.yaml new file mode 100644 index 0000000000000000000000000000000000000000..189c2415f12a49334dd18e6a6c63c36cfc9300f7 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/unscramble/random_insertion.yaml @@ -0,0 +1,22 @@ +group: + - unscramble +task: random_insertion +dataset_path: EleutherAI/unscramble +dataset_name: random_insertion_in_word +output_type: generate_until +test_split: validation +doc_to_text: "{{context}}" +doc_to_target: "{{completion}}" +generation_kwargs: + until: + - "\n" +metric_list: + - metric: exact_match + aggregation: mean + higher_is_better: true + ignore_case: false + ignore_punctuation: false +metadata: + version: 2.0 +dataset_kwargs: + trust_remote_code: true diff --git a/lm-evaluation-harness/lm_eval/tasks/unscramble/reversed_words.yaml b/lm-evaluation-harness/lm_eval/tasks/unscramble/reversed_words.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d1bc37dc57b1ae4a3e4608c643e63a6b97dd49c7 --- /dev/null +++ b/lm-evaluation-harness/lm_eval/tasks/unscramble/reversed_words.yaml @@ -0,0 +1,20 @@ +group: + - unscramble +task: reversed_words +dataset_path: EleutherAI/unscramble +dataset_name: reversed_words +output_type: generate_until +test_split: validation +doc_to_text: "{{context}}" +doc_to_target: "{{completion}}" +generation_kwargs: + until: + - "\n" +metric_list: + - metric: exact_match + aggregation: mean + higher_is_better: true + ignore_case: false + ignore_punctuation: false +metadata: + version: 2.0