Add opencode_hf_sandbox.py: loop-owning training in remote HF sandboxes - #6565
Merged
Conversation
Sibling of opencode.py that runs each rollout in its own remote Hugging Face sandbox (HFSandboxBackend) to scale rollouts beyond a single node. Adds the script + its rows in example_overview.md and the openenv.md guide.
- Import HFSandboxBackend/SandboxHandle from opencode_env.sandbox (on OpenEnv main) instead of openenv.core.sandbox (the parked sandbox-to-core PR), so the example runs against plain OpenEnv main with no extra branch. - Dense terminal reward (fraction of held-out tests passed) instead of binary, and drop empty-trace rollouts as unscorable (None) so a flaky remote sandbox does not poison the group baseline. - Add proxy_max_tokens_cap, --gradient-accumulation-steps, and --max-model-len in the serve docstring.
sergiopaniego
marked this pull request as ready for review
August 5, 2026 10:08
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
6 tasks
AmineDiro
approved these changes
Aug 5, 2026
AmineDiro
left a comment
Member
There was a problem hiding this comment.
🔥 🔥
Niiice to support hf-sandbox 👍🏼
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.

What does this PR do?
Adds
examples/scripts/openenv/opencode_hf_sandbox.py, a sibling ofopencode.pythat runs each loop-owning rollout in its own remote Hugging Face sandbox (HFSandboxBackend) instead of a local subprocess, so rollouts scale out beyond a single node.It reuses the same DeepCoder task, held-out verifier and hooks as
opencode.py. The delta is where the rollout runs: a pre-baked remote sandbox image, and a two-URL topology (trainer to vLLM on localhost for NCCL weight-sync, remote sandboxes reach the same vLLM through a public URL). It also uses a dense terminal reward (fraction of held-out tests passed) and drops empty-trace rollouts as unscorable, so a flaky remote sandbox does not poison the group baseline. Adds the example toexample_overview.mdand a note in theopenenv.mdguide.The example imports
HFSandboxBackend/SandboxHandlefromopencode_env.sandbox, which is already on OpenEnvmain, so it runs against plain OpenEnvmainwith no extra branch.Validated end to end on HF Jobs (h200x2):
Qwen3-8B, 10 steps, one remote HF sandbox per rollout, with a public trackio dashboard and a pushed model.AI writing disclosure
cc @AmineDiro
Note
Low Risk
Documentation and a self-contained example script only; no changes to TRL training or library APIs.
Overview
Adds
examples/scripts/openenv/opencode_hf_sandbox.py, a scale-out variant of the loop-owningopencodeAsyncGRPO example: each rollout runs in its own remote Hugging Face sandbox (HFSandboxBackend) instead of a local subprocess, with a pre-baked image default and optional cold-install via--sandbox-image.The script documents a two-URL setup—local
--vllm-urlfor the trainer (NCCL weight sync) and required public--sandbox-vllm-urlfor in-sandbox proxies—and wires the same DeepCoder held-out verifier, dense test-fraction reward, and trace-filtering hooks intoHarnessRolloutWorker.Docs:
example_overview.mdandopenenv.mdnow point readers to this example for multi-node rollout scaling.Reviewed by Cursor Bugbot for commit 0746667. Bugbot is set up for automated code reviews on this repo. Configure here.