Repository navigation
Conversation
6 tasks done
This was referenced Oct 19, 2026
zhihengy
marked this pull request as ready for review
October 24, 2026 00:46
zhihengy
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
kevin-mii,
mickqian,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 24, 2026 00:46
This comment has been minimized.
This comment has been minimized.
Rockdu
requested review from
CatherineSue,
JustinTong0323,
Qiaolin-Yu,
Ying1123,
hnyls2002,
key4ng,
merrymercy and
slin1237
as code owners
October 31, 2026 06:31
Rockdu
requested review from
1am9trash,
ByronHsu,
DarkSharpness,
Duyi-Wang,
HydraQYH,
ShangmingCai,
YAMY1234,
celve,
hebiao064,
hubertlu-tw,
kkHuang-amd,
rainj-me,
sogalin,
wisclmy0611 and
zijiexia
as code owners
October 31, 2026 06:31
guapisolo
force-pushed
the
sglang-miles
branch
from
November 1, 2026 02:54
29b34bc to
b0ed761
Compare
6 tasks done
Rockdu
force-pushed
the
dmd2/few-step-stop
branch
from
November 5, 2026 08:05
996dec8 to
0544736
Compare
This comment has been minimized.
This comment has been minimized.
Rockdu
reviewed
Nov 5, 2026
| ) | ||
| timesteps = scheduler.timesteps | ||
|
|
||
| if batch.rollout and batch.rollout_stop_step_index is not None: |
Collaborator
There was a problem hiding this comment.
let's integrate this part into our pluggable rollout controller if possible
3 of 5 tasks
…ut hook, not the timestep stages Review on sgl-project#45230 asked for the stop to live in the pluggable rollout layer. `prepare_rollout_if_enabled` now cuts `batch.scheduler` and `batch.timesteps` to steps 0..i plus the terminal sigma before it builds the controller, and still rejects a controller on an uncut grid. The base denoising loop calls the hook before it reads the schedule, so the warmup, boundary and cache-dit step counts follow the stop; Cosmos3 reads its timesteps after the hook for the same reason. The two timestep stages go back to their serving-only code and dedup fingerprints. MiniMax H3's loop runs on its own video/audio grids: `minimax_h3_rollout_sigmas` joins H3's other rollout helpers and cuts both grids where the full loop resolves them. Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
Merged
4 tasks done
Open
2 of 39 tasks
This branch has not been deployed
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.
Motivation
DMD2 distillation in miles-diffusion (radixark/miles_diffusion#331) trains the few-step student at a random step
i, on an input the student generated itself (backward simulation). One rollout has to return the student's inputx_{σ_i}and its x0 predictionx̂0_i, and the steps afteriare wasted work.The rest of the sampler already exists here: with
rollout_sde_type="cps"androllout_noise_level=1.0, each step re-noises its x0 prediction with fresh noise,x_next = (1-σ') x̂0 + σ' ε, which is the DMD2 multi-step sampler. The only missing piece is stopping at stepi.Modifications
RolloutRequest/SamplingParams: newrollout_stop_step_index, defaultNone(no behavior change).truncate_rollout_sigmas(rollout_scheduler.py): keeps steps0..iof a sigma grid and appends the terminal sigma,sigmas[:i+1] + sigmas[-1:]. Stepithen goes straight to σ=0, where bothcpsandodereturnx̂0exactly, and the engine runsi+1DiT forwards instead ofN. Anioutside the schedule is rejected. It takes a scheduler's tensor or a plain list.prepare_rollout_if_enabled(rollout_hooks.py): for a rollout request with a stop, cutsbatch.schedulerthrough the helper (truncate_rollout_schedule: the sigmas, andtimesteps[:i+1]) and republishesbatch.timesteps, before it builds the controller. The timestep stages stay rollout-agnostic, with their dedup fingerprints unchanged. The hook then rejects a controller whose sigma grid is not thei+2-point stopped grid: a loop that hands the hook its own controller must build it on the cut schedule, or it would return a full rollout as if it had stopped.DenoisingStage._prepare_denoising_loopcalls the hook right after it takesbatch.scheduler, before it readsbatch.timesteps, so the warmup, MoE boundary and cache-dit step counts follow the stopped schedule.Cosmos3DenoisingStagereadsbatch.timestepsafter its hook call for the same reason. LTX-2 does not call the hook and does not get the stop.batch.scheduler:minimax_h3_rollout_sigmas(minimax_h3_rollout.py, next to H3's other rollout helpers) cuts both grids alike, and_run_full_loopapplies it right after it resolves the grids, so the cache-dit step count, the progress bar, the loop and the trajectory collector all see the cut grids. The PDD check in H3's timestep stage still validates the full grid.SamplingParamsfield withoutbatch_sig_exclude, so it is in the batch signature.The stop is a schedule cut before the loop, done by the rollout hook rather than inside the controller's
transition: the controller only replaces the update insidescheduler.step, after that step's DiT forward, while the loops derive their step counts from the schedule up front. diffusers stops early the same way (denoising_endin the SDXL pipeline cuts the timesteps before the loop).num_inference_stepskeeps the requestedN; only the progress bar and the cache-dit step count read it.With the existing
rollout_return_step_indices=[i, i+1], the trajectory holdsx_{σ_i}followed byx̂0_i, so no response field is added.Accuracy Tests
FLUX.2-klein-base-4B, 1×B200, 512², 4 steps,
cps/ noise level 1.0, guidance 1, debug tensors on, at the head commit 996dec8. Each stopped rollout is compared with a full 4-step rollout that uses the same seed:ilatent_step_indicesx_{σ_i}vs full runx_i - σ_i·v_i(bf16)Without the field, a full rollout at the head is bitwise equal to
sglang-milesbff3f6a: latents, sigmas, model outputs and the decoded image.MiniMax-H3 (t2va, 2×B200 TP2, 768p 16:9 4 s, 4 steps, flow shift 12 / audio shift 3, seed 1234; at 22f93b5): for
odeandcps(noise level 1.0) and every stopiin 0..3, the returned σ is the full grid's[:i+1] + [0],x_{σ_i}is bitwise equal to the full run, and the server runsi+1denoise steps. Withode, the full run'sx_{i+1}replayed from the stopped x0 is bitwise equal. H3'scpsfloors the predicted-noise weight atsqrt(1e-12), so its x0 differs fromode's by up to 5.25e-6. Without the field, fullode/cpslatents and sigmas are bitwise equal to 077b40c.These GPU runs predate the last commit, which moves the cut from the timestep stages into the rollout hook (and, for H3, into its rollout helpers). The loops receive the same stopped schedule as before, which the unit tests pin; the GPU runs were not repeated.
Tests
test_scheduler_rollout_unit.py:batch.timestepsand the controller's grid to steps0..iplus the terminal sigma, and a later request on the same scheduler runs in full. A controller built on an uncut grid is rejected (the case fails without the check).test_rollout_api.py: the field is forwarded to the sampling params.test_cosmos3_rollout.py,test_minimax_h3_denoise_loop.py,test_timestep_preparation_logging.py,test_cosmos3.pyandtest_minimax_h3_pdd_offline.pypass (167 tests).pre-commit runon the changed files is clean. Validation was run locally.CI States
Latest PR Test (Base): ❌ Run #42755185399
Latest PR Test (Extra): ❌ Run #42755185255
Latest PR Test (AMD ROCm 10): ❌ Run #42755185256
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: