← Back to Pull requests

[rollout, vllm, ray] feat: isolate standalone rollout Python runtime #8407

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Oct 28, 2026 01:23 UTC
Author

What does this PR do?

Add an opt-in actor_rollout_ref.rollout.runtime descriptor for a pre-provisioned Python interpreter. A training-only environment can launch standalone vLLM HTTP actors, backend children, and rollout checkpoint workers in a separate environment without importing vLLM on the controller. Leaving it unset preserves the shared-runtime path.

This implements an initial slice of #8388: V1 separate_async, CUDA, FSDP2, vLLM and NCCL, with hybrid switching disabled. Python, Ray, PyTorch and verl sources must match; arbitrary mixed core versions, PD, colocated/hybrid workers, and teacher/reward runtime overrides remain outside this change.

Checklist Before Starting

  • Searched open PRs mentioning #8388 and runtime environment work. No open PR implements this role-interpreter boundary. #7312 adds trainer worker environment variables; #7840 targets neo with a backend-neutral worker runtime. Neither provides this standalone vLLM Python environment selection.

  • Title follows the module/type format.
  • Test

    Ownership follow-up (360e29b): replaced the temporary factory task with a retained, non-detached launcher actor. Both launcher and native server are tied to controller/job lifetime. This revision was validated on macOS/arm64, Python 3.12.13, Ray 2.55.1 and PyTorch 2.13.0:

    .venv-review/bin/python -m pytest -q \
      tests/workers/rollout/test_rollout_runtime_on_cpu.py \
      tests/workers/rollout/test_runtime_owner_on_cpu.py \
      tests/workers/config/test_rollout_config_on_cpu.py
    # 44 passed; includes real Ray controller/launcher/server ownership,
    # same-name collision preservation, failure/cancellation cleanup,
    # controller teardown with borrowed handles and detached job defaults.
    
    pre-commit run --all-files
    # All 14 hooks passed.
    

    The GPU and application results below were collected at 55c61de, before the ownership follow-up. GPU integration has not been rerun on 360e29b.

    Server: 2 × RTX 3090 24 GB, Python 3.12.3, Ray 2.55.1, PyTorch 2.13.0+cu130; rollout vLLM 0.32.0. Separate locked uv environments; training environment has no vLLM installed.

    train-env/bin/python -m pytest -q \
      tests/workers/rollout/test_rollout_runtime_on_cpu.py \
      tests/workers/config/test_rollout_config_on_cpu.py
    # 43 passed, including a real Ray task launched in a separate virtualenv.
    
    rollout-env/bin/python -m pytest -q \
      tests/workers/rollout/test_vllm_cli_args_on_cpu.py \
      tests/workers/rollout/test_vllm_pd_disaggregation_on_cpu.py \
      tests/workers/rollout/rollout_vllm/test_submitter_gate_on_cpu.py \
      tests/utils/test_vllm_weight_name_normalization_on_cpu.py
    # 128 passed.
    
    VLLM_ISOLATED_PYTHON=/absolute/rollout-env/bin/python \
    VLLM_ISOLATED_MODEL_PATH=/absolute/tiny-qwen3 \
      train-env/bin/python -m pytest -q -s \
      tests/workers/rollout/rollout_vllm/test_isolated_runtime.py
    # 1 passed: real FSDP2 optimizer, NCCL sync, changed generation/logprob,
    # checkpoint save/reload and restored output; missing-vLLM preflight fails early.
    
    pre-commit run --all-files
    # All 14 hooks passed.
    

    Additional application check: Qwen3-0.6B (revision c1899de289a04d12100db370d81485cdf75e47ca), one FSDP2 training GPU and one TP=1 rollout GPU, GRPO batch 4 / n=2 / response length 16 / lr=1e-5, synthetic prompts and deterministic synthetic rewards. Two optimizer steps completed with checkpoints and weight synchronization:

    | Step | Gradient norm | Weight-sync seconds |
    | --- | ---: | ---: |
    | 1 | 8.815419 | 1.358 |
    | 2 | 7.831224 | 1.345 |
    | 3 (cold restart) | 15.106471 | 1.355 |

    Training peak tensor allocation was 11.12 GiB. Two-second device-memory samples peaked at 13,097 MiB (training) and 6,762 MiB (rollout). The full job logged an ignored DataLoader-worker atexit warning after reaching 2/2 steps. A fresh Ray job restored step 2 model/optimizer/RNG/LR-scheduler/dataloader and queued prompt groups, then completed step 3 (exit code 0); it also logged an exit-time DataLoader-worker warning.

    These are functional correctness checks on small workloads, not throughput or convergence benchmarks.

    API and Usage Example

    actor_rollout_ref:
      hybrid_engine: false
      actor:
        strategy: fsdp2
      rollout:
        name: vllm
        checkpoint_engine:
          backend: nccl
        runtime:
          py_executable: /opt/verl/rollout/bin/python
          env_vars: {}
          startup_timeout: 300.0
    trainer:
      use_v1: true
      v1:
        trainer_mode: separate_async
        separate_async:
          hybrid_rollout:
            enable_switch: false
    ray_kwargs:
      ray_init:
        runtime_env:
          py_executable: /opt/verl/train/bin/python
    

    See docs/advance/isolated_rollout_runtime.md for provisioning, precedence and unsupported topologies.

    Design & Code Changes

  • Move the replica controller out of the package that eagerly imports vLLM, retaining the old import as an alias.

  • Resolve interpreter/env overlays while preserving inherited Ray code distribution and profiler settings. Keep checkpoint-worker device visibility and framework-assigned rank/device variables.

  • Probe each selected rollout node for matching core/source identity and backend imports before creating checkpoint workers or loading weights.

  • Create the existing native HTTP actor through a retained, job-scoped launcher actor in the selected runtime and return its native ActorHandle. Preserve async methods and existing weight-transfer semantics.

  • Bound asynchronous startup and clean up known actors/groups owned by the failed launch. Killing its launcher also handles a lost server handle without looking up or killing a foreign named actor. Controller/job teardown terminates both non-detached actors.

  • Add CPU coverage, a two-environment/two-GPU integration test, CI wiring and documentation.
  • Checklist Before Submitting

  • Read the contribution guide.

  • Applied pre-commit checks.

  • Added documentation.

  • Added CPU and GPU CI coverage.

  • Requested project GPU CI in the community channel.
  • AI assistance: implementation, code review, and the reported experiments used OpenAI Codex. The test results above are agent-run.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Levius-Fubuki Review duration: 49256m
    All Vouch review confidence checks passed
    Residual risk 0.38 = Change Risk (0.64) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.64 · 650 lines diff across 8 files
    0.64
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #8407"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 40.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 64% (MEDIUM) · Higher = larger blast radius
    64%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 37.8% · Moderate risk
    37.8%