Skip to content

[Refactor] diffusion: Rollout controller as a scheduler-step plugin instead of mixins - #44603

Merged
niehen6174 merged 20 commits into
mainfrom
rockdu/diffusion-rollout-plugin
Oct 21, 2026
Merged

niehen6174 merged 20 commits into
mainfrom
rockdu/diffusion-rollout-plugin

Conversation

@Rockdu

@Rockdu Rockdu commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Rollout stops being a scheduler / denoising-stage mixin: each latent stream of a rollout request gets a FlowRolloutController whose transition the loop passes into scheduler.step. Serving is untouched; rollout numerics do not change.

It supersedes the design in #37940; @niehen6174 is co-author on the derived commits. @JingwenGu0829 found the issues fixed in commits 13 and 14 (Rockdu#4) and is co-author on commits 13 to 15.

How it works

  • FlowMatchEulerDiscreteScheduler.step(..., transition=None) runs transition or self._transition. Loops pass **rollout_step_kwargs(batch), which is empty for serving requests, so every scheduler keeps its serving call.
  • Hooks in rollout_hooks.py: prepare_rollout_if_enabled (before the SP shard), init_rollout_env_if_enabled, rollout_step_kwargs, finalize_rollout_if_enabled; all no-ops for serving.
  • Wired into generic DenoisingStage, Cosmos3 and LTX-2. A loop without a scheduler (MiniMax H3, next PR) passes its own build_controller and ode_transition.

The RL model support in SGLang diffusion will then be like:
421f8b37-eb77-43d6-89ad-92917928f9ac

Review guide

Commits 2, 3, 4 and 6 are mechanical moves verified by the chain verifier (4/4 proofs) and commit 1 is a pure rename; skim them. Review commits 5, 7 to 11 and 13 to 15.

Tests

  • GPU A/B against main (8x H200, SP 1 and 2, every returned tensor): Qwen-Image and Cosmos3 are bitwise identical; LTX-2.3 trajectory and log-probs are bitwise identical (its audio decode is nondeterministic on main too). The only intended change: bf16 models now return fp32 dit_trajectory.latents with the same values. The A/B predates commits 13 to 15, which the e2e below covers.
  • miles-diffusion full e2e on sglang-miles plus this chain: every suite passes, bitwise equal to its standard.
  • Rollout unit tests: 68 passed.

Checklist


CI States

Latest PR Test (Base): ✅ Run #39336833020
Latest PR Test (Extra): ❌ Run #39336832991
Latest PR Test (AMD ROCm 10): ❌ Run #39336833006

…troller.py

Pure file rename (git R100); the proof tool has no file-rename primitive.

Refactor-Kind: non_mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
…er.py

Refactor-Kind: mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
Refactor-Kind: mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
Refactor-Kind: mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
… RolloutSessionData

Refactor-Kind: non_mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
Refactor-Kind: mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
@github-actions github-actions Bot added the diffusion SGLang Diffusion label Oct 15, 2026
@Rockdu
Rockdu force-pushed the rockdu/diffusion-rollout-plugin branch from 5a3eb3b to 5d8d7c0 Compare October 15, 2026 23:49
Rockdu and others added 5 commits October 15, 2026 16:53
…lloutController and drop SchedulerRLMixin

Refactor-Kind: non_mechanical_provable
Signed-off-by: rockdu <kangrdu@gmail.com>
…stead of branching on batch

Refactor-Kind: non_mechanical_provable
Co-authored-by: WenhaoZhang <42087078+niehen6174@users.noreply.github.com>
Signed-off-by: rockdu <kangrdu@gmail.com>
… of the denoise loops

Refactor-Kind: non_mechanical_provable
Co-authored-by: WenhaoZhang <42087078+niehen6174@users.noreply.github.com>
Signed-off-by: rockdu <kangrdu@gmail.com>
… hook functions

Refactor-Kind: non_mechanical_provable
Co-authored-by: WenhaoZhang <42087078+niehen6174@users.noreply.github.com>
Signed-off-by: rockdu <kangrdu@gmail.com>
…ontroller

Refactor-Kind: non_mechanical_provable
Co-authored-by: WenhaoZhang <42087078+niehen6174@users.noreply.github.com>
Signed-off-by: rockdu <kangrdu@gmail.com>
… miles-diffusion

Refactor-Kind: non_mechanical_provable

Signed-off-by: rockdu <kangrdu@gmail.com>
@Rockdu
Rockdu marked this pull request as ready for review October 17, 2026 00:56
@github-actions

This comment has been minimized.

@Rockdu
Rockdu force-pushed the rockdu/diffusion-rollout-plugin branch from 0bb53ce to 3567900 Compare October 17, 2026 03:42
@github-actions

This comment has been minimized.

… keep trajectory timesteps on device

Refactor-Kind: non_mechanical_provable
Co-authored-by: Kangrui Du <89372739+Rockdu@users.noreply.github.com>
Co-authored-by: JingwenGu0829 <75733630+JingwenGu0829@users.noreply.github.com>
Signed-off-by: rockdu <kangrdu@gmail.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Rockdu
Rockdu force-pushed the rockdu/diffusion-rollout-plugin branch from 9cf7390 to e3354ce Compare October 17, 2026 07:25
@github-actions

This comment has been minimized.

@Rockdu Rockdu changed the title [Diffusion] refactor: rollout controller as a scheduler-step plugin instead of mixins [Diffusion] post-training: rollout controller as a scheduler-step plugin instead of mixins Oct 17, 2026
@Rockdu Rockdu changed the title [Diffusion] post-training: rollout controller as a scheduler-step plugin instead of mixins [Refactor] diffusion: Rollout controller as a scheduler-step plugin instead of mixins Oct 17, 2026
@Rockdu Rockdu changed the title [Refactor] diffusion: Rollout controller as a scheduler-step plugin instead of mixins [Refactor] diffusion RL: Rollout controller as a scheduler-step plugin instead of mixins Oct 17, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Rockdu
Rockdu force-pushed the rockdu/diffusion-rollout-plugin branch from c06bf48 to 30056b9 Compare October 17, 2026 09:35
@github-actions

This comment has been minimized.

@Rockdu
Rockdu force-pushed the rockdu/diffusion-rollout-plugin branch 2 times, most recently from c06bf48 to 5cd64bd Compare October 17, 2026 09:45
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AgainstEntropy

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 18, 2026
@Rockdu Rockdu changed the title [Refactor] diffusion RL: Rollout controller as a scheduler-step plugin instead of mixins [Refactor] diffusion: Rollout controller as a scheduler-step plugin instead of mixins Oct 18, 2026
# Conflicts:
#	python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/cosmos3.py

@niehen6174 niehen6174 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@niehen6174
niehen6174 merged commit 6cac4dc into main Oct 21, 2026
144 of 154 checks passed
@niehen6174
niehen6174 deleted the rockdu/diffusion-rollout-plugin branch October 21, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants