Skip to content

Introduce Qwen 3.8 Flash Next - #36497

Closed
JustinTong0323 wants to merge 11 commits into
mainfrom
qwen4-main-squashed
Closed

JustinTong0323 wants to merge 11 commits into
mainfrom
qwen4-main-squashed

Conversation

@JustinTong0323

@JustinTong0323 JustinTong0323 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Modifications

Accuracy Tests

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Blocked -- run-ci is required first.
Latest PR Test (AMD ROCm 7.2): ➖ No AMD PR run found for this commit.

Co-authored-by: Qiaolin-Yu <90088090+Qiaolin-Yu@users.noreply.github.com>
Co-authored-by: ch-wan <54331508+ch-wan@users.noreply.github.com>
Co-authored-by: ispobock <26454835+ispobock@users.noreply.github.com>
Co-authored-by: JustinTong0323 <115166877+JustinTong0323@users.noreply.github.com>
Co-authored-by: samuellees <26428561+samuellees@users.noreply.github.com>
Co-authored-by: YAMY1234 <74099316+YAMY1234@users.noreply.github.com>
Co-authored-by: yhyang201 <47235274+yhyang201@users.noreply.github.com>
Co-authored-by: yizhang2077 <25844240+yizhang2077@users.noreply.github.com>
Co-authored-by: zijiexia <37504505+zijiexia@users.noreply.github.com>
@mintlify

mintlify Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
lmsysorg 🟢 Ready View Preview Sep 5, 2026, 11:21 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

…ISION) on qwen4-main-squashed (#38121)

Co-authored-by: Yangmin Li <yangminl@nvidia.com>
Co-authored-by: rdxa <rdxa@rdxa-int-spark-01.yvb.moe>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Alison Shao <54658187+alisonshao@users.noreply.github.com>
…in fused softmax routing (fixes GB10 NEXTN collapse) (#38308)

Co-authored-by: YAMY <74099316+YAMY1234@users.noreply.github.com>
@Leslie360

Copy link
Copy Markdown

@mochgolf Same finding on our side — we opened #38144 with an exact fallback for the threshold-bin overflow in fast_topk (when the coarse fp16 bin saturates, fall back to exact top-k over the candidate set instead of returning the clipped bin boundary), plus a concentrated-distribution regression test.

Validated on 8×A800 (SM80), qwen3.8-flash-next TP8, against current qwen4-main-squashed:

  • pre-patch: overflow-triggering inputs → 80/4 runs wrong, 20 distinct wrong signatures (wrong and unstable across reruns)
  • post-patch: 0/4 wrong rows, single deterministic signature; randn control unchanged; 10× CUDA-graph replay clean

Happy to fold this into your candidate if you already have one in flight — the repro and regression test are in the PR.

@Leslie360

Copy link
Copy Markdown

@kun10 Reproduced the same assert (prefix_lens % compress_ratio == 0 in _qsa_build_write_plan) on 8×A800 (SM80) with qwen3.8-flash-next TP8 under mixed load. Root cause: mixed-chunk injects running decode rows into an EXTEND batch with extend_len == 1, so prefix_len is almost never compress-ratio aligned.

#38180 adds a startup validation that rejects --enable-mixed-chunk with compressed QSA (fail-fast instead of a mid-serving device assert), plus a CPU unit test. Verified: post-fix mixed-load stress passes and the assert no longer fires.

Making the write plan tolerate unaligned prefixes would be the deeper fix, but the guard unblocks mixed-chunk users in the meantime.

…Triton + radix) (#38290)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
ehuaa added a commit to ehuaa/sglang that referenced this pull request Sep 7, 2026
Backport of sgl-project#36811 (as carried in sgl-project#36497 c8457de).

Plain softmax routing has no correction bias, but the JIT router took a
required bias tensor, so the caller built one: every routing call ran
torch.zeros(num_experts, fp32) plus its fill kernel purely to satisfy
the signature. Qwen3.8-Flash-Next routes 512 experts on all 48 layers
with SGLANG_OPT_USE_JIT_KERNEL_FUSED_TOPK on by default, so that is 48
allocations and 48 fill launches per forward. Measured on A100-80GB at
370 us per forward -- 1.2%-3.7% of a decode step depending on its
length, and the shorter the step the larger the share.

The kernel now takes HAS_BIAS as a constexpr and keeps the zero in
registers when there is none, and the bias may be fp16/bf16 as well as
fp32 (a bf16 correction bias no longer needs a host-side cast).

Verified on A100 (sm80): topk_ids identical and weight max|diff| = 0
against the previous zero-bias path at M = 1, 8, 64, 512, 8192 with
512 experts / top-10; the upstream unit suite passes (42 tests).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGAy9m3Q2VxMk5LLamv7HG
@Qiaolin-Yu

Copy link
Copy Markdown
Collaborator

merged in #37500

@Qiaolin-Yu Qiaolin-Yu closed this Sep 8, 2026
Leslie360 added a commit to Leslie360/sglang that referenced this pull request Sep 9, 2026
Mixed chunked prefill injects running decode rows into an EXTEND batch
(ForwardMode.MIXED) with prefix_len == seq_len - 1, which is almost
never a multiple of indexer_compress_ratio. That violates the
ratio-aligned prefix invariant the compressed QSA write plan relies on,
and torch._assert_async((prefix_lens % ratio == 0).all()) in
_qsa_build_write_plan fires device-side, killing every TP rank
(reported in the PR sgl-project#36497 thread; reproduced on 8x A800 SM80 TP8:
32x device-side assert, all ranks).

- Startup: _qwen4_exp_overrides declares enable_mixed_chunk=False via
  declare_resolution for compressed QSA (the spec/dllm hook pattern);
  the publish gate's resolvable_fields whitelist does not admit
  enable_mixed_chunk as a model-overridable declaration, so it cannot
  ride the returned overrides dict.
- Runtime: QwenSparseAttnBackend raises NotImplementedError on
  ForwardMode.MIXED so the assert can never be reached from any path.
- Pure-CPU regression test: MIXED batch raises with the disable
  directive; DECODE batch unaffected.

Verified on 8x A800 TP8: startup warning, health 200, 720s mixed
load ok=1329 fail=0, negative control (no flag) ok=911 fail=0.
Leslie360 added a commit to Leslie360/sglang that referenced this pull request Sep 11, 2026
Mixed chunked prefill injects running decode rows into an EXTEND batch
(ForwardMode.MIXED) with prefix_len == seq_len - 1, which is almost
never a multiple of indexer_compress_ratio. That violates the
ratio-aligned prefix invariant the compressed QSA write plan relies on,
and torch._assert_async((prefix_lens % ratio == 0).all()) in
_qsa_build_write_plan fires device-side, killing every TP rank
(reported in the PR sgl-project#36497 thread; reproduced on 8x A800 SM80 TP8:
32x device-side assert, all ranks).

- Startup: _qwen4_exp_overrides declares enable_mixed_chunk=False via
  declare_resolution for compressed QSA (the spec/dllm hook pattern);
  the publish gate's resolvable_fields whitelist does not admit
  enable_mixed_chunk as a model-overridable declaration, so it cannot
  ride the returned overrides dict.
- Runtime: QwenSparseAttnBackend raises NotImplementedError on
  ForwardMode.MIXED under the same condition as the write plan
  (qsa_profile is None or variant == compressed), so the ratio assert
  can never be reached. Tokenwise QSA is unaffected: it never enters
  the write plan and compress_ratio == 1 makes the alignment trivially
  hold, so its MIXED batches are not rejected.
- Pure-CPU regression test: MIXED batch raises with the disable
  directive for compressed QSA; tokenwise MIXED and DECODE batches are
  not guarded.

Verified on 8x A800 TP8: startup warning, health 200, 720s mixed
load ok=1329 fail=0, negative control (no flag) ok=911 fail=0.
@Jiminator
Jiminator deleted the qwen4-main-squashed branch September 14, 2026 04:45
@alexnails
alexnails restored the qwen4-main-squashed branch September 14, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.