Skip to content

Conversation

@lucasresck
Copy link

Description

This pull request addresses issue #33 by fixing the regular expression used to extract answers from model outputs with MMLU.

Solution

The existing regex fails to handle cases where the "Answer: LETTER" pattern appears multiple times. This is resolved by:

  • Using re.findall: Instead of re.search, re.findall is used to find all occurrences of the answer pattern.
  • Selecting the last match: The last match from the re.findall results is taken as the correct answer.
  • Allowing overlapping matches: The regex pattern is adjusted to allow overlapping matches, using a capturing group inside a lookahead.

Find all occurrences of the regular expression pattern, then take
the last one; allow overlapping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant