Repository navigation
[Diffusion][sglang-miles] refactor: rollout controller as a scheduler-step plugin instead of mixins - #44239
Closed
Rockdu wants to merge 56 commits into
Closed
[Diffusion][sglang-miles] refactor: rollout controller as a scheduler-step plugin instead of mixins#44239Rockdu wants to merge 56 commits into
Rockdu wants to merge 56 commits into
Conversation
…nd pin SentencePiece for InternVL (sgl-project#41777) (sgl-project#41788) Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
…ty check to a warning (sgl-project#41681) (sgl-project#41802) Co-authored-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com> Co-authored-by: hnyls2002 <lsyincs@gmail.com>
…allel math (sgl-project#18639, sgl-project#30742) Co-authored-by: Xinyu Jiang <xinyuj2@andrew.cmu.edu>
…l-project#18642, sgl-project#36404) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…ject#22623) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gl-project#25141, sgl-project#29874, sgl-project#31251, sgl-project#32376) Co-authored-by: Yusheng Su <yushengsu.thu@gmail.com>
…lication (sgl-project#27268, sgl-project#31759, sgl-project#30913, sgl-project#30912, sgl-project#33299, sgl-project#36384, sgl-project#38165) Register adapter identities, stream their tensors within weight-update sessions, and publish checksum-verified fresh versions alongside generation. Preserve per-rank failure cleanup and request-prefix cancellation for adapter lifecycle management. Co-authored-by: Mathew Han <mathewjhan@gmail.com> Co-authored-by: Ethan (Yusheng) Su <yushengsu.thu@gmail.com> Co-authored-by: Yueming Yuan <yym022502@gmail.com>
…ism (sgl-project#21278, sgl-project#22663, sgl-project#33478) Expose rank topology for P2P weight mapping and create replicas using scoped runtime-context overrides. Restore the previous configuration on exit, including failed context entry. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: yueming-yuan <yym022502@gmail.com>
…capture + meta_info threading
…RL weight checks (sgl-project#29339) Co-authored-by: yueming-yuan <yym022502@gmail.com>
…30499, sgl-project#37466, sgl-project#37887) Co-authored-by: fzyzcjy <ch271828n@outlook.com> Co-authored-by: yueming-yuan <yym022502@gmail.com>
…ed weights into a host-local checkpoint (sgl-project#30366, sgl-project#28524)
…gl-project#27110, sgl-project#38718) Co-authored-by: Shi Dong <hello@dongshi.me>
…gl-project#27723) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: yueming-yuan <yym022502@gmail.com>
…educe-fusion auto-enable
…CL all-gather path (sgl-project#36110)
…tils (sgl-project#35127) Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Shi Dong <shi.dong@radixark.ai>
…weight checks (sgl-project#37649) Co-authored-by: Zhichenzzz <zczeng@uw.edu>
…ace in the weight checker (sgl-project#40028)
… blocks, mxfp8 fused indexer, NVFP4 input scales (sgl-project#43251)
…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>
…olloutController 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 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>
Rockdu
force-pushed
the
diffusion-rollout-plugin-sglang-miles
branch
2 times, most recently
from
October 14, 2026 19:55
ff395ad to
f9c8b7d
Compare
Rockdu
force-pushed
the
diffusion-rollout-plugin-sglang-miles
branch
4 times, most recently
from
October 14, 2026 23:21
83b0b6b to
c9f13ba
Compare
…ontroller Refactor-Kind: non_mechanical_provable Signed-off-by: rockdu <kangrdu@gmail.com>
Rockdu
force-pushed
the
diffusion-rollout-plugin-sglang-miles
branch
2 times, most recently
from
October 15, 2026 04:47
c6bf27e to
8d835f6
Compare
4 of 5 tasks
guapisolo
force-pushed
the
sglang-miles
branch
from
October 17, 2026 00:28
7b6993a to
9d86e91
Compare
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review guide
TL;DR: rollout stops being a scheduler mixin. It becomes a per-request controller (
FlowRolloutController) whosetransitionis passed toscheduler.step(..., transition=...). The denoising-stage mixin becomes three hook functions. Rollout numerics do not change.This is the
sglang-milesport of the same 11-commit chain prepared formain. ThatmainPR is not opened yet; this draft comes first for review. It supersedes the design in #37940 and credits @niehen6174 as co-author on the derived commits.mechanical_provable(refactor(move)): each reproduces byte-for-byte from its parent with themechanical-refactor-verifyprimitives, and the chain verifier passes (4/4 proofs). Skim them.non_mechanical_provable.Motivation
Rollout used to live inside the scheduler and the denoising stage as mixins (
SchedulerRLMixin,SchedulerRLDebugMixin,RolloutDenoisingMixin).step()branched onbatch.rollout, and every denoise loop recorded x_t itself. That shape cannot be plugged into a different loop or a second latent stream, such as the audio stream that comes next. After this PR, a rollout is a self-contained object that any loop can hand to any FlowMatch Eulerstep().Modifications
scheduler_rl_mixin.py->flow_rollout_controller.pySchedulerRLDebugMixinintoflow_rollout_controller.py_transitionRolloutSessionDataintoflow_rollout_controller.pyRolloutSessionData(explicitstep_index, retypeself)RolloutSessionDataRolloutSessionData-> per-requestFlowRolloutControlleronReq.rollout_controllers["visual"], holding the loop's sigma grid; dropSchedulerRLMixintransition=rollout_transition(batch)toscheduler.stepinstead of branching onbatchRolloutDenoisingMixin->prepare_rollout_if_enabled(build_controller=...)/init_rollout_env_if_enabled/finalize_rollout_if_enabled; the default builder constructs the controller frombatch.schedulerode_transition: a model with its own update (MiniMax H3, next PR) passes it for ODE steps;Nonekeeps the Euler updateHow it works now:
FlowMatchEulerDiscreteScheduler.step(..., transition=None)callstransition or self._transition. The scheduler instance is never patched, so stage-shared schedulers (Krea-2, Qwen-Image-Layered) stay safe. The existing fp32 upcast at the top ofstep()is untouched.FlowRolloutControlleris created once per request at the old prepare site, before the SP shard. It owns the noise buffer, log-probs, debug tensors, the trajectory, and its SP shard/gather closures.prepare_rollout_if_enabledbuilds it with_build_scheduler_rollout_controllerfor loops that step aFlowMatchEulerDiscreteScheduler; a loop with its own update and no scheduler (MiniMax H3, next PR) passes its ownbuild_controller(batch=, pipeline_config=), which also sets itsode_transition. No loop in this PR passes one.DenoisingStage, Cosmos3 and LTX-2 pass the transition at theirstep()call. LTX-2 drops its_step_index/_scheduler_step_kwargsworkaround. MiniMax H3 keeps its private rollout; moving it onto this plugin is the follow-up PR.sglang-miles-specific adaptations (everything else is identical to themainchain):sglang-miles's trajectory semantics: timesteps cover every step, latents followrollout_return_step_indices, andlatent_step_indicesis recorded. They now live inFlowRolloutController._maybe_append_dit_trajectory_stepandfinalize_rollout_if_enabled.sglang-mileshas noSigmaScheduleMixin,randn_tensoror_run_denoising_loop. The resolutions follow the base.test_timestep_filters_gate_sde_and_trajectoryasserted filtered timesteps, which does not matchsglang-miles's ownlatent_step_indiceschange. The base's circular import (below) hid this. The test is updated to the actual semantics.Accuracy Tests
This PR does not change outputs. One difference is intended: for models whose latents are bf16, the returned
dit_trajectory.latentsare now fp32. The values are unchanged, because x_t is recorded afterstep()'s own upcast. miles_diffusion casts trajectory latents to fp32 before use.GPU A/B of this branch (tip) against
sglang-mileson 8x H200: same seed, debug mode on, every returned tensor compared,dit_trajectory.sigmasincluded.miles_diffusion e2e on this
sglang-milesport (tip8d835f684c): every suite passed with no standard re-recorded (radixark/miles_diffusion#313, full run with--match-all-labels --continue-on-error).Unit tests
Run on
test_scheduler_rollout_unit.py,test_cosmos3_rollout.pyandtest_rollout_api.py:sglang-miles, two of these files fail at import with a pre-existing circular import (scheduler_rl_mixin<->schedule_batch).Checklist
CI States
Latest PR Test (Base): ❌ Run #38683323869
Latest PR Test (Extra): ❌ Run #38683323858
Latest PR Test (AMD ROCm 10): ❌ Run #38683323867