Skip to content

feat(profiling): add pluggable policy and vLLM rollout hooks - #3573

Draft
minitu wants to merge 4 commits into
mainfrom
codex/policy-rollout-profiler-hooks
Draft

feat(profiling): add pluggable policy and vLLM rollout hooks#3573
minitu wants to merge 4 commits into
mainfrom
codex/policy-rollout-profiler-hooks

Conversation

@minitu

@minitu minitu commented Aug 10, 2026

Copy link
Copy Markdown

Summary

  • Add opt-in profiler plugin contracts for Megatron policy workers and vLLM rollout workers.
  • Drive policy plugins around complete monolithic and split training updates, including finish, abort, and shutdown handling.
  • Drive rollout plugins around vLLM engine initialization and complete GRPO rollout attempts in both the legacy and TransferQueue trainers.
  • Run rollout plugins in the GPU-owning vLLM process for tensor-parallel and asynchronous engines, with lifecycle fanout from the owning NeMo RL actor.
  • Document installation, configuration, supported topology, and lifecycle behavior.

Motivation

Policy training and rollout generation execute in isolated Ray worker environments, so external profiling tools need stable worker-local lifecycle hooks. These interfaces allow profiler packages to integrate without patching NeMo RL or introducing a hard dependency on a specific profiler.

For TP>1 and asynchronous vLLM engines, the outer NeMo RL actor coordinates generation but does not launch the GPU kernels. The profiler therefore has to be constructed in every internal vLLM GPU worker rather than only in the outer actor.

User impact

Profiling remains disabled by default. When the selector environment variables are unset, NeMo RL does not import a profiler package and existing training and generation behavior is unchanged.

  • NRL_POLICY_PROFILER_CLASS selects a policy-training plugin.
  • NRL_ROLLOUT_PROFILER_CLASS selects a rollout plugin.
  • Rollout profiling supports tensor_parallel_size>=1, pipeline_parallel_size=1, and expert_parallel_size=1 with either synchronous or asynchronous vLLM engines.
  • The built-in NIXL vLLM worker composes with rollout profiling. Other custom vllm_kwargs.worker_cls values are rejected before engine creation.

The selected package must be installed in the corresponding Megatron policy-worker or vLLM generation-worker environment. For TP>1 and asynchronous engines, it must also be importable in vLLM's internal GPU-worker processes.

Validation

Qwen3-235B end-to-end golden workload

The ntrace nemo_rl_qwen3_235b golden was captured successfully on Lyris as job 2821136 using this PR's pre-rebase feature head, cd2b0a4a7abf9b8c4cc242f79cf34a7a09ba214e:

  • 17 nodes total: one dedicated CPU Ray head plus 16 GPU worker nodes.
  • 64 policy ranks with TP2 / PP4 / CP2 / EP16 / DP4.
  • TP8 / PP1 / EP1 asynchronous vLLM rollout with 8 rollout ranks.
  • Three training iterations with both policy and rollout profiler plugins enabled.
  • Capture postflight passed and emitted a schema-v2 manifest.
  • Strict parity passed across all six report surfaces used by the golden regression gate.

That exact feature commit was subsequently rebased onto current main; the post-rebase checks below validate the conflict resolutions. A fresh GPU run of the rebased SHA is not claimed here.

Post-rebase checks

  • Rebased onto main at 13a10647ebbf0f940d2b06ea41800b3f2fb46099 on 2026-09-02.
  • Ruff check and format --check passed for all 15 changed Python files.
  • Python syntax compilation and git diff --check passed.
  • 20 policy and rollout plugin-loader tests passed locally.
  • The Megatron policy lifecycle suites were collected but skipped because the local macOS environment does not provide megatron.bridge.
  • Local syntax and focused tests used Python 3.13.12 because a macOS arm64 build of the repository-pinned Python 3.13.14 was unavailable; CI remains authoritative for the pinned environment and backend-dependent coverage.

Earlier Lyris worker-environment checks

  • 27 rollout loader, initialization, rank-mapping, lifecycle, topology, sync/async dispatch, NIXL composition, and shutdown tests passed in the Lyris vLLM worker environment.
  • 4 focused GRPO rollout-boundary and conflict-resolution tests passed.
  • 10 policy plugin-loader tests passed in the Lyris Megatron worker environment; the dated image skipped the policy lifecycle module because it does not contain megatron.bridge from current main.

Fresh CI on the rebased SHA is the remaining qualification gate.

@copy-pr-bot

copy-pr-bot Bot commented Aug 10, 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.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Aug 10, 2026
@minitu minitu added the CI:L0 Run doctests and unit tests label Aug 10, 2026
@minitu

minitu commented Aug 10, 2026

Copy link
Copy Markdown
Author

/ok to test bdbbb19

@minitu

minitu commented Aug 10, 2026

Copy link
Copy Markdown
Author

/ok to test 1e9ef4b

@minitu
minitu force-pushed the codex/policy-rollout-profiler-hooks branch from 1e9ef4b to dbead9f Compare August 11, 2026 21:52
@minitu minitu changed the title feat(profiling): add pluggable policy and rollout profiling hooks feat(profiling): add pluggable policy and vLLM rollout hooks Aug 11, 2026
@minitu

minitu commented Aug 11, 2026

Copy link
Copy Markdown
Author

/ok to test dbead9f

@minitu
minitu force-pushed the codex/policy-rollout-profiler-hooks branch from dbead9f to e24c31f Compare August 11, 2026 21:59
@minitu

minitu commented Aug 11, 2026

Copy link
Copy Markdown
Author

/ok to test e24c31f

@minitu
minitu force-pushed the codex/policy-rollout-profiler-hooks branch from e24c31f to cd2b0a4 Compare August 11, 2026 22:17
@minitu minitu added CI:L1 Run doctests, unit tests, and functional tests and removed CI:L0 Run doctests and unit tests labels Aug 11, 2026
@minitu

minitu commented Aug 11, 2026

Copy link
Copy Markdown
Author

/ok to test cd2b0a4

Signed-off-by: Jaemin Choi <jaeminc@nvidia.com>
Signed-off-by: Jaemin Choi <jaeminc@nvidia.com>
Signed-off-by: Jaemin Choi <jaeminc@nvidia.com>
Signed-off-by: Jaemin Choi <jaeminc@nvidia.com>
@minitu
minitu force-pushed the codex/policy-rollout-profiler-hooks branch from cd2b0a4 to 26c84f9 Compare September 2, 2026 23:07
@minitu

minitu commented Sep 2, 2026

Copy link
Copy Markdown
Author

/ok to test 26c84f9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant