fix(reward): widen multiple-choice alphabet to A-J so MMLU-Pro E-J grades (#116)#239
fix(reward): widen multiple-choice alphabet to A-J so MMLU-Pro E-J grades (#116)#239minion1227 wants to merge 2 commits into
Conversation
…ades (mini-router#116) RLPR routes MMLU-Pro (`MMLUPro-1000_Avg2`) to the choice grader, but that path was hard-capped at A-D while MMLU-Pro has up to ten options. Every item whose gold answer is E-J scored 0.0 even when the model answered it correctly — a silently-wrong number, not a crash, that deflates the measured accuracy on that subset and distorts the per-benchmark routing signal the coordinator is trained and evaluated on. Both sides of the check were capped, so an E-J item could neither be extracted from the model output nor normalized from the reference: - the five `_CHOICE_PATTERNS` captured `([A-D])`, - `extract_choice_letter`'s last-line fallback matched `([A-D])`, - `_normalize_reference_letter` accepted only {A,B,C,D} and integer index <= 3. Introduce a single `_CHOICE_ALPHABET = "ABCDEFGHIJ"` (plus a derived character class) and drive all four sites from it, so the alphabet cannot drift again. This is safe for the genuinely 4-option benchmarks (MMLU / GPQA): their gold is always A-D, so extracting a stray higher letter still cannot match a 4-option gold — no score can flip. It only adds the ability to grade E-J. Adds tests/test_reward_choice_alphabet.py: every letter A-J grades end-to-end on RLPR MMLU-Pro (and a wrong letter still fails), extraction/normalization span A-J by letter and integer index, and guards that MMLU/GPQA are unchanged, a stray high letter cannot match a 4-option gold, and the prose article "A" is still not read as a choice. Fixes mini-router#116 Fixes mini-router#122
…-J (mini-router#116) AGENTS.md §6 requires a dated JOURNAL entry for every mistake/fix; the original commit changed reward.py and tests but skipped the lab notebook.
88958c1 to
dd7d835
Compare
CI:
|
|
Thanks @tima — I dug into the classification to make sure I'm following the right lane. #239 doesn't include a The red Quick check on convention so I stay in the right lane: are code/issue-fix PRs welcome on my |
Fixes #116
Fixes #122
(Both issues report the same root bug, independently — closing them together.)
Problem
RLPR routes MMLU-Pro (
MMLUPro-1000_Avg2) to the choice grader, but that path is hard-capped at A–D while MMLU-Pro has up to ten options (A–J). Every item whose gold answer is E–J scores 0.0 even when the model answers correctly — a silently-wrong number, not a crash. MMLU-Pro gold answers spread across all ten letters, so a large fraction of that subset is unconditionally graded 0, deflating measured accuracy and distorting the per-benchmark routing signal the coordinator is trained and evaluated on.Both sides of the check were capped, so an E–J item could neither be extracted from the output nor normalized from the reference:
_CHOICE_PATTERNScaptured([A-D])extract_choice_letter's last-line fallback matched([A-D])_normalize_reference_letteraccepted only{A,B,C,D}and integer index<= 3Fix
Introduce a single
_CHOICE_ALPHABET = "ABCDEFGHIJ"(plus a derived character class) and drive all four sites from it, so the alphabet cannot drift out of sync again.Why this is safe for the 4-option benchmarks
MMLU / GPQA gold answers are always A–D, so extracting a stray higher letter still cannot match a 4-option gold — no score can flip. Widening only adds the ability to grade E–J. Verified by explicit guards below.
Tests
Adds
tests/test_reward_choice_alphabet.py(41 cases, pure stdlib — no network/GPU/torch):extract_choice_letter/_normalize_reference_letterspan A–J, by letter and integer index (0→A, 4→E, 9→J), with out-of-range stillNoneI/J) cannot match a 4-option gold; the prose article"A"is still not read as a choiceFull root suite: 287 passed;
ruffclean on the changed lines (no new findings).