Repository navigation
feat(beaver): add the BEAVER text-to-SQL benchmark, scored with BEAVER's official execution accuracy - #6708
feat(beaver): add the BEAVER text-to-SQL benchmark, scored with BEAVER's official execution accuracy#6708abelatnvidia wants to merge 37 commits into
Conversation
…ex_acc Runs the gold and model queries on BEAVER's MySQL databases and scores them as BEAVER's official evaluator does: 10 seconds per query, a failed, timed-out or missing query is an empty result, and two results match when both are empty or their rows, built into a pandas DataFrame and converted to stripped text, are equal sets. pandas is pinned below 3, as the official evaluator runs it. A grader that cannot reach the data is masked as a verifier error; startup checks every configured database is loaded from the pinned dump and visible to the read-only user. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…-check benchmarks/beaver prepares BEAVER questions from Hugging Face at a pinned revision (default: 300 dw questions, sampling seed 77, as BEAVER's own download script) with auto-ontology-eval's schema-only prompt: the question, its domain knowledge as evidence, and the database's CREATE TABLE statements. gold_check.py runs every gold query the way the grader does; official_check.py scores the same predictions with BEAVER's official ex_acc.py (downloaded at a pinned commit, never committed) and with the grader, and counts disagreements. beaver_sql now refuses a MySQL server with case-sensitive table names: the dumps come from macOS, and with Linux's default 950 of neutron's 1,017 gold queries fail. Only a failed connection or a lost one masks a row; an error inside the query, access denied included, is the query's. The grader's account is created for host %, not a literal %%. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…iming and the driver A timed-out query keeps its slot while KILL QUERY is repeated, for up to 10 seconds; then the slot is released and the thread abandoned, so a query MySQL can't interrupt no longer holds a slot forever. The READMEs give the measurement contract, the MySQL setup, the gold check, which gold queries sit near the 10-second limit, and how the driver treats a string with several statements. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…s out KILL QUERY stops the server, not the client reading rows the server has already sent, so a query with a very large result kept its slot past the limit and its rows filled memory. Rows are now read 10,000 at a time and reading stops as soon as the query is out of time; the verdict, a timeout, is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…es, cancelled and oversized queries - The grader runs no session settings, so the model's SQL sees the server's own values, as under the official evaluator. - A result over 5,000,000 rows or 1 GiB isn't compared (the largest gold has 622,224 rows): it scores as the query's failure. The comparison runs off the event loop. - A request cancelled while its query runs stops the query before giving up its slot; each KILL QUERY connection is bounded to 2 seconds. - The server running out of memory, threads, disk or temporary space, or the grader running out of memory, masks the row instead of scoring it. So does a gold query that errors: every gold runs on a correctly set-up server, so that means the setup is wrong. A gold timeout stays scored. - Fields the verifier computes are ignored in an incoming request, so a saved row can be graded again. - Startup reads every table as the grader and refuses a grader that can do more than read the BEAVER databases (another privilege, a role, or SELECT on other databases). The loader no longer resets an existing user's password, refuses a grader DSN that is the loader's own user, takes a lock so one loader runs at a time, and only creates a database it doesn't own, so one created meanwhile by someone else isn't dropped. - SQL extraction bounds each ```sql block before looking for a letter, so a block without one can't swallow the next. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…read-only checks Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…ements; recover loads From an independent review: - A query is timed on its own thread, which wakes the event loop when it ends, so a busy loop or a queued thread pool can no longer turn a fast query (or a gold query) into a timeout. Stopping queries uses the runner's own threads. - A string with several statements still returns the first result, but when the driver reports more results pending the grader kills that connection, so the rest don't run on unwatched. - An oversized result is non-empty and matches nothing, as it would officially, instead of an empty result that matches an empty gold. - Server resource errors (sort memory, temporary table space, ...) on the model's query score as its error again: a runaway query causes them. A gold query that errors is still masked. - The loader marks a database as loading before touching it, so an interrupted or short load is loaded again on the next start, and the startup check compares against the pinned table count. Startup also refuses a grader with an active or mandatory role. - KILL failures are logged and counted. Category names use underscores in metric keys. The README lists where scoring departs from the official evaluator, and the known limits. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
An answer that opens the fence twice (```sql then ```sql then the query) lost its SQL: the second opening was taken as the first block's closing fence and skipped. Such a fence now stays an opening fence, so the SQL after the last ```sql is used, as BEAVER's own extraction does. On 800 saved answers, extraction now agrees with BEAVER's few-shot rule on every answer with a closed ```sql block. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…t until its connection closes Passwords: - mysql_password and mysql_admin_password (SecretStr) carry the passwords, set from BEAVER_MYSQL_PASSWORD and BEAVER_MYSQL_ADMIN_PASSWORD by the shipped config. They are credential-named, so Gym redacts them in what a run saves. - A DSN that holds a password is refused at startup, without echoing it, so a run's identity file never records one. The READMEs and gold_check/official_check take the password from the environment too. - Test: a run manifest written from the shipped config (password from the environment and literal) leaves the password in no file. Runner (Codex re-review): - The outcome is decided when the query ends; the slot is released only after its connection is closed (and trailing statements killed). - A cancellation while a query is being stopped, on the cancel path or after a timeout, waits for the stop before the slot is released. - A query that ends after the limit is a timeout whatever it returned, so a late gold error scores as an empty gold result instead of masking the row. A query that never connected still masks it. Loader (Codex re-review): - A new database is recorded as loading only after its CREATE succeeds, so a CREATE that fails on someone else's database leaves no record a later start would drop. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…malformed DSNs without quoting them Runner (Codex re-review 3): - The slot's wait for a query's thread to finish is bounded on the event loop (stop_grace_s), on a signal the thread sends once its connection is closed. A stop that stalls (a KILL that can't connect) or can't start no longer holds the slot. - Stopping is fire-and-forget on the runner's own threads. DSNs (Codex re-review 3): - The password check runs on the raw string before urlparse, and no parsing error is passed on: urlparse's own errors can quote the user info. - A DSN with a query or fragment (`?password=...`) is refused. - Refusals raise MySqlDsnError, not ValueError, so pydantic doesn't wrap them at startup in an error that prints the config holding the DSN. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…ng it; correct stale docs From an independent review of the changes since the first one: - A result stopped at the size limit (or the time limit) left its rows unread, and close() then read every one of them (the C driver frees the result that way) while the query ran on: the connection, its thread and the server query leaked. The connection is now killed before it is closed whenever rows are left unread. Live on a 10^8-row cross join: 3.6 s, nothing left running. Fake-driver test for both limits. - _stop keeps sending KILL QUERY while a given-up query's thread is cleaning up. - An abandoned thread is logged on every path, not only after a timeout. - The gold-sql-error metric could never count (a gold error masks its row before it is recorded): removed. The module docstring and the gold_status comment said a failed gold is scored; it masks the row. - README: server resource errors (1021, 1030, 1037, 1038, 1041, 1114, 1135) are scored as the query's error, not masked; an oversized result never matches, not even an empty gold result. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
/ok to test b0ba016 |
|
@abelatnvidia please take a look at the secrets detector failure and fix |
…e secrets detector The secrets detector flags the pinned commit SHAs, the neutron dump's SHA-256 and the placeholder passwords in the DSN tests. None is a secret. Mark each flagged line with `# pragma: allowlist secret`, as main does. The neutron entry is wrapped one argument per line, the way ruff-format lays it out with the comment, so the pragma stays on the hash's line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found four RISKs and two NOTEs. The required Unit tests / Test check is red because this PR omits the task-data schema and imports an exported class through its implementation module. Those failures need correction before merge.
I reviewed all 26 changed files with separate execution/scoring, MySQL setup and benchmark/data reviews. The PR supplies concrete reward-profiling and live-rollout results; I did not independently reproduce those external runs.
Validation
- CI on
b0ba016c71723ac72afd3cbb77d801f3c08efd4e:Unit tests / Server suite, lint and component-lock checks succeeded.Unit tests / Testfailed; combined core coverage was skipped, not passed. - I reproduced the three failing tests locally:
TestSchemaPresence::test_every_resources_server_ships_a_schema,TestRepoDataMatchesSchemas::test_all_committed_rows_validate, andtest_code_outside_the_library_imports_exported_names_from_the_public_api. All three failed on head and passed on the admitted base using the same environment. - The memory-queue probe retained 40 completed gold frames with query concurrency set to one. The loader probe confirmed that a missing database is not recreated when its metadata hash is current.
- Focused probes passed for prompt preparation, evidence/no-evidence output separation, fixture rewards, stale-grading removal, outage masking, cancellation cleanup, dump checksum recovery and credential redaction. Lock metadata parsed and resolved consistently.
- These commands ran in
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:91666f99091979a03d78b76558851f5bf1bbf43a, the base's successful CI image, because head had no container-build check. An outside-tree virtual environment supplied the PR's MySQL Connector 26.10.0 and pandas 2.3.3. Probes and logs are under/workspace/review-probes/. secrets-detector / secrets-detectoralso failed. Its log identifies pinned revision/hash literals as high-entropy strings; that is not evidence of leaked credentials.
I did not run live MySQL, gated dataset downloads, model calls or the external official evaluator. Their behavior remains covered by the author's reported evidence, not my probes. I made no repository or provider changes.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| return value.get_secret_value() if value is not None else None | ||
|
|
||
|
|
||
| class BeaverSqlVerifyRequest(BaseVerifyRequest): |
There was a problem hiding this comment.
RISK: Add the resources server's task-data schema. beaver_sql has no task_data.py, so the shared loader returns no schema and collation cannot validate this server's task fields. Both core schema checks fail for this omission on head; I reproduced them locally, while both pass on base. This also lets malformed prepared fields reach the verifier before they are rejected.
Could you add a dependency-light TaskData declaration matching this request model, including the prompt/provenance fields emitted by prepare.py, and enforce agreement between schema and runtime types, requiredness and unknown-field policy? Preserve the flat row shape and extra="allow" behavior; do not introduce a competing contract.
Acceptance: the existing TestSchemaPresence::test_every_resources_server_ships_a_schema and TestRepoDataMatchesSchemas::test_all_committed_rows_validate pass; generated evidence/no-evidence rows validate; malformed required fields fail during collation; and a schema/runtime mismatch fails a drift test. Importing the schema must not require MySQL or pandas.
| # fails here means the data or server isn't what was checked. (Officially it would be an empty result, | ||
| # which an empty or failed answer matches.) A gold query that times out is still scored as empty. | ||
| raise MySqlUnavailableError(f"gold query failed: {gold.error}") | ||
| pred = missing_prediction() if extracted_sql is None else await self._runner.run(body.db_id, extracted_sql) |
There was a problem hiding this comment.
RISK: Bound complete verifications, not only individual queries. The runner releases its query permit after returning the gold frame. With concurrent requests, predictions queue behind other requests' gold queries while every completed gold frame stays resident. Comparisons retain both frames outside that permit too, so result memory grows with submitted requests rather than max_concurrency.
I ran PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/workspace/review/source /workspace/review-probes/venv/bin/python /workspace/review-probes/execution-scoring-1/memory_queue_probe.py. It drives the real verifier and runner with a fake connector and reported max_concurrency=1, live_gold_results_peak=40, first_prediction_index=40. All 40 requests graded, but large results can exhaust grader memory despite the configured limit.
Could you hold a separate verification-level semaphore across gold execution, prediction and comparison? Keep the existing query permit and connection-cleanup behavior; acquiring that same permit recursively would deadlock. Add a concurrent tracked-frame regression proving retained result pairs stay bounded, cancellation releases the verification permit after cleanup, and BEAVER's timeout/comparison semantics remain unchanged.
|
|
||
| @pytest.mark.parametrize("source", ["environment", "literal"]) | ||
| def test_no_file_a_run_writes_holds_a_password(self, tmp_path: Path, monkeypatch, source: str) -> None: | ||
| from nemo_gym.rollouts.rollout_recovery import RunManifest, config_identity_path_for |
There was a problem hiding this comment.
RISK: Import RunManifest through the public package to restore the required core check. This import causes test_code_outside_the_library_imports_exported_names_from_the_public_api to fail in core shard 2, which feeds the required Unit tests / Test aggregate. I reproduced the failure on head and a pass on base, so this is not merely a convention concern.
Could you import RunManifest from nemo_gym.rollouts and leave config_identity_path_for on its current path unless it is also exported? Preserve the credential-redaction test's behavior. Acceptance: the public-API test passes and both environment/literal password cases still verify that saved files contain no credential.
| raise RuntimeError( | ||
| f"MySQL already has databases {foreign} that this loader didn't create; drop them or use another server" | ||
| ) | ||
| stale = [db_id for db_id in db_ids if recorded.get(db_id) != _dump(db_id).sha256] |
There was a problem hiding this comment.
RISK: Reload an owned database when the schema is missing. The reload decision only checks the recorded hash. If dw is dropped or restored separately while _beaver_meta.loaded keeps its current record, ensure_beaver_mysql() returns without recreating it, even with admin credentials. Startup then fails because the grader sees zero tables.
The unchanged public setup/check functions, driven by the stateful fake-server probe mysql-setup-1/loader_probe.py, produced missing_db_setup_returned_success True dw_exists False, followed by dw: the grader's user sees 0 of 97 tables.
Could you include db_id not in existing in the stale condition and use the existing recorded-ownership reload path? Acceptance: current metadata plus an absent schema reloads the pinned dump and passes startup. Preserve rejection of foreign databases and the existing CREATE-race protection.
| modality: text | ||
| licensing: MIT | ||
| authors: | ||
| - abelatnvidia |
There was a problem hiding this comment.
NOTE, suggestion: Complete the new manifest's selection metadata. The manifest leaves maintainers, capabilities, domains, primary_metric and requirements unset. The review rubric requires these authored fields for new manifests. Here they matter because BEAVER exposes two different headline accuracies and requires MySQL plus gated inputs.
Could you supply the maintainer login, applicable taxonomy values, the exact default-run headline metric key, and GPU/network requirements? Use supported unknown values where genuinely unknown. Acceptance: the manifest loads, taxonomy values validate, and primary_metric names a metric emitted by the default one-repeat run. This is metadata completeness, not a demonstrated scoring failure.
| [BEAVER](https://beaverbench.github.io/) ([paper](https://arxiv.org/abs/2409.02038)) is an enterprise text-to-SQL | ||
| benchmark: questions over real, anonymized data warehouses with hundreds of tables, gold queries in MySQL. This | ||
| benchmark asks for one MySQL query per question from the schema alone and scores it with BEAVER's official execution | ||
| accuracy, through the [`beaver_sql`](../../resources_servers/beaver_sql/README.md) resources server. |
There was a problem hiding this comment.
NOTE, suggestion: Expose the setup and measurement contract in the user docs. The new benchmark's instructions live only in repository READMEs; this PR adds no BEAVER entry under fern/versions/latest/pages/. The rubric requires user documentation for a notable benchmark, and users need to discover the case-insensitive MySQL requirement, gated-data setup and distinction between all-task and nonempty-gold accuracy before running it.
Could you add a short navigable Fern entry with the minimal prepare/run example and those limits, linking to the detailed server README rather than duplicating it? Acceptance: the documentation entry resolves, its links work, and its example uses the shipped configuration without putting passwords in a DSN.
|
Hi. Please point your agent to these instructions. Move this benchmark off the In this PR:
|
…gacy_agent relay Gym no longer accepts new legacy_agent configs. beaver_sql is a stateless verifier (no seed_session override, no tools, metric hooks already on the resources server), so the move is the config switch only, as in benchmarks/gpqa/config.yaml and resources_servers/mcqa/configs/mcqa.yaml: both beaver_sql_environment_server and the benchmark's beaver_environment_server now use single_agent_turn_legacy, pointed at beaver_sql_resources_server and the matching agent. No tool transports, since the server serves no tools. app.py and the scoring are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…t a missing eval.sh config.yaml said to "use eval.sh, which does both", but the benchmark has no eval.sh. The comment now points at the README's "Preparing data and evaluating" example, which sets both overrides. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
/ok to test d63c933 |
tests/unit_tests/benchmarks/test_beaver_prepare.py imported benchmarks/beaver/prepare.py, which imports setup_beaver_mysql. The core coverage gate counts every repository file the core suite imports, and setup_beaver_mysql's MySQL paths are exercised only by beaver_sql's own tests, so core coverage fell to 94.99% against the 95.00% gate. The same tests now run with beaver_sql's tests as tests/test_prepare.py. Outside tests/, Gym's public-API check applies: the moved file imports TaskDataValidator and load_task_data_schema from nemo_gym.data, and finds the server directory from its own path, as test_task_data.py does, instead of importing find_server_dir from nemo_gym.data.task_data. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Pushed |
|
@ffrujeri thanks for running CI. Could you run |
|
/ok to test 1b85ff3 |
ffrujeri
left a comment
There was a problem hiding this comment.
Thanks for the fixes. The four points of the change request are fixed at 1b85ff3f: the verifier's MySQL user gets SELECT on _beaver_meta.loaded only, grant authority is refused with a regression case, each row keeps its source id and gets a stable, unique task_id, and the lock passes uv lock --check, also after a merge with current main. The single_agent_turn_legacy move and the bot's six findings are fixed too. @Glorf, could you re-review, or dismiss the change request if you agree? The threads can then be resolved.
Two small notes are inline. Not blocking: new annotations use Optional, Dict and List; ruff check --select UP006,UP035,UP045 --fix resources_servers/beaver_sql benchmarks/beaver fixes most of them. Open question 1, the MySQL driver license, needs a maintainer answer, which will come separately.
| records ``gold_result`` (``empty_gold`` or ``nonempty_gold``), and the metrics report accuracy over all tasks and over | ||
| ``nonempty_gold`` tasks: an empty gold result is matched by any query that returns nothing, so BEAVER publishes both. | ||
|
|
||
| When the grader can't reach the data (no MySQL, wrong password, a database not loaded), or a gold query errors within |
There was a problem hiding this comment.
This text uses two names for one thing: "the grader" here, and BeaverSqlVerifier and verifier_error in the code. Could the comments, docstrings, READMEs and the Fern page say "verifier" (for example "the verifier's MySQL user"), and could grader_privilege_problems become verifier_privilege_problems?
| leaderboard (Setting 0) gives no hints: prepare with ``include_evidence=False`` for numbers comparable with it. | ||
|
|
||
| Prompt construction and evidence adapted from auto-ontology-eval (https://github.com/NVIDIA/auto-ontology-eval, | ||
| ``ontology_sql_eval/gym/tasks.py``, ``ddl.py`` and ``scripts/seed/seed_beaverbench.py`` at e727e4d6e, Apache-2.0). |
There was a problem hiding this comment.
Could this header give the full commit, e727e4d6e1e198355099de4803590bb3681793a4, and could the PR description name the same commit and source files? The same short SHA is in setup_beaver_mysql.py and prompts/schema_only.yaml.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…modern annotations Review points from ffrujeri on NVIDIA-NeMo#6708: - The text called beaver_sql's verifier "the grader" while the code says BeaverSqlVerifier and verifier_error. Comments, docstrings, error messages, both READMEs and the Fern page now say "verifier", and grader_privilege_problems is verifier_privilege_problems (four test names follow). The one remaining "grader" in official_check.py is another grader's verdict (auto-ontology-eval's), not this verifier. - benchmarks/beaver/prepare.py, prompts/schema_only.yaml and setup_beaver_mysql.py now give auto-ontology-eval's full commit, e727e4d6e1e198355099de4803590bb3681793a4, and prepare.py names each source file by its full path. - New annotations use built-in generics and X | None (ruff --select UP006,UP035,UP045 --fix, then F401 for the emptied typing imports). No behavior change apart from the wording of the verifier's startup errors. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
"verifier" is two characters longer than "grader". Rewraps the comments, docstrings and README lines that the rename took past 119 characters, and splits one error string literal (same text). Two of the lines in setup_beaver_mysql.py were already over the limit; both are now under. The previous commit also changed the --help text of gold_check.py and official_check.py from "grader" to "verifier". Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Thanks. All three are done in two commits on top of a merge with current
@ffrujeri could you |
|
On the MySQL driver: I'd switch to PyMySQL (MIT). mysql-connector-python is GPL-2.0, not LGPL like psycopg, so the |
|
/review 4221382 |
This comment has been minimized.
This comment has been minimized.
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
The six prior findings are resolved. I found no new high- or critical-impact defect introduced since b0ba016c71723ac72afd3cbb77d801f3c08efd4e, as required by this follow-up’s above-moderate filter. This is a scoped follow-up, not a full RESET review.
Prior findings
- Task-data schema: the dependency-light schema matches the verifier’s field types, requiredness and extra-field policy. Prepared rows validate, malformed fields fail collation in error mode, and mutation probes confirm that the drift checks detect mismatches.
- Verification memory bound: the semaphore now covers gold execution, prediction and comparison. With concurrency one and 40 requests, the differential probe reduced peak retained gold frames from 40 on the previous revision to one on this head. Repeated cancellation kept the permit until query cleanup or comparison completion.
- Public import:
RunManifestnow comes fromnemo_gym.rollouts. Credential-redaction probes still passed for environment-provided and literal passwords. - Missing owned database: setup now recreates an absent schema despite current metadata. A simulated competing CREATE preserved the foreign database without dropping it.
- Manifest metadata and user docs: the selection fields are populated, the primary metric is emitted by the default run, and the linked Fern page documents setup and both headline accuracies.
I accounted for all 31 changed files through separate verification/concurrency, MySQL setup and benchmark/data/config reviews. I compared the supplied previous revision directly and separated unrelated upstream restructuring from the BEAVER changes.
Validation
- CI on
42213825f9591bf24d4d239ad91a525ffc725b5d:Unit tests / TestandUnit tests / Server suitesucceeded, including all four core shards, eight server shards and combined core coverage. Both component-lock checks and the Fern docs check succeeded. - The BEAVER server’s CI log shows 170 passed and 17 skipped. The skips cover 16 official-evaluator comparisons and one live-MySQL test.
Unit tests / Changed server testswas skipped; the full server suite did execute BEAVER. - Targeted local probes passed for memory bounds, cancellation cleanup, seven previous-versus-current scoring cases, database recovery and ownership races, grant migration, schema validation and drift, preparation and stable task IDs. Eight fake-service episodes through both shipped configurations preserved rewards, masking, cookies and task fields. My separate adapter-to-verifier probe returned rewards
[1, 0, 0]and the expected 33.33% aggregate. - Probes ran in
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:91666f99091979a03d78b76558851f5bf1bbf43a, a successful default-branch CI image because this head’s container build was skipped. An outside-tree virtual environment supplied MySQL Connector 26.10.0 and pandas 2.3.3. Scripts and outputs are under/workspace/review-probes/; existing CI suites were not rerun locally.
I did not independently run live MySQL, gated datasets, model calls or the external official evaluator. The PR’s reported profiling and live-rollout results remain author-supplied evidence. The local probes used fake external boundaries, not substitutes for those live checks.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
mysql-connector-python is GPL-2.0 with the Universal FOSS Exception, so keeping it would need OSRB review (anwithk on NVIDIA-NeMo#6708). PyMySQL is MIT. The official evaluator keeps mysql-connector-python; benchmarks/beaver/official_check.py, which runs it, is run with `uv run --with mysql-connector-python`, and the server no longer depends on it. The verifier keeps the official driver's behavior that matters for scoring: - Multi-statement strings are allowed (CLIENT.MULTI_STATEMENTS) and only the first result counts. Without it PyMySQL refuses such a string (1064) where the official driver returns the first statement's result; 2 of 1,600 saved model answers depend on it. A statement still running after the first result is stopped by killing the connection, as before. - Rows are read unbuffered (SSCursor), in chunks, so a timed-out or oversized result stops being read and memory stays bounded. "More results pending" comes from PyMySQL's result (has_next), the connection id from thread_id(), error numbers from the exception's first argument. - PyMySQL reads rows at about half the official driver's rate, so a result near the old 5,000,000-row limit ran out of the 10 s first and scored as an empty result instead of oversized. The limit is now 1,000,000 rows (1.6 times the largest gold result, 622,224 rows), reached in a few seconds. Officially an over-limit answer whose rows repeat a gold's could match (the comparison is over sets); the README lists this departure, which existed at 5,000,000 rows before. - After the connection is killed and closed, PyMySQL's leftover unbuffered result and cursor are marked done, so garbage collection doesn't log a traceback for every multi-statement or oversized answer. The tests' fake driver follows PyMySQL's API and error classes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Push history, moved out of the description to keep it short. Since
|
|
@anwithk thanks, switched to PyMySQL (MIT). The official evaluator keeps mysql-connector-python (GPL-2.0 with the Universal FOSS Exception); the server doesn't depend on it, and Parity, on your test:
Two verifier changes came with the switch:
The limit came down because PyMySQL reads rows at about half the official driver's rate (about 350,000 against 735,000 a second for one wide result, measured here). At 5,000,000 rows, a huge answer could run out of the 10 s first and score as a timeout, an empty result, instead of as oversized. One of the 1,200 did (its gold isn't empty, so the verdict didn't change); now it's oversized again. The slower reads also mean a query near the 10 s limit is a little more likely to time out here than under the official driver; the server README's concurrency note covers the few golds that slow. |
What does this PR do?
Review
resources_servers/beaver_sql/ex_acc.py(how a query runs and how two results compare),verify()inapp.py,setup_beaver_mysql.py(download, load, read-only user, startup check) andbenchmarks/beaver/prompts/schema_only.yaml. Skip the tests,benchmarks/beaver/gold_check.pyandofficial_check.py. The layout followsbirdbenchandbird_sql. Push history is in the comments.Adds BEAVER (paper), an enterprise text-to-SQL benchmark on real, anonymized data warehouses, as
benchmarks/beaverwith a new resources server,resources_servers/beaver_sql. The model gets the question, its domain knowledge and the database'sCREATE TABLEstatements, and answers with one MySQL query. The verifier runs it on MySQL and scores it with BEAVER's own execution-accuracy rule, checked against BEAVER's official evaluator on the same predictions.ex_acc.py), as BEAVER'seval/utils/ex_acc.py: each query gets its own connection and 10 seconds. A failed or timed-out query, or a missing```sqlblock, is an empty result. Two results match when both are empty, or when their rows, built into a pandasDataFrame, converted withastype(str)and stripped, are equal sets. TheDataFramestep and pandas 2 are kept on purpose: both change the text, and so verdicts.--lower-case-table-names=1. BEAVER's dumps come from a case-insensitive server; on Linux's default, 950 of neutron's 1,017 gold queries fail. The loader and startup check refuse a case-sensitive server.SELECTon the BEAVER tables, or any grant authority, so a setup gap fails there instead of scoring every query empty.verifier_error; any other error is the model's. Timed-out queries are killed; a trailing statement still running, and a result over 1,000,000 rows, are stopped..envuser, root in BEAVER's example).KILL QUERYanother rollout's query (the server README's "Known limits").dwquestions by default, drawn with BEAVER's own sampler; stabletask_ids; the prompt is auto-ontology-eval's schema-only prompt. Evidence (BEAVER's domain knowledge) is on by default;include_evidence=falsegives the leaderboard's hint-free Setting 0. It runs onsingle_agent_turn_legacy, not thelegacy_agentrelay.Checks
gym eval run, before and after the switchdw,dw_real,neutron(with the official driver, before the switch)beaver_sqltests (fake driver, as in CI)ex_acc.pygym env validate,gym eval plan, task-data schema and import checks,uv lock --check, pre-commitLive runs
Paired per task with saved auto-ontology-eval runs of the same two public NVIDIA models, same 400 prompts: 3 vs 3 passes (large model) and 12 vs 13 (small model). Neither difference is significant: McNemar p = 0.63 for the large model on its 398 non-empty-gold tasks (1 vs 3), and p = 1.0 for the small model on all 400.
Open questions (each with a default)
neutrongold queries fail.```sqlblock means an empty prediction (default: as the official evaluator's missing prediction).bird_sqlinstead scores a missing block 0.Credits
BEAVER: Chen et al. (data MIT). The schema-only setup, its prompt and the BEAVER seeding are adapted from the Auto Ontology team's auto-ontology-eval at commit
e727e4d6e1e198355099de4803590bb3681793a4(Apache 2.0):ontology_sql_eval/gym/tasks.pyfor the prompt,ontology_sql_eval/gym/ddl.pyfor the schema, andscripts/seed/seed_beaverbench.pyfor the questions and the loader.