Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

validator: isolate hidden-eval in a subprocess so a CUDA fault can't crash the validator - #61

Closed
gho11123 wants to merge 2 commits into
RalphLabsAI:mainfrom
gho11123:fix/isolate-eval-subprocess
Closed

validator: isolate hidden-eval in a subprocess so a CUDA fault can't crash the validator#61
gho11123 wants to merge 2 commits into
RalphLabsAI:mainfrom
gho11123:fix/isolate-eval-subprocess

Conversation

@gho11123

Copy link
Copy Markdown
Contributor

Problem (observed in production)

A validator core-dumped while scoring a submitted bundle:

[op4] S3 forward — loading checkpoint.pt (124.2M params) → cuda:0
CUDA error: an illegal memory access was encountered
terminate called after throwing an instance of 'c10::Error'
Fatal Python error: Aborted (core dumped)

Call path: run_epoch → (score) → run_hidden_eval → compute_val_bpb → model.forward → F.linear.

The hidden-eval runs a submitted checkpoint's forward in-process. A fatal CUDA fault there is a C++ terminate()SIGABRT, which Python cannot catch — so the entire validator process dies and judging halts until a manual restart. One submission is enough to take the validator down.

Fix — process isolation (reuse the pattern already in the tree)

_patched_hidden_eval already runs the eval in a subprocess via eval_in_workdir.py. This PR generalizes that to every checkpoint forward:

  • Extract the spawn + result-parse into _run_eval_subprocess(workdir, ckpt_path, ralph_root, label).
  • Route the canonical op4_hidden_eval path through it (workdir = RECIPE_DIR), not just the patched path.
  • A child crash (non-zero exit, incl. a SIGABRT core dump) or timeout(False, reason, None) → the bundle is rejected and the validator keeps running.
  • The in-process CPU load_state_dict stays, so a structural-patch shape mismatch still routes to _patched_hidden_eval.

Behavior-preserving for the patched path (the label reproduces its exact messages); the only happy-path change is that the canonical forward now runs in a child.

Tests

tests/test_eval_subprocess_isolation.py: a non-zero child exit (core dump) and a timeout are caught as rejections; a valid RALPH_EVAL_RESULT line parses into a HiddenEvalResult.

🤖 Generated with Claude Code

gho11123 and others added 2 commits June 25, 2026 18:49
…crash the validator

op4_hidden_eval ran the canonical checkpoint's forward IN-PROCESS. A fatal CUDA
fault there (e.g. an illegal memory access from a malformed/degenerate checkpoint)
raises a C++ terminate -> SIGABRT that Python cannot catch, so the entire
validator process core-dumps and judging halts until a manual restart. One
submitted checkpoint can take the validator down (observed in production).

Extract the subprocess spawn+parse the patched path already uses into
_run_eval_subprocess(workdir, ckpt_path, ralph_root, label), and route BOTH the
canonical op4 path (workdir = canonical RECIPE_DIR) and _patched_hidden_eval
(workdir = patched copy) through it. A child crash (non-zero exit incl. SIGABRT)
or timeout returns (False, reason, None) -> the bundle is rejected and the
validator survives. The in-process CPU load_state_dict stays so a structural
shape mismatch still routes to the patched path. Behavior-preserving for the
patched path (label reproduces its exact messages).

tests/test_eval_subprocess_isolation.py: a non-zero child exit (core dump) and a
timeout are caught as rejections; a valid result line parses.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
After routing both eval paths through _run_eval_subprocess, the top-level
eval.run_hidden_eval import and the subprocess import inside _patched_hidden_eval
are no longer referenced (the helper imports subprocess itself). Removes both to
satisfy ruff.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bitzic bitzic closed this Jun 28, 2026
bitzic added a commit that referenced this pull request Jun 28, 2026
validator: subprocess-isolate op4 canonical eval (corrected #61)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants