Repository navigation
Do not let an extracted expression end with an operator (bold answers) - #1477
Open
ChrystianSchutz wants to merge 1 commit into
Open
ChrystianSchutz wants to merge 1 commit into
ChrystianSchutz wants to merge 1 commit into
Conversation
In 'ANSWER: **18**' the closing bold markers were read as part of the expression '18**', which does not parse, so the score fell back to another number. Fixes huggingface#1475 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1475
expr_reallowed an expression to end with any operator, so inANSWER: **18**the closing bold markers were read as part of the expression18**. That string does not parse.math_scorer()(first_match) then scores a correct answerI, andMultilingualExtractiveMatchMetric(any_match) falls through to the last bare number in the text.This PR requires an expression to end with a digit or
). Valid expressions are unchanged:all_expr_charsis only digits,., whitespace and operators.expr_gold_metric/math_scorer)ANSWER: **18**ANSWER: **18**\n\nThis took 3 steps.ANSWER: **18**\n\nThis took 3 steps.The answer is **18**, found in 3 steps.Tests:
tests/unit/metrics/test_extractive_match.py: 11 extraction cases, including controls for(1+2),3 + 4and2^10, plus 2 Inspectmath_scorercases. 8 of the 13 fail onmainand all 13 pass with the change.test_extractive_match.py+test_normalizations.py: 250 passed.ruff checkandruff format --checkare clean.The same mechanism is reported for the Math-Verify package in huggingface/Math-Verify#76. lighteval keeps its own copy of the parser (#848).
Prepared with AI assistance (Claude). The tests above were run in a clean environment at b97a653.
🤖 Generated with Claude Code