Repository navigation
[cherrypick from #40986] [Sampling] Stream sampling masks as per-request arrays - #41270
Merged
yueming-yuan merged 1 commit intoSep 26, 2026
Conversation
nanjiangwill
marked this pull request as ready for review
September 25, 2026 19:36
nanjiangwill
requested review from
BBuf,
ByronHsu,
Duyi-Wang,
Edwardf0t1,
Fridge003,
HaiShaw,
ShangmingCai,
Ying1123,
ch-wan,
hnyls2002,
ispobock,
merrymercy,
sogalin and
xiezhq-hermann
as code owners
September 25, 2026 19:36
yueming-yuan
merged commit Sep 26, 2026
ab4f767
into
sgl-project:sglang-miles
78 of 87 checks passed
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.
Summary
Port #40986 to the
sglang-milesbranch.SamplingMaskChunk), instead of nested Python lists at every hop.output_token_sampling_mask,output_token_sampling_logprobsandoutput_token_sampling_mask_lengthare byte-identical to before, in selected and support mode, streaming and non-streaming.See #40986 for the design, the removed checks and their justification, and the performance results. Examples from there: support-mode decode at
top_k=1000× 256 goes from 6645 to 16032 tok/s, and staggeredtop_k=8192RL rollouts from 97.2 to 73.0 s (selected) and 131.5 to 83.1 s (support).Port notes
output_streamer.py. There,sglang-milesimportsget_observability, get_servingwithoutget_parallel. The port keeps that line and adds only [Sampling] Stream sampling masks as per-request arrays #40986'sSamplingMaskChunkimport.sglang-milesstill references the removed per-request fields (Req.output_token_sampling_mask,output_token_sampling_logprobs,send_output_sampling_mask_offset).Testing
All on this branch, against
sglang-milesin the same runs:test/registered/unit/{managers,disaggregation,sampling}plus the OpenAI protocol and serving-chat tests. 1434 passed, against 1431 onsglang-miles; the difference is [Sampling] Stream sampling masks as per-request arrays #40986's three new tests.sglang-mileswithout this port.SchedulerOutputStreamer.__init__() missing 1 required keyword-only argument: 'is_multimodal_gen'.test/registered/sampling/test_sampling_mask.pyon 2×H100: 35 passed with 28 subtests.sglang-milestwice, then to this branch, under--enable-deterministic-inference. Responses are compared floats bitwise and by each number's JSON text.--tokenizer-worker-num 2and msgpack IPC.CI States
Latest PR Test (Base): ❌ Run #36180648282
Latest PR Test (Extra): ❌ Run #36180647919
Latest PR Test (AMD ROCm 10): ❌ Run #36180648193