Skip to content

feat(rna_design): RNA design environment - #4931

Merged
cmunley1 merged 22 commits into
mainfrom
cmunley1/rds
Oct 26, 2026
Merged

cmunley1 merged 22 commits into
mainfrom
cmunley1/rds

Conversation

@cmunley1

@cmunley1 cmunley1 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds RNA inverse folding as both a benchmark and a training environment: given a target secondary structure, design sequences that fold into it. Each rollout is one design campaign with a fixed budget of tool calls on a published generator (gRNAde), a folding engine (EternaFold) and the suite's scorers. When the budget is spent the whole pool is re-scored with the suite's own metric and gates, and the reward is 1.0 if the campaign solved the target.

  • environments/rna_design: the manifest-backed catalog entry, with the run instructions and one config per mode. config.yaml (the catalog workload) is Claude Code in a sandbox calling the tools over MCP. config_agent.yaml puts the model in the loop with no sandbox, and config_fixed, config_fixed_deep and config_generator are model-free baselines on the same budget.
  • responses_api_agents/rna_design_agent: the campaign loop and tools (rds/, Apache-2.0). Each campaign runs in its own worker process.
  • resources_servers/rna_design: the same tools over MCP, one worker per rollout, with verify re-scoring the pool. It exports a VERIFIER_FIXTURE whose cases run through the server's own routes.
  • harness_agent gains an opt-in forward_mcp_tools flag (default off) that hands the resources server's MCP tools to Claude Code inside the box.

Data: eight suites, 1,694 targets, built on first start from the published RNAInvBench files (MIT) at a pinned commit, each file checked against its SHA-256 before it is loaded. Only five Eterna100 v1 example rows are in the repository. Each set's own terms are listed in LICENSE-third-party. EternaFold (BSD-3) is cloned and built on first start. gRNAde and its public checkpoints are set up with prepare.py --setup. ViennaRNA is not used, because its licence restricts redistribution.

No issue: this is a new environment, contained in its own directories plus one opt-in harness_agent flag.

Validation

  • gym env validate rna_design, gym env test rna_design (3 verifier cases: an exact fold scores 1.0, a design with no pairs 0.0, a request with no target is rejected) and gym env publish rna_design: all pass.
  • gym env test +entrypoint=resources_servers/rna_design +should_validate_data=true: passes, example data validated.
  • gym env test +entrypoint=responses_api_agents/rna_design_agent: passes (5 tests skip without torch).
  • pytest over both components and responses_api_agents/harness_agent, with current main merged in: 89 passed, 5 skipped.
  • pre-commit run --all-files: clean.
  • The suite builder was checked against the upstream conversion script: all 1,694 targets match.

Rollouts

Every run below follows the README from a fresh clone of the branch, with the steps that need internet (gRNAde setup, the suites, the EternaFold source) done once on a login node. The model is DeepSeek-V4.1-Flash, self-hosted on vLLM behind the Gym vllm_model server (reasoning_field=reasoning, which this endpoint needs).

Claude Code (--environment rna_design) on the five example rows:

Target nt Reward
eterna100_v1_57 12 1.0
eterna100_v1_50 16 1.0
eterna100_v1_72 17 1.0
eterna100_v1_75 26 1.0
eterna100_v1_121 73 0.0

No rollout was masked. The run uses only the README's two commands, with no addresses or ports: the config sets use_absolute_ip, and since #4795 the harness routes the sandbox's model calls through the Gym model server by default. The example rollouts are in resources_servers/rna_design/data/example_rollouts.jsonl, with the node address and the per-rollout MCP session token redacted. Their only tool errors are two rulesets report_rules refused for naming the target, which is that check working.

The agent mode (--environment rna_design/config_agent) was run on 20 Eterna100 v2 rows built by prepare.py. The campaigns are slow on CPU, and the partial results so far show no masked rollouts. Read one by one, the unsolved ones are the model's own: one stopped early at a best F1 of 0.92, another used all 12 rounds and reached 0.73.

Reading earlier rollouts on this branch found faults that are fixed here: operator-only fields in the MCP schemas (the model passed out_dir: /work/rules), endpoint errors scored as 0 instead of masked, tool workers left running when a rollout died before /verify, temp run directories never removed, and two servers racing to build EternaFold in one fresh checkout.

Compatibility and benchmark impact

  • New environment. No existing environment changes behaviour.
  • harness_agent: forward_mcp_tools defaults to false, so existing configs are unaffected. agent_runner.py also substitutes __WORK_DIR__ in the agent config, which is a no-op unless a config uses it.
  • New dependencies are scoped to the two component venvs: arnie, pandas (to read the RNAInvBench files) and huggingface_hub (agent only).
  • First start needs internet once (EternaFold source and the RNAInvBench files) plus git, make and a C++ compiler. On nodes without internet, run prepare.py once where there is.
  • Scores are not comparable to published Eterna100 numbers computed with ViennaRNA: every design here is folded with EternaFold.

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, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

copy-pr-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work labels Oct 22, 2026
@cmunley1
cmunley1 force-pushed the cmunley1/rds branch 2 times, most recently from 6a13c0b to 04defd4 Compare October 22, 2026 17:36
Signed-off-by: Christian Munley <[email protected]>
youhanl-nvidia and others added 6 commits October 22, 2026 12:42
Each one cost a model a round, a campaign, or a wrong score, and each is
reachable by following the prompt's own instructions.

- A tool called without `target` fell back to one fixed campaign and
  scored designs against that campaign's structure. The campaign in
  progress is the default now, and `target` passed to a tool that has no
  such field is ignored rather than discarding the call -- report.rules
  was losing a whole ruleset to it.
- A missing required argument raised the input dataclass's own TypeError,
  naming a class no model has heard of. It names the tool and the field.
- score.fold_match refused engine="EternaFold", which is how the engine
  and the tool's own prose spell it. Matched case-insensitively.
- code.call bind-mounted the toolbox into the sandbox and ran the script
  from there. When the harness is itself in a container that path does
  not exist on the host, so the mount is empty and every call to a saved
  tool fails. The script is staged into a work directory of its own, as
  code.run already does, which also stops a script reading the other
  tools in the box.
- A gateway that answers its own database trouble with 401 ended the run:
  every 401 was fatal. That one is retried (a wrong key reads
  differently and still fails at once), with eight attempts, a 60 s cap
  and jitter so parallel runs do not retry in lockstep.

Tests cover all five. Two tests in resources_servers/rna_design fail on
this branch before and after this change (report_rules' out_dir is
exposed over MCP, and an unreached-model rollout is not masked).

Signed-off-by: Youhan Lee <[email protected]>

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The detector reads `anthropic_api_key: unused` as a credential and the
pinned RNAInvBench commit and the two SHA-256 digests as high-entropy
secrets. All four are public constants: the key is the literal the Gym
model server ignores, and the hashes are what make the downloaded data
verifiable.

Signed-off-by: Youhan Lee <[email protected]>

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
The data table credited every set to RNAInvBench's MIT licence.
RNAInvBench collates sets published separately, and ArchiveII states no
licence at all, so the table now names each set's origin and terms and
points at the Mathews lab site for that one. Nothing is redistributed
here either way: the suites are built on first start from published
files at a pinned commit, which the README now also says needs network
access.

Signed-off-by: Youhan Lee <[email protected]>

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Both call EternaFold and neither carried @needs_eternafold, so they
failed rather than skipped wherever arnie is absent -- which is any
environment that has not run the server's requirements.

Signed-off-by: Youhan Lee <[email protected]>

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@cmunley1
cmunley1 marked this pull request as ready for review October 24, 2026 16:41
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Oct 24, 2026
svcnvidia-nemo-ci

This comment was marked as outdated.

Signed-off-by: Christian Munley <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
@cmunley1

Copy link
Copy Markdown
Contributor Author

/ok to test baac8f7

@cmunley1

Copy link
Copy Markdown
Contributor Author

/review

svcnvidia-nemo-ci

This comment was marked as outdated.

Signed-off-by: Christian Munley <[email protected]>
@cmunley1

Copy link
Copy Markdown
Contributor Author

/ok to test a726fdc

@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 — the latest review’s concrete fixes remain intact; no eligible findings remain.

  • Malformed model arguments: the parser still retains usage and carries malformed JSON into recoverable dispatch. The regression assertions require an unmasked zero, retained tokens and zero environment faults.
  • Reflection allowance: the runner still snapshots the allowance before restoration. The regression retains the empty-pool and disallowed-choice assertions. Canonical-name enforcement, operator-field rejection and trusted-controller dispatch retain their existing branches.

Compared with reviewed head 5fd73071158ea3ffff4cd39d1ee23254117cc7ee. All 68 changed paths were accounted for and inspected across three non-overlapping topics, followed by cross-component validation. Discovery remained follow-up-scoped with the historical high-impact ceiling; no newly introduced finding above that ceiling was validated. The large rollout artifact received bounded inspection and a whole-file digest comparison, not exhaustive trajectory analysis.

Read-only static review; tests were not 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 findings-only review. Request a full review with /review reset=true.

max_turns 40 -> 1000, so the campaign's round budget, not the turn cap, ends a run. The Claude Code timeout goes from 2400 to 3600 s and rollout_timeout from 2700 to 3900 s, the same wall budget as the agent mode.

Signed-off-by: Christian Munley <[email protected]>
… arguments

- The resources server closes its tool workers when it stops and when a worker
  fails to open. session_ttl_s sits just above the harness's rollout_timeout.
- Tools stop a minute short of the server's call limit (RDS_TOOL_TIMEOUT_S), so a
  late reply cannot answer the next call.
- grnade rejects an unknown mode or filter_metric, and a structure path that does
  not exist, as the model's error. Scratch directories go under the run directory.
- code.call runs only names code.run can save under, and target_specific also
  checks the ruleset notes.
- Tests for each. The process-exit checks read the ps state, so a zombie counts
  as gone.

Signed-off-by: Christian Munley <[email protected]>
On a CPU-only node gRNAde's wall time still counts against gpu_seconds, so one
call on a long target can spend most of the budget and end the campaign. State
it in the README and fix the runner comment, which said the time is charged to
the axis it was spent on.

Signed-off-by: Christian Munley <[email protected]>
- n and batch_size below 1, and temperatures outside 0 < min <= max, are the
  model's error, not an environment fault that masks the campaign.
- mode='3d' on a target that supplies no backbone is the model's error too. A
  backbone the operator should have provided stays an environment fault.
- Run-level test for the goal and hidden objective views: the campaign runs
  under an alias and the suite's protocol still judges the pool.
- README: on CPU, Claude Code also needs a higher call_timeout_s and MCP tool
  timeouts, not only rollout_timeout_s.
- ruff format on the resources server tests.

Signed-off-by: Christian Munley <[email protected]>
… child

- grnade refuses non-integer n, batch_size, n_pass and seed, and a seed outside
  [0, 2**32), as the model's error instead of an environment fault.
- A backbone the task or the model names means 3d, so a missing one fails
  (environment fault for the operator's, model error for the model's) instead
  of quietly running 2d.
- Under a goal or hidden objective, MCP campaigns show the harness an alias as
  benchmark.run_one does, and an empty @top selection no longer names the
  ranking metric. Tests check the view, the agent prompt and the alias.
- Closing a tool worker kills its process group even when the worker already
  exited, so a gRNAde child it left behind goes too.

Signed-off-by: Christian Munley <[email protected]>
…e_session

The seed reply now names its session (resources_session_id), and
close_resources_session closes that session's tool worker by that id. A
harness that gives up on a rollout can release its worker at once instead of
leaving it to session_ttl_s. Closing an unknown or closed session succeeds,
and ResourcesSessionFence keeps a late seed from reopening a closed one.
Seed and close hold the fence's per-session lock, so a close cannot slip in
while a seed is still opening its worker.

Signed-off-by: Christian Munley <[email protected]>
Resolve harness_agent tests: keep both the MCP forwarding tests and main's task-workdir test.

Signed-off-by: Christian Munley <[email protected]>
@cmunley1

Copy link
Copy Markdown
Contributor Author

/ok to test e32819c

@cmunley1

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 — the latest review’s concrete fixes remain intact; no eligible findings remain.

  • Malformed model arguments: the parser retains usage and carries malformed JSON into recoverable dispatch. The regression assertions retain one failed call, zero environment faults, unmasked reward zero and retained tokens.
  • Reflection allowance: the runner still snapshots the allowance before restoration. The regression retains the empty-pool and disallowed-choice assertions. Canonical-name enforcement, operator-field rejection and trusted fixed-controller dispatch remain intact.

Compared with reviewed head adec338990101463594080a5a25efdc2c6f3ed6d. All 68 changed paths were accounted for and inspected across three non-overlapping topics, followed by cross-component validation. Discovery remained follow-up-scoped with the historical high-impact ceiling; no newly introduced finding above that ceiling was validated. The large rollout artifact received bounded inspection and a whole-file digest comparison, not exhaustive trajectory analysis.

Read-only static review; tests were not 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 findings-only review. Request a full review with /review reset=true.

…prints off the reply stream

- gRNAde takes at most n=5000 and batch_size=512 per call, and a run that outlasts its time limit is the model's failed call, so an oversized request cannot turn a loss into a masked sample.
- A final scoring call that times out or finds the worker dead returns a masked sample instead of an HTTP 500.
- The tool worker sends replies on a private copy of stdout and points fd 1 at stderr, so a tool's own prints cannot break a reply.
- harness_agent refuses forward_mcp_tools together with agent_kwargs.mcp_config instead of silently dropping the user's servers.

Signed-off-by: Christian Munley <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

/ok to test e9f780898a7cbd1d16d0f0c8fe4c2cfc3a1c7f7f

@cmunley1, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@cmunley1

Copy link
Copy Markdown
Contributor Author

/ok to test e9f7808

@cmunley1

Copy link
Copy Markdown
Contributor Author

/review

@cmunley1
cmunley1 merged commit 8820739 into main Oct 26, 2026
53 of 57 checks passed
@cmunley1
cmunley1 deleted the cmunley1/rds branch October 26, 2026 19:43

This branch was previously deployed

1 inactive deployment
public — e9f78089 Deployed Oct 26, 2026 by copy-pr-bot[bot] via release / finalize / notify #7394
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants