Repository navigation
fix(officeqa): match equal numbers written with different trailing zeros - #461
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Conversation
normalize_answer kept decimal tokens as text, so "$1,234.00" did not match a gold answer of "1234", nor "5.20" match "5.2", "12.50%" match "12.5%" or ".5" match "0.5". OfficeQA answers are mostly figures from financial tables, so a correct answer scored 0 on both EM and F1. Write each decimal token one way after normalization: drop trailing zeros from the fraction (and the point if none remain) and use "0" for an empty or zero-padded whole part. Integers and different numbers are left as they were.
This branch has not been deployed
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.
Summary
normalize_answerkept decimal tokens as text, so$1,234.00did not match a gold answer of1234, nor5.20match5.2,12.50%match12.5%or.5match0.5. OfficeQA answers are mostly figures from financial tables, so a correct answer scored 0 on both EM and F1.Changes
skillopt/envs/officeqa/evaluator.py: new_canonical_number()writes a decimal token one way: trailing zeros in the fraction are dropped (and the point if nothing is left), and an empty or zero-padded whole part becomes0. A sign and a trailing%are kept.normalize_answerapplies it to each token as its last step.CHANGELOG.md: entry under Fixed.Tests
tests/test_officeqa_evaluator.py:$1,234.00/1234,5.20/5.2,12.50%/12.5%,.5/0.5,-.5/-0.5and1,234.50 million/1234.5now match on EM and F15.02/5.2,1234.01/1234,50/5and0.05/0.5still do not matchThe existing period, decimal-point and sign tests pass unchanged. The new matching tests fail on main and pass with the fix. Full suite: 2439 passed, 12 skipped, 4 xfailed.
ruff format --checkpasses on both files, andruff checkreports only the import-sort note that is already on main.Fixes #458