Repository navigation
fix(officeqa): score the last <answer> tag in a response - #385
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
_extract_answer used _FINAL_RE.search, which returns the first <answer>...</answer> match. When a model drafts an answer and then revises it in the same response, OfficeQA scored the draft: a correct revision was marked wrong and a wrong revision of a correct draft was credited. hard and soft are computed from this answer, so the training reward and reported scores followed the draft. SearchQA and LiveMathematicianBench take the last match and DocVQA uses the last tag. Use findall and take the last match here as well. All five OfficeQA call sites go through _extract_answer, so the offline, custom search, Parallel and local-tool paths are covered.
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
Fixes #384.
OfficeQA scored the first
<answer>tag in a response. When a model drafted an answer and then revised it in the same message, the draft was graded: a correct revision was marked wrong, and a wrong revision of a correct draft was credited. OfficeQA now scores the last tag, as SearchQA, LiveMathematicianBench and DocVQA already do.User impact:
hardandsoftare computed from the extracted answer, so the training reward and reported OfficeQA scores followed the draft instead of the model's final answer.Proof: the regression tests fail on upstream
ccfdcdfand pass with this change.Root cause
_extract_answer()inskillopt/envs/officeqa/rollout.pyused_FINAL_RE.search(text), which returns the first match. The other tagged benchmarks take the last one: SearchQA and LiveMathematicianBench usere.findall(...)[-1], and DocVQA usesrfind("<answer>").Changes
_extract_answer()uses_FINAL_RE.findall(text)and takes the last match. The fallback to the last non-empty line when there is no tag is unchanged.rollout.pythat read the final answer go through_extract_answer(), so this one change covers every OfficeQA rollout path.tests/test_officeqa_answer_extraction.py. Two tests run the realrollout.process_one()with a fake model response, the same pattern astests/test_officeqa_parallel_search.py; the rest check_extract_answer()directly, including single tags, case, whitespace and the no-tag fallback.Reproduction
Before:
'1774' 0and'1776' 1(the draft is scored).After:
'1776' 1and'1774' 0(the revision is scored).Testing
python -m pytest tests/test_officeqa_answer_extraction.py -q: on upstreamccfdcdf, 3 failed (assert '1774' == '1776'and similar) and 4 passed; with the fix, 7 passed.python -m pytest tests/test_officeqa_answer_extraction.py tests/test_officeqa_parallel_search.py tests/test_officeqa_keenable_search.py tests/test_benchmark_task_output_paths.py -q: 84 passed.python -m pytest -q: 2105 passed, 12 skipped, 4 xfailed.python -m ruff checkandpython -m ruff format --checkon the changed files: clean.python -m mkdocs build --strict: passed.Risk and compatibility
Responses with zero or one
<answer>tag are extracted exactly as before. Only responses with several tags change, and they now match the other benchmarks. OfficeQA scores can change for runs whose target model revises its answer within one response, so results from before and after this fix are not directly comparable. No backend, config key, file format or CLI change.