Skip to content

fix(ifbench,birdbench,ioi26): give prepared rows a stable task_id - #6647

Merged
iguehring-nvidia merged 4 commits into
mainfrom
iguehring/ifbench-task-id
Nov 24, 2026
Merged

iguehring-nvidia merged 4 commits into
mainfrom
iguehring/ifbench-task-id

Conversation

@iguehring-nvidia

@iguehring-nvidia iguehring-nvidia commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Gives every prepared IFBench, BIRD and IOI 2026 row a stable, unique task_id:

  • ifbench: the key of the upstream IFBench_test.jsonl row (unique for all 300 rows).
  • birdbench: the question_id of the upstream dev.json entry (0 to 1533, unique for all 1534 dev tasks).
  • ioi26: the problem and the subtask, e.g. ballmachine-01-star or magiccity-band-6-10, unique across the 41 rows. Its rows already carried problem_id, which the planner accepts, but it names the problem and a problem has one row per scored subtask or band, so the plan was refused with task ids are not unique (all six problems). problem_id is unchanged; the grader looks the problem up by it.

Until now the rows carried only id, the row's position. Gym plans and selects tasks by task_id, problem_id or instance_id, never by position, so none of the three could be planned (ConfigError: Benchmark '<name>': N of N tasks have no task id, or task ids are not unique for ioi26) and their tasks could not be selected by id. A positional id would also name a different task if the upstream file were reordered; the upstream id does not. Same approach as #4610 for IFEval. The changes are the same kind of fix, so they are one PR.

id is kept unchanged everywhere it exists, because the resources servers' request models read or require it. The ifbench, bird_sql and competitive_coding_challenges task-data schemas gain the optional task_id field, as IFEval's did.

Why the source id and not ifbench-{idx}: it is owned by the upstream dataset, so it stays attached to the same prompt if rows are inserted or reordered. For ifbench today the keys are the strings "0" to "299", equal to the positions.

BIRD train split. Original train.json rows have no upstream question_id, but ReViSQL's verified rows already carry one: the position of the row they replace. build_uberset now gives each original its own position in train.json the same way, so every uberset row has a question_id and a task keeps its task_id whether or not it was verified. (The uberset puts verified rows last, so its id is not stable; task_id is.)

Validation

  • tests/unit_tests/benchmarks/test_ifbench_prepare.py: prepared rows carry the source key as task_id and keep id.
  • tests/unit_tests/benchmarks/test_birdbench_prepare.py (new): dev rows carry the source question_id as task_id and keep id; the train uberset gives every row its train.json position.
  • The new ifbench and birdbench tests fail on main and pass with the change. The existing birdbench tests in benchmarks/birdbench/tests/test_prepare.py now supply question_id in their fixtures; with the new tests they pass (26 tests).
  • pre-commit run on the changed files: pass.
  • Real plans with the change: plan_benchmark("ifbench") returns 300 tasks, plan_benchmark("birdbench") 1534 and plan_benchmark("ioi26") 41, all with unique ids, where all three were refused before. task_ids=["magiccity-band-6-10", "tiling-01-sub1"] on ioi26 returns exactly those two tasks.
  • task_ids=["7", "250"] on ifbench returns exactly those two tasks. I did not run the BIRD train split.
  • No new unit test for ioi26: prepare() clones the IOI archive, so its check is the real plan above.
  • The committed ifbench metrics sidecar is unchanged by a prepare run.

Rollouts

N/A: only the prepared rows gain a field; prompts, verifier inputs and grading are unchanged.

Compatibility and benchmark impact

None for scores. Prepared files gain a task_id field; re-run gym eval prepare for the benchmark to pick it up. Rows without task_id still validate.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally.
  • Documentation added or updated, or N/A with justification. N/A: the prepare scripts' docstrings list the new field; no documented behaviour changes.
  • Pre-commit checks pass locally. Ran on the changed files.
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s).

🤖 Generated with Claude Code

Gym plans and selects tasks by `task_id`, `problem_id` or `instance_id`.
IFBench rows carried only `id`, the row's position, so `gym eval plan
--benchmark ifbench` refused all 300 rows and its tasks could not be
selected by id.

Each prepared row now carries `task_id`, the `key` of the upstream
IFBench_test.jsonl row. It is unique for all 300 rows and does not change
if the file is reordered, which a positional id would not survive. `id`
is kept unchanged because the resources server's request requires it.
The ifbench task-data schema gains the optional field, as IFEval's did.
Same approach as #4610 for IFEval.

Signed-off-by: Ingo Guehring <[email protected]>
@iguehring-nvidia iguehring-nvidia self-assigned this Nov 23, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 23, 2026 14:37
@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:mid Autobot PR risk: mid bug Something isn't working area:data Datasets, preparation, task formats, and materialization needs-review PR is ready for code review and waiting on a reviewer labels Nov 23, 2026

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

I reviewed all three changed files and traced preparation through schema validation, planning, selection and the IFBench request model. I found no runtime correctness regression. There is one non-blocking test-discovery issue below.

CI evidence on the admitted head: Nemo_CICD_Test, all four core shards, all eight server shards and Lint check succeeded. Build Gym container was skipped, not passed.

I ran python /workspace/review-probes/ifbench_contract_probe.py in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, using Python 3.13.14. With downloads mocked, it confirmed that source-key IDs survive reordering, existing fields stay unchanged, old rows still validate, and planning and selection work where base rejected missing IDs. The reviewed request model also accepted the changed rows. An isolated invocation of the three new tests passed, with one pytest configuration warning. I did not run real downloads or model rollouts; scoring and prompt inputs are unchanged.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

return validate_jsonl_rows("ifbench", TypeAdapter(TaskData), "ifbench_benchmark.jsonl", lines)


def test_prepared_rows_carry_the_source_key_as_task_id(tmp_path: Path) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NOTE — Could you move these cases into the existing tests/unit_tests/benchmarks/test_ifbench_prepare.py? Core CI runs pytest without an explicit path, and testpaths = ["tests"] excludes this directory. The server suite discovers server directories, not benchmarks.

These useful regression assertions therefore run only when invoked explicitly. The existing core IFBench tests check the download pin and metrics, so CI would not catch removal of the new identity assignment. Moving the cases into that existing test module preserves their behavior and puts them under normal CI collection. Check that core collection includes all three cases and that removing the task_id assignment fails the identity assertion.

The test sat in benchmarks/ifbench/tests, which core pytest does not collect
(testpaths is tests). It now lives in the existing
tests/unit_tests/benchmarks/test_ifbench_prepare.py, reduced to the one
assertion that matters: prepared rows carry the source key as task_id and
keep id.

Signed-off-by: Ingo Guehring <[email protected]>
Gym plans and selects tasks by `task_id`, `problem_id` or `instance_id`.
BIRD rows carried only `id`, the row's position, so `gym eval plan
--benchmark birdbench` refused all 1534 rows and its tasks could not be
selected by id.

Each prepared row now carries `task_id`, the `question_id` of the upstream
dev.json entry, which does not change if rows are reordered. For the train
split, build_uberset gives each original row its position in train.json as
`question_id`, as the verified rows already carry, so every row has one.
The bird_sql task-data schema gains the optional field. Same approach as

Signed-off-by: Ingo Guehring <[email protected]>
#4610 for IFEval.
@iguehring-nvidia iguehring-nvidia changed the title fix(ifbench): give prepared rows a stable task_id fix(ifbench,birdbench): give prepared rows a stable task_id Nov 23, 2026
Gym plans and selects tasks by `task_id`, `problem_id` or `instance_id`.
IOI 2026 rows carry `problem_id`, but it names the problem, and a problem
has one row per scored subtask or band, so `gym eval plan --benchmark
ioi26` refused the plan: task ids are not unique (all six problems).

Each prepared row now carries `task_id`, the problem and the subtask label
(`ballmachine-01-star`, `magiccity-band-6-10`), unique across the 41 rows.
`problem_id` stays what the grader looks the problem up by. The
competitive_coding_challenges task-data schema gains the optional field.

Signed-off-by: Ingo Guehring <[email protected]>
@iguehring-nvidia iguehring-nvidia changed the title fix(ifbench,birdbench): give prepared rows a stable task_id fix(ifbench,birdbench,ioi26): give prepared rows a stable task_id Nov 24, 2026
@iguehring-nvidia

Copy link
Copy Markdown
Contributor Author

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP

I reviewed the eight-file follow-up delta since f0523a33b345999d1a8b5bc438e63c508c23715a, with separate BIRD, IOI26 and IFBench reviews. I found no new defect above the prior low-impact ceiling. The previous test-discovery NOTE is partially addressed: core discovery now includes the identity assertion, but the two schema cases were deleted rather than moved. The remaining suggestion is below.

CI on fe17654a5af46cd28726311f06c35c4f5608ee11: Nemo_CICD_Test, all four core shards, all eight server-suite shards, the test aggregates and Lint check succeeded. Build Gym container and GPU/provider E2E checks were skipped, not passed.

Local probes ran in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, the default-branch CI image with download caches, because this head's image build was skipped. It reports source commit 041060103fc3fc441eb17142b97c91d4133f34d2 and Python 3.13.14. I relied on CI for the passing suites. The offline probes passed:

  • bird-1/probe.py: 18 scenarios covering dev reorder, train substitutions, old/new schemas and real SQLite grading. Existing prepared fields and representative scores stayed unchanged.
  • ioi-1/probe.py: 12 synthetic task identities, planning/selection and 72 verify calls with a fake evaluator. Existing statements, metadata, evaluator inputs and rewards stayed unchanged.
  • ifbench-1/identity_mutation_probe.py and ifbench_contract_probe.py: the moved assertion passes on head and fails on base and in-memory identity mutations. Old/new schema and request-model compatibility passed. Default discovery includes the assertion.
  • cross_contract_probe.py: all three schemas accepted old/new representative rows, and materialization preserved task inputs through planning and reordered selection.

These scripts are under /workspace/review-probes/. Collection emitted configuration warnings with plugin autoload/cache disabled; collection was not a test-suite run. No real dataset download, IOI archive clone, model rollout or GPU execution ran. IOI's existing unknown-field warnings were unchanged, so I do not claim its complete prepared rows are schema-clean.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

):
rows = [json.loads(line) for line in prepare.prepare().read_text().splitlines()]

assert [(row["task_id"], row["id"]) for row in rows] == [("7", 0), ("3", 1)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NOTE: Could you also retain the two schema regression cases requested in the previous review? The identity test is now collected, and I confirmed that it rejects removing task_id or replacing it with the row position. However, the former schema-clean case and old-row/unknown-key case were deleted rather than moved. A later preparation/schema mismatch could therefore pass this identity-only assertion.

This is the same low-impact coverage NOTE, not a demonstrated runtime failure: the compatibility probes still pass. Keeping those two cases beside this test would finish the original handoff without changing production behavior. Preserve the non-positional identity assertion; check that core collection includes the restored cases, prepared rows validate without unknown keys, rows without task_id still validate, and misspelled task_di is reported.

@AdamRajfer
AdamRajfer self-requested a review November 24, 2026 11:33
@iguehring-nvidia
iguehring-nvidia added this pull request to the merge queue Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45385325611

Merged via the queue into main with commit 91666f9 Nov 24, 2026
70 checks passed
@iguehring-nvidia
iguehring-nvidia deleted the iguehring/ifbench-task-id branch November 24, 2026 11:51
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Dec 1, 2026
… as dated versions, and a schema-only prompt (NVIDIA-NeMo#6711)

* feat(birdbench): add the 2025-11-06 dev and both Mini-Dev releases as versions

`version` picks a release of BIRD dev's questions: dev_20240627 (the
default, unchanged), the authors' revised dev_20251106 (614 of 1,534
questions changed), and Mini-Dev as of 2025-07-04 and of the 2026-10-28
update (500 each). The newer releases come from the BIRD authors'
Hugging Face datasets at a pinned revision and are checked against their
SHA-256; all run on dev.zip's 11 databases. A non-default version writes
its own prepared file and tags its rows with question_id and
bird_version; the default file is unchanged.

`prompt_format=schema_only` (SQLite) prepares rows for auto-ontology-eval's
schema-only prompt (prompts/schema_only_sqlite.yaml): the CREATE TABLE
statements and BIRD's column descriptions, with the question and its
evidence apart. eval.sh takes --version and --prompt-format.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(birdbench): refuse the schema-only prompt outside BIRD dev on SQLite

With --split train it read a question_id train rows don't have and would
have tagged train rows with a dev release; eval.sh would also have put
dev and train results in one directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* docs(birdbench): document the versions, their gold check and the schema-only prompt

The README lists each release with its date, source and what changed
from dev_20240627 (counts only), and the gold check per version: no gold
errors on dev.zip's databases; q701 and q518 (and q1131 in
dev_20251106) outlast bird_sql's 30 seconds and are masked. config.yaml
documents version and prompt_format; manifest.yaml gives the license
(CC-BY-SA-4.0) and the release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(birdbench): keep cached BIRD releases out of git; give change counts both ways

data/versions/ (the downloaded question releases) is git-ignored; only
*.jsonl was. The README gives the dev_20251106 change counts with and
without whitespace-only edits, and the SHA-256 of the dev.json the
default numbers come from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(birdbench): give schema-only rows a task_id too

NVIDIA-NeMo#6647 gave every prepared BIRD row a task_id, BIRD's question_id as a
string, because `gym eval plan` refuses rows without task_id, problem_id
or instance_id. The schema-only writer builds its own rows and had none,
so a schema-only plan would be refused. It now writes the same task_id.

The default-row key-set test expects task_id, the version test checks
it on dated rows, and a new test checks schema-only rows carry the
question_id (not the row position) and pass the bird_sql task-data
schema.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* chore(birdbench): mark the pinned release hashes as allowlisted for the secrets detector

The secrets detector flags the SHA-256s of the three dated releases as high-entropy strings. They are public
checksums. Mark each line with `# pragma: allowlist secret`, as main does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(bird_sql): declare the schema-only and named-version row fields in TaskData

prepare.py's schema-only prompt adds evidence_section, and a named BIRD dev version (or the
schema-only prompt) adds question_id and bird_version. TaskData did not declare them, so strict
collation (task_data_validation=error) rejected every such row as having unknown keys. They are now
optional fields: evidence_section is prompt input, question_id and bird_version are provenance.
Rows without them, including every default row, validate as before, and a misspelled field is
still an unknown key.

The schema-only test now requires a clean report, not only zero failed rows, and new tests check
that every prepared shape (default and named version, each with both prompt formats) is clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(birdbench): derive the dataset file and prompt from version and prompt_format

Setting +prepare_script_args.version or +prepare_script_args.prompt_format directly, without eval.sh,
left config.yaml's dataset on birdbench_sqlite_dev.jsonl and default_sqlite.yaml. `gym eval prepare`
then wrote the requested file and stopped because its path differed from jsonl_fpath, or, with
+use_cached_prepared_benchmarks=true and a default file present, skipped preparation and reused the
2024 questions.

The dataset's jsonl_fpath and prompt_config now follow both arguments, so the cache check, preparation
and collation all use the requested release's file and matching prompt. Two small lookups in
config.yaml mirror prepare.output_fpath_for: the default version's file is named by the split, and the
default prompt format adds no suffix; any other value names itself, so an unknown one still reaches
prepare()'s own error. The default resolves to the same file and prompt as before, and eval.sh, which
replaces the whole dataset entry, is unchanged. Dialect and split still go through eval.sh, since they
also change the server.

test_config.py now resolves config.yaml's interpolations as Gym does and checks, for every version and
prompt format, that the dataset is the file prepare() writes and the prompt matches. The README
documents the direct overrides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(birdbench): accept only listed direct values for the derived dataset file

The derived file name fell back to the raw value for an unlisted version, so a non-version could name
an existing file and be reused from the cache without prepare() ever checking it:
+prepare_script_args.version=dev picked the default file, and version=dev_schema_only the
schema-only file with the default prompt. Setting dialect or split directly also still reused the
SQLite dev file, as it did before the derivation.

config.yaml's tables now list every accepted version and prompt format, and the file prefix only for
SQLite dev. Any other value, and a direct dialect or split, fails while the config is resolved, before
the cache is looked up, naming the missing table key. eval.sh replaces the whole dataset entry, so it
is unaffected. The README says to pass the same override to `gym eval run`, sends dialect and split
to eval.sh, and notes that the cache goes by file name, which dscp and include_evidence don't change.

test_config.py now composes the config with Gym's own parser, checks that the tables match
prepare.VERSIONS and PROMPT_FORMATS and that the other values fail, and runs Gym's prepare flow in
process (cache lookup and output-path check, prepare() stubbed) with and without a cached default file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* fix(birdbench): eval.sh rejects an unlisted --version

eval.sh built the prepared file name from --version without checking it, so an unlisted value could
name another cached file: `--version dev_schema_only` selected the schema-only file with the default
prompt, and `--version dev` the default file, and with the cache on prepare() never ran to reject
them. eval.sh now accepts only prepare.VERSIONS, as it already did for --prompt-format; every
supported combination resolves as before.

A test pins eval.sh's list to prepare.VERSIONS (it reads the script rather than running it, since the
script's exit trap reaps orphaned server processes). The README says a direct dialect or split stops
only when it isn't sqlite or dev.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* docs(birdbench): say what a missing birdbench_prepared_file key means; test the collation path

Gym's generic message for an unsupported direct value says a key under birdbench_prepared_file is not
set and suggests providing it, which would map the value to a file again. config.yaml and the README
now say to use a listed value instead.

The direct version and prompt-format test now also checks the dataset as collation (`gym eval run`)
reads it, through filter_for_server_instance_configs, beside the one `gym eval prepare` uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* test(birdbench): pin eval.sh's whole --version case, not just its first arm

The test read only the first accepting arm, so an extra arm such as `dev_schema_only) ;;` before the
rejecting `*)` would have passed it. It now requires exactly the listed versions and the `*)` arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

* test(birdbench): import the config parser from nemo_gym.config

test_code_outside_the_library_imports_exported_names_from_the_public_api
requires code outside the library to import exported names from the
package's public API. test_config.py imported GlobalConfigDictParser and
GlobalConfigDictParserConfig from nemo_gym.config.global_config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>

---------

Signed-off-by: Abel Brown <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:data Datasets, preparation, task formats, and materialization bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer risk:mid Autobot PR risk: mid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants