[Fix] Extract the final answer in GPQA simple-eval predictions#2496
Open
Hibbert133 wants to merge 2 commits into
Open
[Fix] Extract the final answer in GPQA simple-eval predictions#2496Hibbert133 wants to merge 2 commits into
Hibbert133 wants to merge 2 commits into
Conversation
added 2 commits
June 27, 2026 23:02
Collaborator
|
@Hibbert133 You can configure your inference model like this: dict( OpenCompass will call the model’s pred_postprocessor before calling the dataset’s pred_postprocessor. Therefore, before the result enters GPQA_Simple_Eval_postprocess, extract_non_reasoning_content |
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.
[Fix] Extract the final answer in GPQA simple-eval predictions
Motivation
GPQA simple-eval prompts require the model to place the final answer on the last line in the form
ANSWER: <LETTER>. In practice, some model outputs contain multipleANSWER:tokens because the model reasons aloud, drafts an intermediate guess, and then self-corrects. The previous postprocessor used the first regex match, so it could pick an earlier intermediate answer instead of the final one and undercount accuracy.Modification
GPQA_Simple_Eval_postprocessto collect allANSWER: [A-D]matches and return the last match.ANSWER:A-DBC-breaking (Optional)
No backward-compatible API break is introduced. This is a behavior fix in post-processing for GPQA simple-eval predictions.
Use cases (Optional)
This affects GPQA simple-eval evaluation, especially for model responses that include:
ANSWER:tokensTechnical Analysis
The bug comes from the mismatch between the prompt contract and the extraction strategy:
re.search, which stops at the first match.ANSWER:tokens, the first one is often an intermediate guess, not the final answer.The fix uses
re.findall(...)[-1], which preserves the existing regex constraint while selecting the last valid answer token. This makes the evaluator align with the prompt semantics and avoids false negatives caused by intermediate self-corrections.Test Plan
python tests/datasets/test_gpqa.pypython -m unittest tests.datasets.test_gpqaChecklist
Before PR:
After PR: