[Fix] Compare TydiQA answers case-insensitively - #2660
Open
MohammadHijjawi97 wants to merge 1 commit into
Open
MohammadHijjawi97 wants to merge 1 commit into
MohammadHijjawi97 wants to merge 1 commit into
Conversation
TydiQAEvaluator lowercased the prediction but not the reference answers, so any gold answer containing an uppercase letter could never reach exact match and lost F1 on every capitalized token, even when the model output matched the reference verbatim. Lowercase the references as well, matching the SQuAD normalization the evaluator is based on.
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.
Motivation
TydiQAEvaluator.scorelowercases each prediction before comparing it, but the gold answers are compared as-is, sincegeneral_postprocessdoes not lowercase. So a gold answer containing an uppercase letter can never reach exact match, and F1 drops every capitalized token, even when the model reproduces the reference verbatim:This affects all TyDiQA-GoldP languages with letter case (English, Russian, Finnish, Indonesian, Swahili, ...). The SQuAD v1.1 script this evaluator is adapted from lowercases both sides.
Modification
Lowercase the reference answers alongside the prediction in
TydiQAEvaluator.score. Addtests/datasets/test_tydiqa.py, covering exact match / F1 with capitalized references and a wrong answer.BC-breaking (Optional)
No API change. TyDiQA scores for cased languages will go up, since correct answers are no longer rejected because of case.
Use cases (Optional)
N/A
Checklist
Before PR:
After PR: