Repository navigation
fix(scicode): run sub-steps in the resources server process, not a Ray worker - #1937
Merged
Merged
Conversation
…y worker verify() dispatched each sub-step to a ray.remote worker running subprocess.run([sys.executable, ...]). That worker's interpreter is whatever Python the Ray cluster runs, which need not have SciCode's scientific deps (h5py/scipy/numpy/sympy). In a split deployment (vLLM + Ray head in one container, the resources server joining that cluster) every sub-step dies at 'import h5py' and reward is always 0. Run the sub-step in the resources server's own process via the thread-pool executor, so the subprocess uses this server's interpreter (its venv has the deps). Drop the now-unused run_substep_remote wrapper and ray import; retarget the verify() tests at run_substep. Signed-off-by: laszkiewiczp <85294967+laszkiewiczp@users.noreply.github.com>
fsiino-nvidia
approved these changes
Jul 7, 2026
laszkiewiczp
enabled auto-merge (squash)
July 8, 2026 07:25
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.
Problem
SciCode's
verify()dispatches each sub-step to aray.remoteworker that runssubprocess.run([sys.executable, "-c", program]). The worker'ssys.executableis whatever Python the Ray cluster runs — which is not guaranteed to be the SciCode resources server's venv, the only one with SciCode's scientific deps (h5py,scipy,numpy,sympy,matplotlib).In a split deployment — vLLM + the Ray head in one container, the resources server joining that cluster via
ray_head_node_address=auto— the sub-step lands on a worker whose interpreter lacks those deps, so every generated program dies atimport h5pyandmean/rewardis stuck at 0 even though the model's answers are fine.Fix
Execute the sub-step in the resources server's own process via the thread-pool executor instead of shipping it to a Ray worker:
The resources server process already runs the SciCode venv, so
run_substep'ssubprocess.run([sys.executable, ...])now uses the interpreter that has the deps. Concurrency is unchanged — still bounded by the existingnum_processessemaphore, andsubprocess.runreleases the GIL. The now-unusedrun_substep_remote/import rayare removed and theverify()tests retargetrun_substep.Validation
Ran the full SciCode benchmark end-to-end on a split (vLLM + separate resources) deployment. Before this change every sub-step failed at
import h5pyand reward was 0; after, sub-steps execute in the resources-server venv andsubtask_accuracylands in line with the NeMo-Skills SciCode reference. Unit tests updated and passing.Alternative considered
Keeping the Ray task but pinning its interpreter (or a
runtime_env) to the resources-server venv also works, but relies on that venv path being valid on every Ray worker (fragile across nodes/containers). Running in-process removes the ambient-interpreter assumption entirely; SciCode sub-steps are short, timeout-bounded subprocesses, so single-node execution is sufficient.