fix(bbh): support Yes/No targets (causal_judgement, web_of_lies, navigate, sports_understanding)#2
Open
nickmeinhold wants to merge 1 commit into
Open
fix(bbh): support Yes/No targets (causal_judgement, web_of_lies, navigate, sports_understanding)#2nickmeinhold wants to merge 1 commit into
nickmeinhold wants to merge 1 commit into
Conversation
The pilot harness only handled MCQ subtasks. Loading causal_judgement
crashed at _row_to_task → normalize_gold('No') because extract_choice
can't parse a Yes/No string. Several BBH subtasks have this shape:
causal_judgement, web_of_lies, navigate, sports_understanding.
Changes:
- Add extract_yes_no() with the same layered regex approach as extract_choice
- Add unified extract_answer() (Yes/No first to avoid extract_choice's "Y" in
"Yes" false-match), used by bbh_arms.lexical_agree
- format_prompt branches on whether choices is present: MCQ "Answer: X"
or boolean "Answer: Yes / Answer: No"
- normalize_gold accepts Yes/No targets, normalizing to "YES"/"NO"
- score_bbh routes by gold shape so Yes/No reasoning that happens to
mention "(A)" isn't mis-scored as MCQ
- _row_to_task handles missing 'choices' field on the row
- 9 new unit tests covering Yes/No extraction, scoring, prompt format,
and the cross-shape edge cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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.
What this fixes
Adi's BBH harness (#39b767d) only handled MCQ subtasks. Loading
causal_judgementcrashes:```
ValueError: Could not parse gold target: 'No'
at normalize_gold (bbh.py:87)
at _row_to_task (bbh.py:135)
```
Several BBH subtasks have boolean targets instead of MCQ letters:
causal_judgement,web_of_lies,navigate,sports_understanding. The dataset rows for these have nochoicesfield, justquestionandtarget("Yes" or "No"). The currentformat_promptwould also render a broken prompt for these (telling the model to answer with a letter when there are no letter choices).Changes
benchmarks/bbh.pyextract_yes_no()parallel toextract_choice(), same layered-regex shapebenchmarks/bbh.pyextract_answer()unified extractor — Yes/No first (see note below)benchmarks/bbh.pyformat_promptbranches: MCQ → "Answer: X"; Yes/No → "Answer: Yes / Answer: No"benchmarks/bbh.pynormalize_goldaccepts "Yes"/"No" targets, normalizes to "YES"/"NO"benchmarks/bbh.pyscore_bbhroutes extraction by gold shape so Yes/No reasoning that mentions "(A)" in passing isn't mis-scored as MCQbenchmarks/bbh.py_row_to_tasktolerates missingchoicesfieldbenchmarks/bbh_arms.pylexical_agreeusesextract_answerso Yes/No subtasks get the letter-equality fast pathtests/test_bbh_scoring.pyWhy Yes/No-first in
extract_answerextract_choice's "Answer: X" regex has no$anchor, so it matches the "Y" in "Answer: Yes" beforeextract_yes_nowould get a look. Puttingextract_yes_nofirst in the unified extractor short-circuits cleanly. For genuine letter answers ("Answer: B"),extract_yes_noreturns None and the call falls through toextract_choiceas before. Caught by a unit test.Test plan
```bash
cd experiment
.venv/bin/python -m unittest tests.test_bbh_scoring tests.test_bbh_arms -v # 24 tests, all green
.venv/bin/python -c "from benchmarks.bbh import load_bbh; print(len(load_bbh(['causal_judgement'], n_per_subtask=3)))" # prints 3
```
Follow-up (not in this PR)
Other BBH subtasks have shapes we still don't handle:
dyck_languages,word_sorting→ free-form sequence outputmultistep_arithmetic_two,object_counting→ numeric outputformal_fallacies→ "valid"/"invalid" (similar to Yes/No, could reuse the pattern)Worth a follow-up issue/PR to extend to numeric and free-form once the Yes/No path proves out.
🤖 Generated with Claude Code