Skip to content

feat: length-aware rollout scheduling for cross-DP generation - #4007

Draft
zaifengp-maker wants to merge 18 commits into
NVIDIA-NeMo:mainfrom
zaifengp-maker:zaifengp/prototype-lfs
Draft

zaifengp-maker wants to merge 18 commits into
NVIDIA-NeMo:mainfrom
zaifengp-maker:zaifengp/prototype-lfs

Conversation

@zaifengp-maker

Copy link
Copy Markdown

What does this PR do ?

Schedules rollout requests by predicted output length instead of FCFS, so a cross-DP generation wave is not held open by one long straggler.

Within a wave, requests are admitted and placed across DP replicas by a length
estimate rather than arrival order. The PR also carries the tracing and
profiling used to evaluate the idea.

  • nemo_rl/models/generation/vllm/lfs/ — the admission and cross-DP dispatch
    package: scheduler, dispatcher, per-engine schedulers, concurrency cap,
    group state, validation, diagnostics.
  • vllm_step_trace.py — per-step engine trace.
  • model_step_gpu_profiler.py — bounded Nsight capture around model steps.
  • nested_runtime_env.py / ray_executor.py — propagate a runtime env into
    vLLM's Ray workers without mutating vLLM sources.
  • inflight_profiler.py, vllm_metric_sampler.py — in-flight rollout and
    DP-batch statistics.
  • forced_sequence_logits_processor.py — deterministic sequence replay, used
    to make scheduling experiments reproducible.

plus the corresponding changes in vllm_generation, vllm_worker,
vllm_worker_async, vllm_backend, grpo, rollouts, async_utils and
dapo_math, and 19 unit tests.

Issues

None filed yet. Happy to open one to hold the design discussion if that is
preferred over discussing it here.

Usage

LFS is off by default; generation behavior is unchanged unless it is enabled.
It is currently driven by environment variables rather than config keys:

# Cross-DP admission mode. Off unless set.
#   fcfs | lfs | predicted_lfs | history_lfs | oracle_probe_lfs | exact_length_lpt
NRL_VLLM_CROSS_DP_SCHED=lfs

# Single-engine length-grouped admission (independent of the cross-DP path)
NRL_VLLM_LFS_SCHED=1
NRL_VLLM_LFS_SCHED_G=16          # group size

The one config key added is for the tracing facility, not the scheduler:

policy:
  generation:
    vllm_cfg:
      enable_vllm_step_trace: true   # read-only per-step batch composition

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests? — 19 unit tests under tests/unit/models/generation/vllm/
  • Did you run the unit tests and functional tests locally? — no. Not run against this branch.
  • Did you add or update any necessary documentation? — no. Not written yet, pending direction on whether this belongs in tree.

kajalj22 and others added 18 commits April 13, 2026 21:50
…2261) (NVIDIA-NeMo#2262)

Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…IDIA-NeMo#2257)

Signed-off-by: Yuki Huang <yukih@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Yuki Huang <yukih@nvidia.com>
…A-NeMo#2235) (NVIDIA-NeMo#2263)

Signed-off-by: oliver könig <okoenig@nvidia.com>
Co-authored-by: oliver könig <okoenig@nvidia.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…nto r0.6.0 (NVIDIA-NeMo#2266)

Signed-off-by: Terry Kong <terryk@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Terry Kong <terryk@nvidia.com>
Signed-off-by: ruit <ruit@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Rayen <ruit@nvidia.com>
Signed-off-by: Yuki Huang <yukih@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Yuki Huang <yukih@nvidia.com>
…`r0.6.0` (NVIDIA-NeMo#2288)

Signed-off-by: Terry Kong <terryk@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Terry Kong <terryk@nvidia.com>
…sues from QA (NVIDIA-NeMo#2290)

Signed-off-by: anwithk <anwithk@nvidia.com>
Signed-off-by: Terry Kong <terryk@nvidia.com>
Co-authored-by: Anwith Kiran <anwithk@nvidia.com>
….0` (NVIDIA-NeMo#2308)

Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: kajalj22 <kajalj@nvidia.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…r0.6.0` (NVIDIA-NeMo#2311)

Signed-off-by: Yuki Huang <yukih@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Yuki Huang <yukih@nvidia.com>
…o `r0.6.0` (NVIDIA-NeMo#2307)

Signed-off-by: Terry Kong <terryk@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Terry Kong <terryk@nvidia.com>
…IA-NeMo#2313)

Signed-off-by: Aditya Vavre <avavre@nvidia.com>
Signed-off-by: adityavavreNVDA <avavre@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: adityavavreNVDA <avavre@nvidia.com>
Co-authored-by: Terry Kong <terryk@nvidia.com>
…VIDIA-NeMo#2317)

Signed-off-by: Guyue Huang <guyueh@login-lyris02.lyris.clusters.nvidia.com>
Signed-off-by: Guyue Huang <guyueh@nvidia.com>
Signed-off-by: Guyue Huang <140554423+guyueh1@users.noreply.github.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Guyue Huang <140554423+guyueh1@users.noreply.github.com>
Co-authored-by: Guyue Huang <guyueh@login-lyris02.lyris.clusters.nvidia.com>
Signed-off-by: Guyue Huang <guyueh@nvidia.com>
Signed-off-by: Guyue Huang <guyueh@login-lyris02.lyris.clusters.nvidia.com>
Signed-off-by: Guyue Huang <140554423+guyueh1@users.noreply.github.com>
Co-authored-by: Guyue Huang <guyueh@login-lyris02.lyris.clusters.nvidia.com>
)

Signed-off-by: Guyue Huang <guyueh@login-lyris02.lyris.clusters.nvidia.com>
Signed-off-by: Guyue Huang <140554423+guyueh1@users.noreply.github.com>
Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Co-authored-by: Guyue Huang <guyueh@login-lyris02.lyris.clusters.nvidia.com>
Co-authored-by: Kajal Jain <kajalj@nvidia.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…Mo#2364)

Signed-off-by: Guyue Huang <guyueh@nvidia.com>
Signed-off-by: Guyue Huang <140554423+guyueh1@users.noreply.github.com>
Signed-off-by: Parth Mannan <pmannan@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Guyue Huang <140554423+guyueh1@users.noreply.github.com>
Co-authored-by: Parth Mannan <pmannan@nvidia.com>
…tion

Publishable subset of the LFS prototype, rebuilt on the v0.6.0 tag so it
carries no site-specific state.

What this adds
--------------
  nemo_rl/models/generation/vllm/lfs/   admission + cross-DP dispatch package
                                        (scheduler, dispatcher, engine
                                        schedulers, concurrency cap, group
                                        state, validation, diagnostics)
  vllm_step_trace.py                    per-step engine trace
  model_step_gpu_profiler.py            bounded Nsight capture of model steps
  nested_runtime_env.py / ray_executor.py
                                        runtime-env propagation into vLLM's
                                        Ray workers without source mutation
  inflight_profiler.py, vllm_metric_sampler.py
                                        in-flight rollout + DP batch stats
  forced_sequence_logits_processor.py   deterministic sequence replay

plus the corresponding changes in vllm_generation / vllm_worker /
vllm_worker_async / vllm_backend, grpo, rollouts, async_utils and dapo_math,
and 19 unit tests.

What was left out, and why
--------------------------
The research harness (length-predict/, 401 files) and the tests that drive it
are not included. Its reference results embed the identity of the machines
that produced them -- node hostnames, scheduler job ids, per-user filesystem
paths -- and it also carries four third-party papers as PDFs. None of that
belongs in a source tree, and none of it is needed to read or run the
scheduler.

The perf scripts under scripts/ defaulted to one user's filesystem and one
Slurm account. They now take WORK_DIR and SLURM_ACCOUNT as required inputs
rather than defaulting, so a misconfigured run fails at submission instead of
writing somewhere unintended.

One thing to know: the LFS dispatcher records os.uname().nodename into its
diagnostic events, so diagnostics collected from a run carry hostnames. That
is useful when debugging cross-node placement, but it means diagnostic output
needs the same scrub as any other artifact before it is published.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 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 Documentation Improvements or additions to documentation CI Relating to CI labels Sep 4, 2026

This branch has not been deployed

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

Labels

CI Relating to CI community-request Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants