Repository navigation
Add birdbench benchmark and bird_sql resource server - #1098
Merged
Merged
Conversation
Port the BIRD text-to-SQL benchmark from NeMo Skills to NeMo Gym: - `resources_servers/bird_sql/` β execution-based resource server that runs the model's predicted SQL against per-`db_id` SQLite files from the BIRD dev split and compares result sets (unordered set equality). Mirrors the `spider2_lite` pattern: Ray remote execution, semaphore- bounded concurrency, per-query timeout, auto-download of `dev.zip` on first startup. - `benchmarks/birdbench/` β benchmark config + `prepare.py` that replicates `nemo_skills/dataset/birdbench/prepare.py` exactly (schema dump via `iterdump()` + INSERT truncation) so Skills and Gym see identical rows. `prompts/default.yaml` is a char-for-char copy of `generic/text_to_sql.yaml`. Extraction logic is a strict port of `BirdEvaluator._extract_answer` including the "SELECT 1" no-answer filler and the `--.*?$` comment quirk, so reward semantics match Skills at the rollout level. Metrics use `compute_pass_majority_metrics` + `compute_subset_metrics( field="difficulty")`, producing overall + simple/moderate/challenging pass@k that map directly onto Skills' `total_acc`/`simple_acc`/ `moderate_acc`/`challenging_acc`. 43 unit tests, 97.83% coverage. Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
Multi-node DP vLLM starts a Ray cluster on the head node at the version
shipped in the container (2.53.0). When Gym's ng_run attaches via
ray.init(), Ray's client-side version check rejects the mismatched pin
(2.52.1) with:
RuntimeError: Version mismatch: The cluster was started with:
Ray: 2.53.0
This process on node ... was started with:
Ray: 2.52.1
Bumping to ==2.53.0 unblocks DP Gym rollouts.
Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
When the bird_sql resource server runs alongside a multi-node DP vLLM, Gym's ng_run attaches to the Ray cluster vLLM already started. vLLM engines consume the Ray slots, so our @ray.remote(num_cpus=1) sqlite tasks queue behind them, exceed the 30s per-query timeout, get cancelled, and every rollout returns `gold_execution_error`. SQLite queries are fast, local-only, and don't need cross-process scheduling. Switching to `asyncio.to_thread` runs them on the event loop's default thread pool, bounded by the existing concurrency semaphore. Ray is no longer a dependency of this resource server. Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
β¦license Regenerate example.jsonl as the first 5 rows of the BIRD dev split (with baked-in prompt) so it is a faithful subset of the benchmark, then commit the two artifacts the migration CI expects: - data/example_metrics.json: produced by ng_prepare_data +mode=example_validation against the bird_sql server config. - data/example_rollouts.jsonl: 5 rollouts (one per example task) sampled from the DFW parity run (rollouts per id=0..4). Also correct the license declared on the example dataset from "Creative Commons Attribution Non Commercial 4.0" (not in Gym's allowed license list) to "Creative Commons Attribution-ShareAlike 4.0 International", which is BIRD's actual license. Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
This reverts commit 8bf037e. Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
Contributor
|
looks good, testing this on my end |
cmunley1
reviewed
Apr 20, 2026
cmunley1
reviewed
Apr 20, 2026
Addresses cmunley1's review on PR #1098 (#1098 (comment) / #discussion_r3112927035): reviewers want copy-pasteable run commands in both the resource server README and the benchmark README so they can smoke-test the PR without hunting through skill or recipe files. - resources_servers/bird_sql/README.md: "Example usage" block with ng_run (server + model config) and ng_collect_rollouts targeting the 5-row example.jsonl (+num_repeats=1). - benchmarks/birdbench/README.md: "Running servers" + "Collecting rollouts" with the benchmark config and the prepared benchmark jsonl (+num_repeats=4), plus a cross-link to the server README's smoke-test block. Both follow the pattern already established in resources_servers/abstention/README.md. Signed-off-by: gwarmstrong <gwarmstrong@users.noreply.github.com>
Contributor
Single rollout test with openai model works for me smoothly |
cmunley1
approved these changes
Apr 20, 2026
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.
Migrates the
birdbench(BIRD text-to-SQL) benchmark from NeMo Skills intoGym. Uses execution-based verification against the per-
db_idSQLitedatabases, matching the Skills evaluator byte-for-byte (including the
"SELECT 1"no-answer filler and the--.*?$-with-DOTALL comment quirk).Includes
resources_servers/bird_sql/β execution-based SQL text-to-SQL resource serverBirdEvaluator._extract_answerported byte-for-byte inextract_sql_from_response(CODEBLOCK mode,SELECT 1filler,--.*?$-with-DOTALL comment stripping)asyncio.to_threadunder anasyncio.Semaphore(
max_concurrency=32,sql_execution_timeout_s=30.0), so the serverworks under contention with a vLLM-spawned Ray cluster on multi-node DP
set(pred) == set(gold)ruleas Skills
bird-bench.oss-cn-beijing.aliyuncs.comon server startup viaensure_bird_sql(); cached under.bird_sql/compute_metrics()exposespass@k/accuracy,pass@1[avg-of-k]/accuracy,majority@k/accuracy, and per-difficultybreakdowns viacompute_subset_metrics(field="difficulty")(simple / moderate /challenging)
benchmarks/birdbench/β benchmark config, prepare.py, prompt templatedownloaded from
bird-bench.oss-cn-beijing.aliyuncs.com/dev.zip{question, gt_sql, sql_context, difficulty, db_id, id}βidentical to NeMo Skills
dataset/birdbench/prepare.py::format_entriessql_contextis aniterdump()-style schema + truncated INSERT chain(β€10 INSERTs per run,
VALUES (...), (...)chains collapsed after 10tuples) β byte-for-byte port of Skills' regex rules so the prompt context
matches on both sides
Validated against NeMo Skills
Run on
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16, BIRD dev (1534 tasks),4 rollouts per task (6136 rollouts per side), sampling
T=1.0 top_p=0.95 top_k=20 max_output_tokens=65536, on draco-oci. Skills'BirdMetricsdoesn't computepass@k/majority@kβ the Skills columnbelow shows pooled per-rollout accuracy, which is equivalent to
pass@1[avg-of-4].