Fix asdiv prompt truncating multi-character gold answers#1298
Open
vineethsaivs wants to merge 1 commit into
Open
Fix asdiv prompt truncating multi-character gold answers#1298vineethsaivs wants to merge 1 commit into
vineethsaivs wants to merge 1 commit into
Conversation
asdiv_prompt set choices to a bare string (line["answer"].split(" (")[0])
rather than a list. Doc.choices is a list[str] and Doc.get_golds() indexes
it with the gold index, so a bare string was indexed by character: gold
"35" became "3", "128" became "1". ASDiv answers are typically
multi-character (multi-digit numbers, decimals), so exact_match scored
correct model outputs as wrong. Every sibling generative task wraps the
value in a list; asdiv was the only one that did not.
Wrap the extracted answer in a list so the full gold answer is preserved.
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.
Problem
asdiv_promptsetschoicesto a bare string instead of a list:Doc.choicesis alist[str], andDoc.get_golds()indexes it with the gold index:When
choicesis the string"35",choices[0]indexes the string and yields"3", so the gold answer is silently truncated to its first character. ASDiv answers have the form"<value> (<unit>)"(which is why the.split(" (")[0]is there), so the extracted value is usually multi-character:get_golds()feeds the reference into the task'sexact_matchmetric, so a model that correctly outputs35is scored against gold3and marked wrong. Every sibling generative task wraps the value in a list (unscramble,numeracy,arithmetic, ...);asdivis the only one missing the brackets.Fix
Wrap the extracted answer in a list, matching the sibling tasks and the
Doc.choices: list[str]contract:Test
Adds
tests/unit/tasks/test_asdiv.py, which callsasdiv_prompton a multi-character answer and assertsdoc.choices == ["35"]anddoc.get_golds() == ["35"]. It fails before (get_golds()returns["3"]) and passes after.