Skip to content

feat(benchmarks): add GSM8K, HumanEval, and BBH end-to-end (#99)#115

Open
minion1227 wants to merge 3 commits into
mini-router:mainfrom
minion1227:sn74-minion1227-99
Open

feat(benchmarks): add GSM8K, HumanEval, and BBH end-to-end (#99)#115
minion1227 wants to merge 3 commits into
mini-router:mainfrom
minion1227:sn74-minion1227-99

Conversation

@minion1227

Copy link
Copy Markdown
Contributor

Fixes #99

Problem

The leaderboard schema, mock data, and web types already carry gsm8k / humaneval / bbh metric fields, but nothing in the training/eval core ever produces those scores — they are permanent nulls. This wires all three end-to-end so a miner can actually train/eval against them and see real numbers.

Approach — reuse existing grading paths, no core-checker changes

Benchmark Dataset Grading
GSM8K openai/gsm8k (main) Loader extracts the canonical #### <answer> number → graded on the existing MATH_BENCHMARKS path
HumanEval openai/openai_humaneval Loader shapes each row into the existing run_pass_at_1 assert contract ("<test>\ncheck(<entry_point>)") → no sandbox changes
BBH (27 subtasks) lukaemon/bbh New bbh checker: MCQ-letter path for "(X)" targets, else normalized exact-match → OOD suite (relevant to R5)

Changes

  • dataset.py: gsm8k/humaneval/bbh added to SUPPORTED_BENCHMARKS + _HF_LOADERS, with HF loaders (all 27 BBH subtask configs) + offline toy fallbacks, following the existing math500/mmlu/livecodebench pattern (same lazy-import guard + seeded-shuffle determinism).
  • reward.py: register gsm8k in MATH_BENCHMARKS, humaneval in CODE_BENCHMARKS, add BBH_BENCHMARKS + _check_bbh. BBH multiple-choice subtasks go up to (G) (5–7 options), so a permissive A–Z _bbh_extract_letter is used for BBH (extract_choice_letter caps at A–D) — otherwise those subtasks silently under-count.
  • benchmarks/: gsm8k.py, humaneval.py, bbh.py facades mirroring livecodebench.py.
  • configs/benchmarks.yaml: gsm8k/humaneval in-distribution (train/eval), bbh in ood.
  • tests: tests/test_benchmarks_gsm8k_humaneval_bbh.py — offline loader (toy determinism + monkeypatched HF-row parsing) and grader coverage for all three (incl. the (E)/(G) BBH cases and HumanEval correct/wrong).
  • docs: JOURNAL.md entry (AGENTS.md §6 protocol) + SPEC.md §6.6 [OUR CHOICE] note.

Scope / safety

Additive only — no changes to the coordinator/CMA-ES loop, the sandbox/executor, or the frontend. scripts/results_table.py and the validator leaderboard need no changes (both read benchmark names generically), so real gsm8k/humaneval/bbh scores flow through once an eval reports them.

Full root suite: 204 passed; ruff clean on the changed lines. All loaders verified offline via toy fallbacks; graders verified with correct/wrong cases.

@github-actions github-actions Bot added benchmark Benchmark or config changes docs Documentation changes miner Miner contribution PR train Training or routing changes labels Jul 12, 2026
@minion1227 minion1227 force-pushed the sn74-minion1227-99 branch 2 times, most recently from e79b395 to 09f49ce Compare July 12, 2026 04:46

@tmimmanuel tmimmanuel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. HumanEval is added to both train and eval, but both entries use the same only available test split. That makes the eval score non-disjoint from the optimization set and invalidates the held-out comparison. If the intent is a real eval benchmark, HumanEval should not be in train as wired here. See configs/benchmarks.yaml.

  2. BBH has a scorer, but the shared has_answer() helper does not know about bbh. That helper is used by _committed_answer() and the training format_bonus path, so BBH trajectories will never be recognized as having a valid parseable answer even when they do. Add a BBH_BENCHMARKS branch there, aligned with _bbh_extract_letter / _check_bbh. See src/trinity/orchestration/reward.py.

…er#99)

The leaderboard schema, mock data, and web types already carried gsm8k /
humaneval / bbh metric fields, but nothing in the training/eval core ever
produced those scores — they were permanent nulls. This wires all three
end-to-end, reusing existing grading paths with no core-checker changes.

- dataset.py: add gsm8k/humaneval/bbh to SUPPORTED_BENCHMARKS and _HF_LOADERS,
  with HF loaders (openai/gsm8k main; openai/openai_humaneval;
  lukaemon/bbh across all 27 subtasks) plus offline toy fallbacks, following the
  existing math500/mmlu/livecodebench pattern (same lazy-import guard + seeded
  determinism).
- reward.py: register gsm8k in MATH_BENCHMARKS and humaneval in CODE_BENCHMARKS;
  add a bbh grader (multiple-choice-letter path for "(X)" targets, else
  normalized exact-match). GSM8K's loader extracts the post-#### number so it
  grades on the existing math path; HumanEval shapes each row into the existing
  run_pass_at_1 assert contract ("<test>\ncheck(<entry_point>)"), so the
  sandbox is unchanged. BBH multiple-choice subtasks go up to (G), so a
  permissive A-Z _bbh_extract_letter is used for BBH (extract_choice_letter
  caps at A-D).
- benchmarks/: gsm8k.py, humaneval.py, bbh.py facades mirroring livecodebench.py.
- configs/benchmarks.yaml: gsm8k/humaneval in-distribution, bbh in ood.
- tests: offline loader (toy determinism + HF-row parsing) and grader coverage.
- docs: JOURNAL.md entry and SPEC.md §6.6 [OUR CHOICE] note.

scripts/results_table.py and the validator leaderboard need no changes — both
read benchmark names generically, so real scores flow once an eval reports them.

Fixes mini-router#99
…, has_answer knows bbh

Two review points from mini-router#115:

1. HumanEval was wired into both `train` and `eval` on its only (test) split,
   making the eval score non-disjoint from the optimization set. HumanEval is
   now eval-only (it ships a single split); GSM8K keeps its proper disjoint
   train/test splits.

2. `has_answer()` had no `bbh` branch, but it drives `_committed_answer()` and
   the training `format_bonus` path — so BBH trajectories were never recognized
   as carrying a parseable answer even when they did. Add a `BBH_BENCHMARKS`
   branch aligned with `_bbh_extract_letter` / `_check_bbh` (multiple-choice
   letter or non-empty free-form target).

Adds tests: has_answer("bbh", ...) for MCQ/free-form/empty, and a config check
that HumanEval is eval-only while GSM8K stays in both.
@minion1227 minion1227 force-pushed the sn74-minion1227-99 branch from 09f49ce to f758b22 Compare July 12, 2026 23:59
@minion1227

Copy link
Copy Markdown
Contributor Author

Thanks — both addressed in f758b22:

  1. HumanEval eval-only. It ships a single (test) split, so training + evaluating on the same split was non-disjoint. Removed it from train; it is now eval-only. GSM8K keeps its proper disjoint train/test splits.

  2. has_answer() now handles bbh. Added a BBH_BENCHMARKS branch aligned with _bbh_extract_letter / _check_bbh (multiple-choice letter or non-empty free-form target), so _committed_answer() and the training format_bonus path recognize BBH trajectories.

Added tests for both (has_answer bbh MCQ/free-form/empty; a config check that HumanEval is eval-only while GSM8K stays in both). Also rebased onto latest main (resolved the BFCL benchmark overlap, keeping both). Full suite: 244 passed.

…-router#99)

CI (which has `datasets` + network) loaded the real HumanEval set, so
`load_tasks("humaneval")[0]` was the `specialFilter` task, not the `add` toy —
test_humaneval_toy_grades then failed grading `add` against it. Grade against
`_toy_tasks("humaneval")` directly, and force the offline path in
test_toy_fallbacks_load_offline by stubbing `_try_load_hf`, so both are
deterministic regardless of dataset/network availability.
@minion1227

Copy link
Copy Markdown
Contributor Author

CI fix pushed in 41f361ctest-router is green now.

The failure was environment-specific: CI has datasets + network, so load_tasks("humaneval") loaded the real HumanEval set and [0] was the specialFilter task, not the add toy — my grading assertion then failed. Made the toy tests deterministic (grade against _toy_tasks(...) directly, and stub _try_load_hf to force the offline path), so they no longer depend on dataset/network availability. Full suite: 244 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

benchmark Benchmark or config changes docs Documentation changes miner Miner contribution PR train Training or routing changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add end-to-end GSM8K, HumanEval, and BIG-Bench Hard (BBH) benchmark support

2 participants