fix(data_preprocess): GPQA answer preprocess() strips load-bearing brackets#155
Open
glorgao wants to merge 1 commit into
Open
fix(data_preprocess): GPQA answer preprocess() strips load-bearing brackets#155glorgao wants to merge 1 commit into
glorgao wants to merge 1 commit into
Conversation
…ackets
preprocess() in gpqa.py/gpqa_diamond.py (adopted from EleutherAI's
lm-evaluation-harness GPQA utils) runs `re.sub("\[.*?\]", "", text)` on every
answer-choice field, intended to strip citation-style "[1]"/"[title]"
markers. GPQA's answer fields are heavily organic-chemistry/physics, where
"[...]" is load-bearing: IUPAC ring-locants (spiro[4.5], bicyclo[5.3.1]),
SMILES stereocenters ([C@H]), LaTeX (\left[...\right]), or plain math
grouping. The regex silently deletes all of it.
Audited gpqa_diamond (198 rows): 12 answer choices corrupted, including one
row where all 4 choices collapsed to an identical string ("ln(2) = "),
making it unanswerable from the text alone -- and where the pipeline's own
ground-truth letter (via the same all_choices.index(correct) pattern hitting
the same collision) was also wrong as a result. Audited gpqa_main (448 rows):
19/448 answer choices have similar bracket content. In both, found zero
genuine citation markers -- every match was real content. Dropped the line.
Co-Authored-By: Claude Sonnet 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.
Problem
preprocess()indata_preprocess/stem/gpqa_diamond.pyanddata_preprocess/stem/gpqa.py(adopted from EleutherAI'slm-evaluation-harnessGPQA utils, per the code comment) runsre.sub("\[.*?\]", "", text)on every answer-choice field. It's meant to strip citation-style[1]/[title]markers, but GPQA's answer fields are heavily organic-chemistry/physics, where[...]is load-bearing content:spiro[4.5]decan-6-ol→spirodecan-6-ol[C@H]/[C@@H]deleted outright, breaking the SMILES string\left[\kappa\right]→\left_{M}(the symbol inside is lost)ln(2) = [ (T_1 - T_2) / (T1*T2)]→ln(2) =(the entire answer content)Impact (found via downstream eval-data audit)
Audited all 198
gpqa_diamondrows against the rawCorrect Answer/Incorrect Answer 1-3fields:ln(2) = [...]) had all four choices collapse to the identical string"ln(2) = "— unanswerable from the text alone. Worse, the pipeline's own ground-truth letter (all_choices.index(correct), also a by-value lookup) hit the exact same collision and silently defaulted to the wrong letter.gpqa_main(448 rows): 19 more answer choices with the same kind of content.Fix
Dropped the
re.subline in both files..replace(" [title]", ". ")(a separate, targeted substitution for a known artifact from another benchmark's raw text) is left untouched.This brings us in line with the current upstream reference these files cite:
lm_eval/tasks/gpqa/zeroshot/utils.pyno longer has there.sub("\[.*?\]", "", text)line either — itspreprocess()is exactly.strip()→.replace(" [title]", ". ")→.replace(" ", " "), i.e. what this PR changes our two files to match. The# adopted fromcomment in our files must predate that line's removal upstream.Validation
gpqa_diamondprompts from raw source columns with the fixedpreprocess(); confirmed correct restoration against the corrupted downstream eval file for all 12 affected rows (11 via direct text matching, 1 via replaying the originalrandom.shuffle(seed=42)sequence, cross-validated 100% against the 186 unaffected rows' known shuffle order and the 11 already-fixed rows' full A/B/C/D arrangement).python -m py_compileon both changed files.data_preprocesstest suite currently exists in this repo to run.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com