diff --git a/lm-evaluation/lm_eval/tasks/bbh/README.md b/lm-evaluation/lm_eval/tasks/bbh/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9ef2a4abdad4ac293d8a74865397ae7ed08a16ca --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/README.md @@ -0,0 +1,49 @@ +# BigBenchHard + +## Paper +Title: `Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them` +Abstract: https://arxiv.org/abs/2210.09261 + +A suite of 23 challenging BIG-Bench tasks which we call BIG-Bench Hard (BBH). +These are the task for which prior language model evaluations did not outperform +the average human-rater. + +Homepage: https://github.com/suzgunmirac/BIG-Bench-Hard + + +## Citation +``` +@article{suzgun2022challenging, + title={Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them}, + author={Suzgun, Mirac and Scales, Nathan and Sch{\"a}rli, Nathanael and Gehrmann, Sebastian and Tay, Yi and Chung, Hyung Won and Chowdhery, Aakanksha and Le, Quoc V and Chi, Ed H and Zhou, Denny and and Wei, Jason}, + journal={arXiv preprint arXiv:2210.09261}, + year={2022} +} +``` + +### Groups and Tasks + +#### Groups + +- `bbh_zeroshot` +- `bbh_fewshot` +- `bbh_cot_fewshot` +- `bbh_cot_zeroshot` + + +#### Tasks + +- ... + +### Checklist + +- [x] Is in Eval-harness v1.0 ? +- [ ] Has been checked for regression from v1.0? +- [ ] Has been checked for equivalence with original paper methodology? +- [ ] "Main" checked variant clearly denoted? + +### Variant Wishlist + +- [ ] Variant with Calculator (see https://github.com/openai/grade-school-math/blob/master/grade_school_math/calculator.py for example implementation) +- [ ] Using Verifiers +- [ ] Majority voting "without CoT" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/logical_deduction_seven_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/logical_deduction_seven_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8014f9c690fb1029e60526dd09f6c3431b8efea9 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/logical_deduction_seven_objects.yaml @@ -0,0 +1,5 @@ +"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: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. In a golf tournament, there were three golfers: Amy, Eli, and Eve. Eve finished above Amy. Eli finished below Amy.\nOptions:\n(A) Amy finished last\n(B) Eli finished last\n(C) Eve finished last\nA: Let's think step by step.\n(1) Eve finished above Amy: \"(above) ? Eve ? Amy ? (below)\".\n(2) Eli finished below Amy: \"(above) ? Amy ? Eli ? (below)\".\n(3) Combining (1) and (2) we get the following ordering: \"(above) Eve Amy Eli (below)\".\nAccording to this ordering, the person who finished last (the one at the bottom of this list) is Eli.\nEli finished last. So the answer is (B).\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a white book, a green book, and an orange book. The green book is to the right of the white book. The orange book is the rightmost.\nOptions:\n(A) The white book is the leftmost\n(B) The green book is the leftmost\n(C) The orange book is the leftmost\nA: Let's think step by step.\n(1) The green book is to the right of the white book: \"(left) ? white ? green ? (right)\".\n(2) The orange book is the rightmost: \"(left) ? white ? green orange (right)\".\n(3) Combining (1) and (2) we get the following ordering: \"(left) white green orange (right)\".\nAccording to this ordering, the leftmost book is the white book.\nThe white book is the leftmost. So the answer is (A).\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a red book, a gray book, and a white book. The white book is to the left of the gray book. The red book is the second from the left.\nOptions:\n(A) The red book is the leftmost\n(B) The gray book is the leftmost\n(C) The white book is the leftmost\nA: Let's think step by step.\n(1) The white book is to the left of the gray book: \"(left) ? white ? gray ? (right)\".\n(2) The red book is the second from the left: \"(left) ? white red gray ? (right)\".\n(3) Combining (1) and (2) we get the following ordering: \"(left) white red gray (right)\".\nAccording to this ordering, the leftmost book is the white book.\nThe white book is the leftmost. So the answer is (C).\n\nQ: {{input}}\nA: Let's think step by step.\n" +"include": "_cot_fewshot_template_yaml" +"task": "bbh_cot_fewshot_logical_deduction_seven_objects" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/multistep_arithmetic_two.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/multistep_arithmetic_two.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0b444945d0f4f39680399aab676eca91776d13c2 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/multistep_arithmetic_two.yaml @@ -0,0 +1,5 @@ +"dataset_name": "multistep_arithmetic_two" +"description": "Solve multi-step arithmetic problems.\n\n" +"doc_to_text": "Q: ((-5 + 9 * -4 - 0) * (4 + -7 + 0 * -5)) =\nA: Let's think step by step.\nLet\u2019s recall that the order of operations in mathematics is as follows: (1) Parentheses, (2) exponents, (3) multiplication and division (from left to right), (4) addition and multiplication (from left to right). So, remember to always compute the expressions inside parentheses or brackets first.\nThis equation can be written as \"A * B\", where A = (-5 + 9 * -4 - 0) and B = (4 + -7 + 0 * -5).\nLet's calculate A = (-5 + 9 * -4 - 0) = (-5 + (9 * -4) - 0) = (-5 + (-36) - 0) = (-5 + -36 - 0) = -5 - 36 = -41.\nLet's calculate B = (4 + -7 + 0 * -5) = (4 + -7 + (0 * -5)) = (4 + -7 + 0) = (4 + -7) = (4 - 7) = -3.\nThen, the final equation is A * B = -41 * -3 = (-61) * (-3) = 123. So the answer is 123.\n\nQ: ((-9 * 7 * 7 * -9) + (4 * -9 - 8 - -4)) =\nA: Let's think step by step.\nLet\u2019s recall that the order of operations in mathematics is as follows: (1) Parentheses, (2) exponents, (3) multiplication and division (from left to right), (4) addition and multiplication (from left to right). So, remember to always compute the expressions inside parentheses or brackets first.\nThis equation can be written as \"A + B\", where A = (-9 * 7 * 7 * -9) and B = (4 * -9 - 8 - -4).\nLet's calculate A = (-9 * 7 * 7 * -9) = ((-9 * 7) * (7 * -9)) = ((-63) * (-63)) = 3969.\nLet's calculate B = (4 * -9 - 8 - (-4)) = ((4 * -9) - 8 - (-4)) = ((-36) - 8 - (-4)) = ((-36 - 8) - (-4)) = (-44 - (-4)) = -40.\nThen, the final equation is A + B = 3969 + -40 = 3969 - 40 = 3929. So the answer is 3929.\n\nQ: ((-3 + 5 * 8 * -4) - (9 - 8 * -7 + -9)) =\nA: Let's think step by step.\nLet\u2019s recall that the order of operations in mathematics is as follows: (1) Parentheses, (2) exponents, (3) multiplication and division (from left to right), (4) addition and multiplication (from left to right). So, remember to always compute the expressions inside parentheses or brackets first.\nThis equation can be written as \"A - B\", where A = (-3 + 5 * 8 * -4) and B = (9 - 8 * -7 + -9).\nLet's calculate A = (-3 + 5 * 8 * -4) = (-3 + (5 * 8) * -4) = (-3 + (40) * -4) = (-3 + (40 * -4)) = (-3 + -160) = -163.\nLet's calculate B = (9 - 8 * -7 + -9) = (9 - (8 * -7) + -9) = (9 - (-56) + -9) = ((9 - (-56)) + -9) = ((65) + -9)= (65 - 9) = 56.\nThen, the final equation is A - B = -163 - 56 = -219. So the answer is -219.\n\nQ: {{input}}\nA: Let's think step by step.\n" +"include": "_cot_fewshot_template_yaml" +"task": "bbh_cot_fewshot_multistep_arithmetic_two" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/salient_translation_error_detection.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/salient_translation_error_detection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f8f7b885ef71489173413e2a1857cc23cb46b614 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_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: Let's think step by step.\nWe solve this question by first translating the source sentence to English and then by comparing our translation with the provided translation. According to Google Translate, the correct translation of the source sentence from German to English is \"The list of monuments in Lenzen (Elbe) includes all the monuments in the Brandenburg town of Lenzen (Elbe) and its districts.\" On the other hand, the provided translation is \"In the list of architectural monuments in Lenzen all architectural monuments of the Brandenburg city of Lenzen and its districts are listed.\" Note that Lenzen (Elbe) is changed to Lenzen in the original translation; so, there is a named entity error. Because an entity in the original source sentence is changed to a different entity in the translation, the translation contains an error pertaining to Named Entities. So the answer is (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\u00e4ler der oberbayerischen Gro\u00dfen 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: Let's think step by step.\nWe solve this question by first translating the source sentence to English and then by comparing our translation with the provided translation. According to Google Translate, the correct translation of the source sentence from German to English is \"The monuments of the Upper Bavarian district town of Landsberg am Lech are compiled on this page.\" On the other hand, the provided translation is \"On this page are compiled the architectural monuments of the town of Landsberg am Lech.\" Note that an important detail about the location of Landsberg am Lech is omitted in the original translation: The translation should have said \"Upper Bavarian district town of Landsberg am Lech\". Because a significant clause in the translation was removed, the translation contains an error pertaining to Dropped Content. So the answer is (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: \u0141eba ist eine Kleinstadt und ein Badeort im Powiat L\u0119borski der polnischen Woiwodschaft Pommern.\nTranslation: Eba is not a small town and seaside resort in the Powiat L\u00e9borski 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: Let's think step by step.\nWe solve this question by first translating the source sentence to English and then by comparing our translation with the provided translation. According to Google Translate, the correct translation of the source sentence from German to English is \"\u0141eba is a small town and seaside resort in the Powiat L\u0119borski of the Polish Pomeranian Voivodeship.\" On the other hand, the provided translation is \"\u0141eba is not a small town and seaside resort in the Powiat L\u00e9borski county of the Pomeranian Voivodeship of Poland.\" Note that the provided sentence says, \"\u0141eba is not a small town ...\" However, the translation should have been \"\u0141eba is a small town ...\" Because a negation is introduced at the beginning of the sentence and has fundamentally changed the meaning of the original source, the translation contains an error pertaining to Negation or Antonyms. So the answer is (C).\n\nQ: {{input}}\nA: Let's think step by step.\n" +"include": "_cot_fewshot_template_yaml" +"task": "bbh_cot_fewshot_salient_translation_error_detection" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/temporal_sequences.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_fewshot/temporal_sequences.yaml new file mode 100644 index 0000000000000000000000000000000000000000..69bc41c7c0c4102f897268554344a9452dad6993 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_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: Let's think step by step.\nWake-up time: 1pm.\n1pm-2pm: free.\n2pm-4pm: reading at the library.\n4pm-5pm: watching a movie at the theater.\n5pm-6pm: waiting at the airport.\n6pm-7pm: buying clothes at the mall.\nThe museum closure time: 7pm.\nThe only time when Emily could have gone to the museum was 1pm to 2pm. So the answer is (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: Let's think step by step.\nWake-up time: 7am.\n7am-1pm: free.\n1pm-2pm: fixing their computer at the electronic store.\n2pm-3pm: playing tennis at the tennis court.\n3pm-6pm: walking towards the Statue of Liberty.\n6pm-9pm: taking photos near the Eiffel Tower.\n9pm-10pm: getting a coffee at the cafe.\nThe amusement park closure time: 10pm.\nThe only time when Elizabeth could have gone to the amusement park was 7am to 1pm. So the answer is (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: Let's think step by step.\nWake-up time: 5am.\n5am-6am: getting a coffee at the cafe.\n6am-9am: working at the office.\n9am-12pm: stretching at a yoga studio.\n12pm-2pm: sitting on a rooftop.\n2pm-3pm: playing tennis at the tennis court.\n3pm-4pm: free.\nThe beach closure time: 4pm.\nThe only time when Tiffany could have gone to the beach was 3pm to 4pm. So the answer is (D).\n\nQ: {{input}}\nA: Let's think step by step.\n" +"include": "_cot_fewshot_template_yaml" +"task": "bbh_cot_fewshot_temporal_sequences" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/_cot_zeroshot_template_yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/_cot_zeroshot_template_yaml new file mode 100644 index 0000000000000000000000000000000000000000..5e62b0bac165fd19477099853e4dc3090f057bc6 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/_cot_zeroshot_template_yaml @@ -0,0 +1,27 @@ +group: bbh_cot_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/lm_eval/tasks/bbh/cot_zeroshot/boolean_expressions.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/boolean_expressions.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0d28c969b6bdd3445d8b246659f4f2bf9bb3e323 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/boolean_expressions.yaml @@ -0,0 +1,18 @@ +"dataset_name": "boolean_expressions" +"description": "Evaluate the result of a random Boolean expression.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_boolean_expressions" + +filter_list: + - name: "flexible-extract" + filter: + - function: "regex" + group_select: -1 + regex_pattern: "\\b(True|False)\\b" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/causal_judgement.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/causal_judgement.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2bf47baad136dc6d44eaec82d6fdf1520c3a114b --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/causal_judgement.yaml @@ -0,0 +1,18 @@ +"dataset_name": "causal_judgement" +"description": "Answer questions about causal attribution.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_causal_judgement" + +filter_list: + - name: "flexible-extract" + filter: + - function: "regex" + group_select: -1 + regex_pattern: "\\b(Yes|No|yes|no)\\b" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/date_understanding.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/date_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c894b9c8ee151ef6c83a043737c5fb43de32ac03 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/date_understanding.yaml @@ -0,0 +1,20 @@ +"dataset_name": "date_understanding" +"description": "Infer the date from context.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_date_understanding" + +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/disambiguation_qa.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/disambiguation_qa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..725a70ecfc08b89c3fb9766e854bd48995fcc1f3 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/disambiguation_qa.yaml @@ -0,0 +1,20 @@ +"dataset_name": "disambiguation_qa" +"description": "Clarify the meaning of sentences with ambiguous pronouns.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_disambiguation_qa" + +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/dyck_languages.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/dyck_languages.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fa1b289cfa198196bf2c45f6243d3a8b0e26193f --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/dyck_languages.yaml @@ -0,0 +1,17 @@ +"dataset_name": "dyck_languages" +"description": "Correctly close a Dyck-n word.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_dyck_languages" +filter_list: + - name: "flexible-extract" + filter: + - function: "regex" + group_select: -1 + regex_pattern: "(?<= )([\" \\[\\(<{}>\\)\\]]+)|([\" \\[\\(<{}>\\)\\]]+)" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/formal_fallacies.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/formal_fallacies.yaml new file mode 100644 index 0000000000000000000000000000000000000000..02c7eebe8ac14e14781381235908eabcf446842a --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/formal_fallacies.yaml @@ -0,0 +1,18 @@ +"dataset_name": "formal_fallacies" +"description": "Distinguish deductively valid arguments from formal fallacies.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_formal_fallacies" + +filter_list: + - name: "flexible-extract" + filter: + - function: "regex" + group_select: -1 + regex_pattern: "\\b(valid|invalid)\\b" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/geometric_shapes.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/geometric_shapes.yaml new file mode 100644 index 0000000000000000000000000000000000000000..833b93d7a31ced1132f19dd14b47bdc795b02325 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/geometric_shapes.yaml @@ -0,0 +1,20 @@ +"dataset_name": "geometric_shapes" +"description": "Name geometric shapes from their SVG paths.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_geometric_shapes" + +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/hyperbaton.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/hyperbaton.yaml new file mode 100644 index 0000000000000000000000000000000000000000..152a5d1dca434012aea5d3501225f850987b2465 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/hyperbaton.yaml @@ -0,0 +1,20 @@ +"dataset_name": "hyperbaton" +"description": "Order adjectives correctly in English sentences.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_hyperbaton" + +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/movie_recommendation.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/movie_recommendation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c1b68b8b881ca929d284094fa129bca064bc08e4 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/movie_recommendation.yaml @@ -0,0 +1,19 @@ +"dataset_name": "movie_recommendation" +"description": "Recommend movies similar to the given list of movies.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_movie_recommendation" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/multistep_arithmetic_two.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/multistep_arithmetic_two.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9b8f6d7228b76d74d7eff09ead513bd1eb81d4a1 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/multistep_arithmetic_two.yaml @@ -0,0 +1,18 @@ +"dataset_name": "multistep_arithmetic_two" +"description": "Solve multi-step arithmetic problems.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_multistep_arithmetic_two" + +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.NumberParseRegexFilter + group_select: -1 + regex_pattern: "([-0-9]+)" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/object_counting.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/object_counting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9ee7720332c6b67048f1545c3f97adce06d2be2e --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/object_counting.yaml @@ -0,0 +1,17 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_object_counting" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.NumberParseRegexFilter + group_select: -1 + regex_pattern: "([-0-9]+)" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/reasoning_about_colored_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/reasoning_about_colored_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f9b3e1c92a47603c825d54242903a45d13ebcd9 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/reasoning_about_colored_objects.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_reasoning_about_colored_objects" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/ruin_names.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/ruin_names.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cf865e89a6e8ea5b6d6d691cae600401d495bc82 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/ruin_names.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_ruin_names" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/salient_translation_error_detection.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/salient_translation_error_detection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d7d72eadc3bbd2c026c9a62dc237f90c725dacf7 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/salient_translation_error_detection.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_salient_translation_error_detection" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/sports_understanding.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/sports_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1046bfe81928a4f09bddadd03a9062704c5dc357 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/sports_understanding.yaml @@ -0,0 +1,21 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_sports_understanding" + +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MapRegexFilter + group_select: -1 + ignore_case: true + regex_pattern_to_value: + \b(no|not plausible)\b: "no" + \b(yes|plausible)\b: "yes" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/temporal_sequences.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/temporal_sequences.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c7b949ada5ad2a8293869ed3c29fff9b419e0870 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/temporal_sequences.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_temporal_sequences" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_five_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_five_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..589253017ff284a00cda4261d085557d3b97068f --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_five_objects.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_tracking_shuffled_objects_five_objects" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_seven_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_seven_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4635d7cabaa250aa1c255c8d9d80cf8f8c87e9b6 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_seven_objects.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_tracking_shuffled_objects_seven_objects" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_three_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_three_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1edf0c0537c71510cf781ae1acbab9829eeed883 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/tracking_shuffled_objects_three_objects.yaml @@ -0,0 +1,19 @@ +"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: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_tracking_shuffled_objects_three_objects" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MultiChoiceRegexFilter + group_select: -1 + ignore_case: true + ignore_punctuation: true + regex_pattern: "(\\([A-Z]\\))" + - function: "take_first" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/utils.py b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a3c63df468de9edb7f6c04e31c17db5af9b92be3 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_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/lm_eval/tasks/bbh/cot_zeroshot/web_of_lies.yaml b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/web_of_lies.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a3227304a29461497f6c9acd08965dda481b95f5 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/cot_zeroshot/web_of_lies.yaml @@ -0,0 +1,20 @@ +"dataset_name": "web_of_lies" +"description": "Evaluate a random boolean function expressed as a word problem.\n\n" +"doc_to_text": "Q: {{input}}\nA: Let's think step by step." +"include": "_cot_zeroshot_template_yaml" +"task": "bbh_cot_zeroshot_web_of_lies" +filter_list: + - name: "flexible-extract" + filter: + - function: !function utils.MapRegexFilter + group_select: -1 + 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" + - name: "strict-match" + filter: + - function: "regex" + regex_pattern: "((?<=The answer is )(.*)(?=.)|(?<=the answer is )(.*)(?=.)|(?<=The answer: )(.*)(?=.)|(?<=The final answer: )(.*)(?=.))" + - function: "take_first" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/_fewshot_template_yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/_fewshot_template_yaml new file mode 100644 index 0000000000000000000000000000000000000000..f84641eee2067897811f70116c07c570cc072e22 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/_fewshot_template_yaml @@ -0,0 +1,22 @@ +group: bbh_fewshot +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 +generation_kwargs: + until: + - "" + - "Q" + - "\n\n" + do_sample: false + temperature: 0.0 +num_fewshot: 0 +metadata: + version: 1.0 + num_fewshot: 3 # will be printed in results table diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/boolean_expressions.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/boolean_expressions.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bffe8dd7d2b9545fade396f8a6b531a97875aa26 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/boolean_expressions.yaml @@ -0,0 +1,5 @@ +"dataset_name": "boolean_expressions" +"description": "Evaluate the result of a random Boolean expression.\n\n" +"doc_to_text": "Q: not ( ( not not True ) ) is\nA: False\n\nQ: True and False and not True and True is\nA: False\n\nQ: not not ( not ( False ) ) is\nA: True\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_boolean_expressions" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/causal_judgement.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/causal_judgement.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7c8667b59ce4b903ce1e14cd61a95d80f9125026 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/causal_judgement.yaml @@ -0,0 +1,5 @@ +"dataset_name": "causal_judgement" +"description": "Answer questions about causal attribution.\n\n" +"doc_to_text": "Q: How would a typical person answer each of the following questions about causation?\nFrank T., had an ongoing dispute with his neighbor over a stretch of land and one day decided to shoot his neighbor in the body. Frank T. had no experience with guns, his hand slipped on the barrel of the gun, and the shot went wild. Nonetheless, the bullet bounced off a large boulder several feet away and hit the neighbor's body, causing significant injury. Did Frank T. intentionally shoot his neighbor in the body?\nOptions:\n- Yes\n- No\nA: No\n\nQ: How would a typical person answer each of the following questions about causation?\nSuzy and Billy are working on a project that is very important for our nation's security. The boss tells them both: \"Be sure that you are here at exactly 9 am. It is absolutely essential that you arrive at that time.\" Both Billy and Suzy arrive at 9 am. As it happens, there was a motion detector installed in the room where they arrived. The motion detector was set up to be triggered if at least one person appeared in the room at the same time. So the motion detector went off. Did Billy cause the motion detector to go off?\nOptions:\n- Yes\n- No\nA: Yes\n\nQ: How would a typical person answer each of the following questions about causation?\nGeorge and his sister Lena reunite at their parents' house for Thanksgiving. Whereas George just got into medical school, Lena is unhappy in her marriage and recently lost her job. Over the course of the day, George and Lena get into a number of heated arguments. Later in the afternoon they play a game of darts. They split the first two games, and the third game is close until the end. Who will win comes down to George's last shot. If he hits a high point region, he wins; if he hits a low point region, Lena wins. George thinks of the difficult time Lena is having, and he really wants to let her win. He aims the dart at the low point region. He sets up his shot and the dart lands in the low point region. After his shot, Lena wins the game and is very happy. Did George hit the low point region intentionally?\nOptions:\n- Yes\n- No\nA: Yes\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_causal_judgement" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/date_understanding.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/date_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..18c264b08595b818809fa76b61acbf78af55b4c1 --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/disambiguation_qa.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/disambiguation_qa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ee0e659087e8c1968db6616f3f8492b96779e093 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/disambiguation_qa.yaml @@ -0,0 +1,5 @@ +"dataset_name": "disambiguation_qa" +"description": "Clarify the meaning of sentences with ambiguous pronouns.\n\n" +"doc_to_text": "Q: In the following sentences, explain the antecedent of the pronoun (which thing the pronoun refers to), or state that it is ambiguous.\nSentence: The chief told the counselor that they took the day off.\nOptions:\n(A) The chief took the day off\n(B) The counselor took the day off\n(C) Ambiguous\nA: (A)\n\nQ: In the following sentences, explain the antecedent of the pronoun (which thing the pronoun refers to), or state that it is ambiguous.\nSentence: The manager sent a message to the secretary, but he didn't reply yet.\nOptions:\n(A) The secretary didn't reply yet\n(B) The manager didn't reply yet\n(C) Ambiguous\nA: (A)\n\nQ: In the following sentences, explain the antecedent of the pronoun (which thing the pronoun refers to), or state that it is ambiguous.\nSentence: Bailey will plan to meet the director at his office\nOptions:\n(A) It will be Bailey's office\n(B) It will be the director's office\n(C) Ambiguous\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_disambiguation_qa" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/dyck_languages.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/dyck_languages.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ebe6d99fc330d9f0c6fea3730d324efd09fd257a --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/dyck_languages.yaml @@ -0,0 +1,5 @@ +"dataset_name": "dyck_languages" +"description": "Correctly close a Dyck-n word.\n\n" +"doc_to_text": "Q: Complete the rest of the sequence, making sure that the parentheses are closed properly. Input: [ { [\nA: ] } ]\n\nQ: Complete the rest of the sequence, making sure that the parentheses are closed properly. Input: < > ( ( [ [ ( { } ) [ < > ] ]\nA: ] ) )\n\nQ: Complete the rest of the sequence, making sure that the parentheses are closed properly. Input: < [ < [ { < [ ] < { } > > } ] > { { ( ) } { < [ < > ] > }\nA: } ] >\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_dyck_languages" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/formal_fallacies.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/formal_fallacies.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b9fef1780671d4db0e215cdede2bbfb62d719d7f --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/formal_fallacies.yaml @@ -0,0 +1,5 @@ +"dataset_name": "formal_fallacies" +"description": "Distinguish deductively valid arguments from formal fallacies.\n\n" +"doc_to_text": "Q: \"It is not always easy to see who is related to whom -- and in which ways. The following argument pertains to this question: To begin with, Lesley is a close friend of Fernando. Moreover, being a close friend of Fernando or a schoolmate of Lowell is sufficient for being a great-grandfather of Leroy. It follows that Lesley is a great-grandfather of Leroy.\"\nIs the argument, given the explicitly stated premises, deductively valid or invalid?\nOptions:\n- valid\n- invalid\nA: valid\n\nQ: \"It is not always easy to see who is related to whom -- and in which ways. The following argument pertains to this question: Whoever is not a great-grandfather of Clyde is a stepbrother of Brian. Being an ancestor of Dana is sufficient for not being a great-grandfather of Clyde. We may conclude: Everyone who is an ancestor of Dana is a stepbrother of Brian, too.\"\nIs the argument, given the explicitly stated premises, deductively valid or invalid?\nOptions:\n- valid\n- invalid\nA: valid\n\nQ: \"It is not always easy to grasp who is consuming which products. The following argument pertains to this question: Every infrequent user of Paul Mitchell shampoo is either a rare consumer of Nioxin shampoo or a loyal buyer of Caress soap, or both. No regular consumer of Lush soap is a rare consumer of Nioxin shampoo and, in the same time, a loyal buyer of Caress soap. It follows that whoever is an infrequent user of Paul Mitchell shampoo is not a regular consumer of Lush soap.\"\nIs the argument, given the explicitly stated premises, deductively valid or invalid?\nOptions:\n- valid\n- invalid\nA: invalid\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_formal_fallacies" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/geometric_shapes.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/geometric_shapes.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eeda74188d3e000ead5adcee9c5dcb1aa42e673b --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/hyperbaton.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/hyperbaton.yaml new file mode 100644 index 0000000000000000000000000000000000000000..82ee19ae1f34a619cc4cb1f29eb67fe84afa20f7 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/hyperbaton.yaml @@ -0,0 +1,5 @@ +"dataset_name": "hyperbaton" +"description": "Order adjectives correctly in English sentences.\n\n" +"doc_to_text": "Q: Which sentence has the correct adjective order:\nOptions:\n(A) rubber terrible ship\n(B) terrible rubber ship\nA: (B)\n\nQ: Which sentence has the correct adjective order:\nOptions:\n(A) repulsive small Brazilian exercise ship\n(B) Brazilian repulsive exercise small ship\nA: (A)\n\nQ: Which sentence has the correct adjective order:\nOptions:\n(A) blue gold wonderful square shoe\n(B) wonderful square blue gold shoe\nA: (B)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_hyperbaton" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_five_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_five_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4e64c77af5dd6a9dd11dfbec32e1badcebb6d3df --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_five_objects.yaml @@ -0,0 +1,5 @@ +"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: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. In a golf tournament, there were three golfers: Amy, Eli, and Eve. Eve finished above Amy. Eli finished below Amy.\nOptions:\n(A) Amy finished last\n(B) Eli finished last\n(C) Eve finished last\nA: (B)\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a white book, a green book, and an orange book. The green book is to the right of the white book. The orange book is the rightmost.\nOptions:\n(A) The white book is the leftmost\n(B) The green book is the leftmost\n(C) The orange book is the leftmost\nA: (A)\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a red book, a gray book, and a white book. The white book is to the left of the gray book. The red book is the second from the left.\nOptions:\n(A) The red book is the leftmost\n(B) The gray book is the leftmost\n(C) The white book is the leftmost\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_logical_deduction_five_objects" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_seven_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_seven_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..35a8ed14ae56480f5ea536400a96fff26592fcfc --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_seven_objects.yaml @@ -0,0 +1,5 @@ +"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: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. In a golf tournament, there were three golfers: Amy, Eli, and Eve. Eve finished above Amy. Eli finished below Amy.\nOptions:\n(A) Amy finished last\n(B) Eli finished last\n(C) Eve finished last\nA: (B)\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a white book, a green book, and an orange book. The green book is to the right of the white book. The orange book is the rightmost.\nOptions:\n(A) The white book is the leftmost\n(B) The green book is the leftmost\n(C) The orange book is the leftmost\nA: (A)\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a red book, a gray book, and a white book. The white book is to the left of the gray book. The red book is the second from the left.\nOptions:\n(A) The red book is the leftmost\n(B) The gray book is the leftmost\n(C) The white book is the leftmost\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_logical_deduction_seven_objects" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_three_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_three_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..de945dd99a1e7971f8722d0ae30f55fc543a6786 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/logical_deduction_three_objects.yaml @@ -0,0 +1,5 @@ +"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: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. In a golf tournament, there were three golfers: Amy, Eli, and Eve. Eve finished above Amy. Eli finished below Amy.\nOptions:\n(A) Amy finished last\n(B) Eli finished last\n(C) Eve finished last\nA: (B)\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a white book, a green book, and an orange book. The green book is to the right of the white book. The orange book is the rightmost.\nOptions:\n(A) The white book is the leftmost\n(B) The green book is the leftmost\n(C) The orange book is the leftmost\nA: (A)\n\nQ: The following paragraphs each describe a set of three objects arranged in a fixed order. The statements are logically consistent within each paragraph. On a shelf, there are three books: a red book, a gray book, and a white book. The white book is to the left of the gray book. The red book is the second from the left.\nOptions:\n(A) The red book is the leftmost\n(B) The gray book is the leftmost\n(C) The white book is the leftmost\nA: (C)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_logical_deduction_three_objects" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/movie_recommendation.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/movie_recommendation.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7621a383fbefd641192d210ef1c332c695a965ab --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/multistep_arithmetic_two.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/multistep_arithmetic_two.yaml new file mode 100644 index 0000000000000000000000000000000000000000..731da3fea1c9bee7f1c3064a8dc304bd5a1083ed --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/multistep_arithmetic_two.yaml @@ -0,0 +1,5 @@ +"dataset_name": "multistep_arithmetic_two" +"description": "Solve multi-step arithmetic problems.\n\n" +"doc_to_text": "Q: ((-5 + 9 * -4 - 0) * (4 + -7 + 0 * -5)) =\nA: 123\n\nQ: ((-9 * 7 * 7 * -9) + (4 * -9 - 8 - -4)) =\nA: 3929\n\nQ: ((-3 + 5 * 8 * -4) - (9 - 8 * -7 + -9)) =\nA: -219\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_multistep_arithmetic_two" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/navigate.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/navigate.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ee654f39dc5fc27ffb3fd01f449862261ed4c7e9 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/navigate.yaml @@ -0,0 +1,5 @@ +"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: If you follow these instructions, do you return to the starting point? Turn left. Turn around. Turn left. Take 7 steps. Take 2 steps. Take 4 steps. Take 8 steps.\nOptions:\n- Yes\n- No\nA: No\n\nQ: If you follow these instructions, do you return to the starting point? Turn around. Take 1 step. Take 6 steps. Turn around. Take 6 steps. Take 9 steps. Take 1 step.\nOptions:\n- Yes\n- No\nA: No\n\nQ: If you follow these instructions, do you return to the starting point? Always face forward. Take 2 steps right. Take 9 steps left. Take 7 steps right.\nOptions:\n- Yes\n- No\nA: Yes\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_navigate" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/object_counting.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/object_counting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e015ff065c5c5d2a847d4c6a9d531bc156edecab --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/object_counting.yaml @@ -0,0 +1,5 @@ +"dataset_name": "object_counting" +"description": "Questions that involve enumerating objects and asking the model to count them.\n\n" +"doc_to_text": "Q: I have a blackberry, a clarinet, a nectarine, a plum, a strawberry, a banana, a flute, an orange, and a violin. How many fruits do I have?\nA: 6\n\nQ: I have an orange, a raspberry, two peaches, a blackberry, an apple, a grape, a nectarine, and three plums. How many fruits do I have?\nA: 11\n\nQ: I have a lettuce head, a head of broccoli, an onion, a stalk of celery, two carrots, a garlic, and a yam. How many vegetables do I have?\nA: 8\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_object_counting" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/penguins_in_a_table.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/penguins_in_a_table.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fb093640b2d214315fc24753006f5a220205cd0c --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/penguins_in_a_table.yaml @@ -0,0 +1,5 @@ +"dataset_name": "penguins_in_a_table" +"description": "Answer questions about a table of penguins and their attributes.\n\n" +"doc_to_text": "Q: Here is a table where the first line is a header and each subsequent line is a penguin: name, age, height (cm), weight (kg) Louis, 7, 50, 11 Bernard, 5, 80, 13 Vincent, 9, 60, 11 Gwen, 8, 70, 15 For example: the age of Louis is 7, the weight of Gwen is 15 kg, the height of Bernard is 80 cm. We now add a penguin to the table:\nJames, 12, 90, 12\nHow many penguins are less than 8 years old?\nOptions:\n(A) 1\n(B) 2\n(C) 3\n(D) 4\n(E) 5\nA: (B)\n\nQ: Here is a table where the first line is a header and each subsequent line is a penguin: name, age, height (cm), weight (kg) Louis, 7, 50, 11 Bernard, 5, 80, 13 Vincent, 9, 60, 11 Gwen, 8, 70, 15 For example: the age of Louis is 7, the weight of Gwen is 15 kg, the height of Bernard is 80 cm. Which is the youngest penguin?\nOptions:\n(A) Louis\n(B) Bernard\n(C) Vincent\n(D) Gwen\n(E) James\nA: (B)\n\nQ: Here is a table where the first line is a header and each subsequent line is a penguin: name, age, height (cm), weight (kg) Louis, 7, 50, 11 Bernard, 5, 80, 13 Vincent, 9, 60, 11 Gwen, 8, 70, 15 For example: the age of Louis is 7, the weight of Gwen is 15 kg, the height of Bernard is 80 cm. What is the name of the second penguin sorted by alphabetic order?\nOptions:\n(A) Louis\n(B) Bernard\n(C) Vincent\n(D) Gwen\n(E) James\nA: (D)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_penguins_in_a_table" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/reasoning_about_colored_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/reasoning_about_colored_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d0f47e7b40a8147ffa597cc8852eb40920bd95aa --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/reasoning_about_colored_objects.yaml @@ -0,0 +1,5 @@ +"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: On the nightstand, there is a red pencil, a purple mug, a burgundy keychain, a fuchsia teddy bear, a black plate, and a blue stress ball. What color is the stress ball?\nOptions:\n(A) red\n(B) orange\n(C) yellow\n(D) green\n(E) blue\n(F) brown\n(G) magenta\n(H) fuchsia\n(I) mauve\n(J) teal\n(K) turquoise\n(L) burgundy\n(M) silver\n(N) gold\n(O) black\n(P) grey\n(Q) purple\n(R) pink\nA: (E)\n\nQ: On the table, you see a bunch of objects arranged in a row: a purple paperclip, a pink stress ball, a brown keychain, a green scrunchiephone charger, a mauve fidget spinner, and a burgundy pen. What is the color of the object directly to the right of the stress ball?\nOptions:\n(A) red\n(B) orange\n(C) yellow\n(D) green\n(E) blue\n(F) brown\n(G) magenta\n(H) fuchsia\n(I) mauve\n(J) teal\n(K) turquoise\n(L) burgundy\n(M) silver\n(N) gold\n(O) black\n(P) grey\n(Q) purple\n(R) pink\nA: (F)\n\nQ: On the nightstand, you see the following items arranged in a row: a teal plate, a burgundy keychain, a yellow scrunchiephone charger, an orange mug, a pink notebook, and a grey cup. How many non-orange items do you see to the left of the teal item?\nOptions:\n(A) zero\n(B) one\n(C) two\n(D) three\n(E) four\n(F) five\n(G) six\nA: (A)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_reasoning_about_colored_objects" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/ruin_names.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/ruin_names.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2843a685acb31b06258dd1818147600e9ed0a314 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/ruin_names.yaml @@ -0,0 +1,5 @@ +"dataset_name": "ruin_names" +"description": "Select the humorous edit that 'ruins' the input movie or musical artist name.\n\n" +"doc_to_text": "Q: Which of the following is a humorous edit of this artist or movie name: 'whitesnake'?\nOptions:\n(A) whitesnape\n(B) whitesnapke\n(C) whitesnuake\n(D) mwhitesnake\nA: (A)\n\nQ: Which of the following is a humorous edit of this artist or movie name: 'one of our dinosaurs is missing'?\nOptions:\n(A) ofne of our dinosaurs is missing\n(B) one af our dinosaurs is missing\n(C) one of our dinosaurs is pissing\n(D) one of our dinosaur is missing\nA: (C)\n\nQ: Which of the following is a humorous edit of this artist or movie name: 'counting crows'?\nOptions:\n(A) countingy crows\n(B) counting cows\n(C) courting crows\n(D) coutnting crows\nA: (B)\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_ruin_names" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/salient_translation_error_detection.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/salient_translation_error_detection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..51640dfe3759f4d02d3836a92293b9c2a204e262 --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/snarks.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/snarks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1dbc1ca2768067fa3f44fd8727c1f5b811926584 --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/sports_understanding.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/sports_understanding.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7c88b5d66ca591a1e9adba16c582d1849af2b5d5 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/sports_understanding.yaml @@ -0,0 +1,5 @@ +"dataset_name": "sports_understanding" +"description": "Determine whether an artificially constructed sentence relating to sports is plausible or not.\n\n" +"doc_to_text": "Q: Is the following sentence plausible? \"Bam Adebayo scored a reverse layup in the Western Conference Finals.\"\nA: yes\n\nQ: Is the following sentence plausible? \"Santi Cazorla scored a touchdown.\"\nA: no\n\nQ: Is the following sentence plausible? \"DeMar DeRozan was called for the goal tend.\"\nA: yes\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_sports_understanding" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/temporal_sequences.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/temporal_sequences.yaml new file mode 100644 index 0000000000000000000000000000000000000000..920631ba6403db50981e59c620b832700352ad4f --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_five_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_five_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a5953369f137ebc04c7d741677c4ce97a0247ad9 --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_seven_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_seven_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c9b3767a0c90aca5ca215793f961c93d9587885f --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_seven_objects.yaml @@ -0,0 +1,5 @@ +"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: 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_seven_objects" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_three_objects.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/tracking_shuffled_objects_three_objects.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fb942582f247bfd59e42ab63b8eca80b9842269b --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/bbh/fewshot/web_of_lies.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/web_of_lies.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3305c61fbe4a28af1ad304618212077da2d2ac8e --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/bbh/fewshot/web_of_lies.yaml @@ -0,0 +1,5 @@ +"dataset_name": "web_of_lies" +"description": "Evaluate a random boolean function expressed as a word problem.\n\n" +"doc_to_text": "Q: Question: Fidel tells the truth. Jerry says Fidel tells the truth. Vina says Jerry tells the truth. Millicent says Vina lies. Raymond says Millicent lies. Does Raymond tell the truth?\nA: Yes\n\nQ: Question: Kristian lies. Millie says Kristian lies. Maybelle says Millie tells the truth. Fidel says Maybelle lies. Leda says Fidel lies. Does Leda tell the truth?\nA: Yes\n\nQ: Question: Kristian tells the truth. Michaela says Kristian lies. Raymond says Michaela tells the truth. Osvaldo says Raymond tells the truth. Jamey says Osvaldo tells the truth. Does Jamey tell the truth?\nA: No\n\nQ: {{input}}\nA:" +"include": "_fewshot_template_yaml" +"task": "bbh_fewshot_web_of_lies" diff --git a/lm-evaluation/lm_eval/tasks/bbh/fewshot/word_sorting.yaml b/lm-evaluation/lm_eval/tasks/bbh/fewshot/word_sorting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f2840db1e39fdedeee407a90b99bf073fcec7a4 --- /dev/null +++ b/lm-evaluation/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/lm_eval/tasks/okapi/arc_multilingual/arc_da.yaml b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_da.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7209f8cbc047e67f6f175c683743467b4f28275c --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_da.yaml @@ -0,0 +1,7 @@ +include: _arc_yaml +task: arc_da +dataset_path: alexandrainst/m_arc +dataset_name: da +training_split: train +validation_split: validation +test_split: test diff --git a/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_pt.yaml b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_pt.yaml new file mode 100644 index 0000000000000000000000000000000000000000..78c75932201786eda593026bcc2538c4aecd5911 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_pt.yaml @@ -0,0 +1,7 @@ +include: _arc_yaml +task: arc_pt +dataset_path: alexandrainst/m_arc +dataset_name: pt +training_split: train +validation_split: validation +test_split: test diff --git a/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_ru.yaml b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_ru.yaml new file mode 100644 index 0000000000000000000000000000000000000000..157f886e2a7a7d50bf53faf2274f6cf3c79bbf31 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_ru.yaml @@ -0,0 +1,7 @@ +include: _arc_yaml +task: arc_ru +dataset_path: alexandrainst/m_arc +dataset_name: ru +training_split: train +validation_split: validation +test_split: test diff --git a/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_sr.yaml b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_sr.yaml new file mode 100644 index 0000000000000000000000000000000000000000..aacfc06dd672e044d9bd06b4afcde654b8816439 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_sr.yaml @@ -0,0 +1,7 @@ +include: _arc_yaml +task: arc_sr +dataset_path: alexandrainst/m_arc +dataset_name: sr +training_split: train +validation_split: validation +test_split: test diff --git a/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_te.yaml b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_te.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2ee32742aabdb8b810669bcac2fa07f95a8c21e3 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_te.yaml @@ -0,0 +1,7 @@ +include: _arc_yaml +task: arc_te +dataset_path: alexandrainst/m_arc +dataset_name: te +training_split: train +validation_split: validation +test_split: test diff --git a/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_vi.yaml b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_vi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bdcccb341935772fcefb4e1c644ce7f52dd6e061 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/arc_multilingual/arc_vi.yaml @@ -0,0 +1,7 @@ +include: _arc_yaml +task: arc_vi +dataset_path: alexandrainst/m_arc +dataset_name: vi +training_split: train +validation_split: validation +test_split: test diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/README.md b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/README.md new file mode 100644 index 0000000000000000000000000000000000000000..324cdce592b9da5bce7f9001f735af8a4c6c9f66 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/README.md @@ -0,0 +1,47 @@ +# Multilingual TruthfulQA + +### Paper + +Title: `Okapi: Instruction-tuned Large Language Models in Multiple Languages with Reinforcement Learning from Human Feedback` + +Abstract: https://arxiv.org/abs/2307.16039 + +A key technology for the development of large language models (LLMs) involves instruction tuning that helps align the models' responses with human expectations to realize impressive learning abilities. Two major approaches for instruction tuning characterize supervised fine-tuning (SFT) and reinforcement learning from human feedback (RLHF), which are currently applied to produce the best commercial LLMs (e.g., ChatGPT). To improve the accessibility of LLMs for research and development efforts, various instruction-tuned open-source LLMs have also been introduced recently, e.g., Alpaca, Vicuna, to name a few. However, existing open-source LLMs have only been instruction-tuned for English and a few popular languages, thus hindering their impacts and accessibility to many other languages in the world. Among a few very recent work to explore instruction tuning for LLMs in multiple languages, SFT has been used as the only approach to instruction-tune LLMs for multiple languages. This has left a significant gap for fine-tuned LLMs based on RLHF in diverse languages and raised important questions on how RLHF can boost the performance of multilingual instruction tuning. To overcome this issue, we present Okapi, the first system with instruction-tuned LLMs based on RLHF for multiple languages. Okapi introduces instruction and response-ranked data in 26 diverse languages to facilitate the experiments and development of future multilingual LLM research. We also present benchmark datasets to enable the evaluation of generative LLMs in multiple languages. Our experiments demonstrate the advantages of RLHF for multilingual instruction over SFT for different base models and datasets. Our framework and resources are released at this https URL. + +Homepage: `https://github.com/nlp-uoregon/Okapi` + + +### Citation + +``` +@article{dac2023okapi, + title={Okapi: Instruction-tuned Large Language Models in Multiple Languages with Reinforcement Learning from Human Feedback}, + author={Dac Lai, Viet and Van Nguyen, Chien and Ngo, Nghia Trung and Nguyen, Thuat and Dernoncourt, Franck and Rossi, Ryan A and Nguyen, Thien Huu}, + journal={arXiv e-prints}, + pages={arXiv--2307}, + year={2023} +} +``` + +### Groups and Tasks + +#### Groups + +- truthfulqa_multilingual + +#### Tasks + +- `truthfulqa_{ar,bn,ca,da,de,es,eu,fr,gu,hi,hr,hu,hy,id,it,kn,ml,mr,ne,nl,pt,ro,ru,sk,sr,sv,ta,te,uk,vi,zh}` + +### 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: +* [ ] 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/lm_eval/tasks/okapi/truthfulqa_multilingual/_truthfulqa_mc1_yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/_truthfulqa_mc1_yaml new file mode 100644 index 0000000000000000000000000000000000000000..672b6088b8843902ffc7a07c6aa4890fc499c94d --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/_truthfulqa_mc1_yaml @@ -0,0 +1,20 @@ +group: + - truthfulqa_multilingual +dataset_path: null +dataset_name: null +output_type: multiple_choice +training_split: null +validation_split: val +test_split: null +process_docs: !function utils.process_docs +doc_to_text: "query" +doc_to_target: 0 +doc_to_choice: "mc1_choices" +should_decontaminate: True +doc_to_decontamination_query: "question" +metric_list: + - metric: acc + aggregation: mean + higher_is_better: true +metadata: + version: 1.0 diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/_truthfulqa_mc2_yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/_truthfulqa_mc2_yaml new file mode 100644 index 0000000000000000000000000000000000000000..7c21ca1563968646cd024b66557fdcac083c44be --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/_truthfulqa_mc2_yaml @@ -0,0 +1,12 @@ +include: _truthfulqa_mc1_yaml +doc_to_target: 0 +doc_to_choice: "mc2_choices" +process_results: !function utils.process_results_mc2 +should_decontaminate: True +doc_to_decontamination_query: "question" +metric_list: + - metric: acc + aggregation: mean + higher_is_better: true +metadata: + version: 1.0 diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_fr_mc2.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_fr_mc2.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b2ab62b624174126a1bb45092c3dde1d5679384e --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_fr_mc2.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc2_yaml +task: truthfulqa_fr_mc2 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: fr +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hi_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hi_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b69f0b868693f95f5142d14d0a8e4e6aeaa93424 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hi_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_hi_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: hi +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hi_mc2.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hi_mc2.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c74eb2422b77ae78feefaaf2293909eca5798ebb --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hi_mc2.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc2_yaml +task: truthfulqa_hi_mc2 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: hi +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hr_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hr_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0746d53d60ab9c8107ccaa911313f09213fd53a6 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_hr_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_hr_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: hr +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_kn_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_kn_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6bf025d5af7a5662c9cad7506170f8c4daad4c62 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_kn_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_kn_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: kn +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_ml_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_ml_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7b91651c09664f14b273c25cb15eb59c95f204ce --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_ml_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_ml_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: ml +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_ru_mc2.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_ru_mc2.yaml new file mode 100644 index 0000000000000000000000000000000000000000..aa6296d4abfdc1ac46bda674d3a8bbf119f9ec7f --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_ru_mc2.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc2_yaml +task: truthfulqa_ru_mc2 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: ru +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sk_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sk_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..53038c21b6ec8351a67ef17dc28338cea228f4c2 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sk_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_sk_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: sk +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sk_mc2.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sk_mc2.yaml new file mode 100644 index 0000000000000000000000000000000000000000..73c5269f11a11106a5966c82151cec79e45f9748 --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sk_mc2.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc2_yaml +task: truthfulqa_sk_mc2 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: sk +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sv_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sv_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7a853090021ebfc0ce9722907c4ac6cf1f9f862a --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_sv_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_sv_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: sv +training_split: null +validation_split: val +test_split: null diff --git a/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_uk_mc1.yaml b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_uk_mc1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5419025361e42d291ea93f058e7390aa9edfdd5e --- /dev/null +++ b/lm-evaluation/lm_eval/tasks/okapi/truthfulqa_multilingual/truthfulqa_uk_mc1.yaml @@ -0,0 +1,7 @@ +include: _truthfulqa_mc1_yaml +task: truthfulqa_uk_mc1 +dataset_path: alexandrainst/m_truthfulqa +dataset_name: uk +training_split: null +validation_split: val +test_split: null