Repository navigation
Gnalbandyan/add ether0 oracles - #6165
Conversation
Retro-synthesis (rxn_forward) and oracle-solubility (sol_eval) call three chemistry models that upstream serves from a separate ether0-serve process. With no such service they scored 0.0 for every answer. The ether0 resources server now loads the same models itself (local_oracles, on by default): solubility through molsol, purchasability through a ZINC20 molbloom filter and the forward reaction through upstream's MolTrans wrapper. At startup it checks the MolTrans checkpoint against its pinned SHA-256 and runs one control query per model. A configured ETHER0_REMOTES_API_BASE_URL keeps the remote service. With neither backend the oracle rows are masked instead of scored zero, and an oracle failure masks the row as a verifier error. The upstream ether0 checkout is pinned to b77e0d8, the revision the graders and the oracle adapter are written against. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Grigor Nalbandyan <[email protected]>
ether0 shipped only as an environment, so `gym eval prepare/run --benchmark ether0` had nothing to resolve. benchmarks/ether0 declares the 325-question futurehouse/ether0-benchmark test split (pinned revision) as a benchmark dataset on the existing ether0 agent and resources server, and prepares it with the environment's own formatter. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Grigor Nalbandyan <[email protected]>
`gym env publish --kind benchmark ether0` requires the resources server to export a VerifierFixture. The fixture builds the server without the oracle files and covers full-reward, zero-reward and malformed cases. Also ignore the prepared benchmark data like the other benchmarks do. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Grigor Nalbandyan <[email protected]>
Signed-off-by: Grigor Nalbandyan <[email protected]>
Signed-off-by: Grigor Nalbandyan <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD
I found a silent scoring defect, an incomplete upstream revision pin, and a validation-evidence gap.
RISK — Provide numeric reward comparisons and a representative oracle smoke run
The PR says replay grades matched, but doesn't identify the compared sample count, reward means, model/configuration, or artifacts, and explicitly reports no new generations. The committed five-sample reward profile contains neither sol_eval nor rxn_forward, so it doesn't validate the newly enabled oracle paths. This leaves the scoring impact of the new benchmark and default backend unsubstantiated. The review rubric requires reward-profiling evidence, and AGENTS.md requires representative real model rollouts for behavior changes.
Could you provide a representative model smoke run covering both oracle task families and an ordinary chemistry task, plus numeric before/after grading results for the same stored outputs? Include the model/configuration, sample counts, overall and per-family reward means, masked/error counts, and artifact locations; explain intended score changes. Preserve the current prompts, grading thresholds, valid negative scores, and verified: false while collecting this evidence. Acceptance is successful default startup, inspected model-generated oracle rollouts with valid measurements, and a comparison that accounts for every reward or mask change. Existing replay outputs can support the comparison, but don't replace the real smoke run.
I completed static inspection of all changed files and their directly affected contracts. I couldn't execute tests or independently validate the external chemistry-model implementations in this read-only environment. Suggested patches and regression checks below haven't been executed.
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.
| raise OracleError(f"Solubility model failed on {query_smiles!r}: {error}") from error | ||
| if prediction is False: | ||
| return {"smiles": query_smiles, "error": "Solubility prediction failed."} | ||
| return {"smiles": query_smiles, "solubility": prediction.tolist()[0]} |
There was a problem hiding this comment.
BLOCKER — Validate each solubility prediction before grading it
If _solubility.run() returns numpy.array([float('nan')]) for an admissible answer, this adapter returns {'solubility': nan}. For example, use answer CCO and solution sol_eval!:!('scaffold', 'CC', '-3.0', 'increase')!:!oracle-solubility/scaffold. The grader evaluates abs(nan - target) > 0.49 as false and awards an unmasked 1.0. The startup control checks only its own prediction. Conversion errors here also escape OracleError handling and become an unmasked zero. Both outcomes misrepresent an invalid oracle result as a measurement.
Could you extend fetch_solubility()'s existing try to include conversion and finite-value validation? Suggested replacement for lines 58–64, to verify before adopting:
try:
prediction = _solubility.run(smiles=query_smiles)
if prediction is False:
return {"smiles": query_smiles, "error": "Solubility prediction failed."}
solubility = float(prediction.tolist()[0])
if not math.isfinite(solubility):
raise ValueError(f"Non-finite solubility prediction: {solubility!r}")
except Exception as error:
raise OracleError(f"Solubility model failed on {query_smiles!r}: {error}") from error
return {"smiles": query_smiles, "solubility": solubility}The invariant is that successful local predictions contain finite numbers; malformed model results must become masked verifier failures. Retain the existing False error reply and multi-molecule rejection, rather than masking those answer-level negatives.
Proposed checks, not executed: Through verify(), allow the admissibility check and return arrays containing nan, inf, or no elements; expect reward=0.0, mask_sample=true, and failure_kind=VERIFIER_ERROR. With the scaffold setup above, [-3.0] must retain unmasked reward 1.0, and [-2.0] unmasked reward 0.0. Retain the existing False assertion and the error reply for CCO.CC.
There was a problem hiding this comment.
Fixed in a989084.
Prediction conversion and finite-value validation now happen inside the OracleError boundary. NaN, infinities, empty arrays, and nonnumeric predictions become masked verifier failures. Valid on-target/off-target scores, the False error reply, and multi-molecule rejection retain their existing behavior.
Added regressions through verify() for invalid predictions and valid positive/negative results, plus a multi-molecule adapter check. The invalid-output cases failed before the fix. Validation: all 128 Ether0 tests passed locally, including real-oracle tests; the public-API regression and pre-commit run --all-files also passed (private guardword catalog unavailable).
|
|
||
|
|
||
| def ensure_ether0() -> None: | ||
| if not ETHER0_PATH.exists(): |
There was a problem hiding this comment.
RISK — Enforce the revision pin for cached checkouts too
The new _REPO_REVISION applies only when .ether0 is absent. An existing installation created by the previous unpinned clone can have a different HEAD; ensure_ether0() still succeeds and exposes that checkout. The app imports and new local-oracle imports then use code outside the declared revision. Clean installs and upgrades therefore don't have the same upstream dependency.
Could you validate the cached commit before exposing it? Reject a mismatch with an actionable message instead of resetting a potentially modified checkout. Suggested insertion before the sys.path branch, to verify before adopting:
revision = subprocess.check_output(
["git", "rev-parse", "HEAD"],
cwd=ETHER0_PATH,
text=True,
encoding="utf-8",
errors="replace",
).strip()
if revision != _REPO_REVISION:
raise RuntimeError(
f"Cached ether0 at {ETHER0_PATH} is {revision}; expected {_REPO_REVISION}. "
"Move the cached checkout aside and restart to recreate it."
)Every successful return must expose a checkout at the declared commit. Preserve offline reuse of a matching checkout, leave mismatched files untouched, and retain atomic publication of fresh installations.
Proposed checks, not executed: Create two commits in a temporary local Git repository and set _REPO_REVISION to the first. A cached checkout at the second must fail before changing sys.path, report both revisions, and leave files untouched. A checkout at the first must succeed without fetching. Also check that a failed fresh fetch leaves no destination checkout.
There was a problem hiding this comment.
Fixed in a989084.
ensure_ether0() now checks the checkout's HEAD against the pinned revision before adding its source path. A mismatch reports both revisions and asks the operator to move the cache aside; cached files are left untouched. A matching checkout remains reusable offline.
Added local-Git regressions for a mismatched cache with tracked/untracked user edits, offline reuse of a matching cache, a fresh checkout at the pinned commit, and cleanup after failed fetches. The mismatch test failed before the fix. All 128 Ether0 tests and the repository checks passed locally, with the private guardword scan skipped because its catalog was unavailable.
Signed-off-by: Grigor Nalbandyan <[email protected]>
Signed-off-by: Grigor Nalbandyan <[email protected]>
Signed-off-by: Grigor Nalbandyan <[email protected]>
|
/ok to test 57ec0ca |
Signed-off-by: Grigor Nalbandyan <[email protected]>
|
/ok to test d08ffea |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44175900968 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44176920658 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44177027255 |
Main's NVIDIA-NeMo#6165 adds a resources_servers/ether0 entry to scripts/component-lock-policy.json next to this branch's resources_servers/critpt_custom_grader entry. Both entries are kept, in sorted order. Main's NVIDIA-NeMo#5597 changes no file this branch changes. Signed-off-by: Erik Arakelyan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Adds local CPU chemistry oracles and benchmark configuration for Ether0, automatic MolTrans downloading, failure masking, and configurable oracle concurrency (default: 8 per worker).
No separate issue; this completes the existing Ether0 integration.
Rollouts
All compared grades matched, with no masked failures. No new generations or training runs.
Compatibility and benchmark impact
Local oracles default to enabled; remote oracles remain supported. Missing assets download on first use. Oracle failures are masked; valid negative results still receive normal scores. Replay grades were unchanged.
Checklist
☑ I have read the contributing guidelines (https://github.com/NVIDIA-NeMo/Gym/blob/main/CONTRIBUTING.md).
☑ Changes are focused.
☑ Tests pass.
☑ Documentation updated.
☑ Pre-commit passes, with the limitation noted above.
☑ New source files include Apache-2.0 SPDX headers.
☑ All commits have DCO sign-off.