Skip to content

fix(reward): grade the final MC letter, not the first (#29)#94

Open
shin-core wants to merge 2 commits into
mini-router:mainfrom
shin-core:sn74-shin-core-choice-letter
Open

fix(reward): grade the final MC letter, not the first (#29)#94
shin-core wants to merge 2 commits into
mini-router:mainfrom
shin-core:sn74-shin-core-choice-letter

Conversation

@shin-core

@shin-core shin-core commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What changed

extract_choice_letter used pat.search() (first occurrence). When a model self-corrects, the first stated letter was graded instead of the final one. Now it takes the last occurrence of the highest-priority matching pattern.

Repro

extract_choice_letter("The answer is A.\nActually, the answer is C.")  # was 'A', now 'C'

This matches the "final answer comes last" convention already used by extract_boxed, extract_last_number, extract_code, and this function's own fallback. Pattern priority is preserved — a higher-priority earlier match still beats a lower-priority later one.

Tests

New tests/test_reward_choice.py (10 cases): self-correction, all supported phrasings, priority ordering, prose-"A" exclusion, empty input. Fails on old source, passes with fix; full reward suite (26 tests) green.

Fixes #29

🤖 Generated with Claude Code

Notes

A corresponding lab-notebook entry was added to docs/JOURNAL.md per repository protocol (AGENTS.md §6).

@github-actions github-actions Bot added miner Miner contribution PR train Training or routing changes docs Documentation changes labels Jul 9, 2026
@shin-core shin-core force-pushed the sn74-shin-core-choice-letter branch from 5be4976 to deea867 Compare July 11, 2026 14:47
@tmimmanuel tmimmanuel added the not planned This feature is not planned. label Jul 12, 2026
shin-core and others added 2 commits July 13, 2026 19:13
extract_choice_letter used pat.search() -- the FIRST occurrence -- so a
self-correcting answer ("The answer is A. Actually, the answer is C.")
was graded against A instead of C, corrupting the MMLU/GPQA reward signal.

Use the LAST occurrence of the highest-priority matching pattern, matching
the "final answer comes last" convention already used by extract_boxed /
extract_last_number / extract_code and this function's own fallback.

Fixes mini-router#29

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@shin-core shin-core force-pushed the sn74-shin-core-choice-letter branch from deea867 to 8ca605e Compare July 13, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation changes miner Miner contribution PR not planned This feature is not planned. train Training or routing changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extract_choice_letter grades the first MC letter instead of the model's final choice

2 participants