fix(image): patch sglang for GLM-5.2 MTP nextn quark-exclude (backport #30265) - #32
Merged
Merged
Conversation
jiejingzhangamd
requested review from
JohnQinAMD,
limou102 and
xiaobochen-amd
as code owners
July 28, 2026 03:34
…t #30265) The sglang v0.5.15.post1 base predates sgl-project/sglang#30265, so GLM-5.2 EAGLE/MTP crashes at draft weight-load: the MTP layer (index=num_hidden_layers) is entirely bf16, and its eh_proj is listed in the quark `exclude`, but sglang's DeepseekV3ForCausalLMNextN checks the BARE layer prefix `model.layers.<N>` (not the submodule-level `...<N>.eh_proj` exclude entry), so should_ignore_layer() returns False, eh_proj is built as an MXFP4 uint8 param, and load asserts (param [6144,6144] uint8 vs bf16 [6144,12288]). Add a self-locating, idempotent Python patch (deploy/docker/patches/sglang/) that probes the eh_proj submodule instead of the bare layer -> nextn_quant_config=None -> whole bf16 MTP layer. Wire a patch loop into Dockerfile.sglang (mirrors the vLLM one). Verified: coherent GLM-5.2 MTP output on the v0.5.15.post1 base. Temporary: no-ops once the base sglang carries #30265 (merged upstream 2026-07-08); drop deploy/docker/patches/sglang/ + the loop when we bump the base sglang. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pw7JSvdQb796xh5pEcctLz Signed-off-by: Zhang, Jiejing <jiejing.zhang@amd.com>
jiejingzhangamd
force-pushed
the
feat/sglang-glm-nextn-patch
branch
from
July 28, 2026 03:36
b9b838b to
0d8d0ff
Compare
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.
Problem
GLM-5.2 EAGLE/MTP crashes at draft weight-load on our sglang v0.5.15.post1 base:
GLM-5.2's MTP layer (index =
num_hidden_layers) is entirely bf16/unquantized — the quarkquantization_configlistsmodel.layers.<N>.eh_proj(and the layer's other submodules) inexclude. sglang'sDeepseekV3ForCausalLMNextNdisables nextn quant only when the bare layer prefixmodel.layers.<N>is inexclude_layers, but the exclude entries are submodule-level (...<N>.eh_proj), soshould_ignore_layer()returnsFalse,eh_projis built as an MXFP4 (uint8) param, and the bf16 checkpoint weight won't load.Fix
Upstream fixed this in sgl-project/sglang#30265 (merged 2026-07-08, a dedicated
GlmMoeDsaForCausalLMNextNclass), but our pinned base v0.5.15.post1 predates it. This adds a temporary, self-locating, idempotent Python patch that probes theeh_projsubmodule (an exact exclude entry) instead of the bare layer →nextn_quant_config=None→ the whole bf16 MTP layer builds bf16.deploy/docker/patches/sglang/patch_glm52_nextn_quark_exclude.py— the patch (no-op if the anchor is absent, i.e. once sglang carries #30265).Dockerfile.sglang— a patch loop afterpip install(mirrors the vLLM patch loop).Verification
Coherent GLM-5.2 MTP output on the v0.5.15.post1 base (single-stream
accept len ~1.85–2.6, ~1.3–2× decode speedup), and the fix holds across single-node + 1P1D PD.Removal
Temporary — drop
deploy/docker/patches/sglang/and the loop when we bump the base sglang to a build that includes #30265 (the patch already no-ops then). Tracking the broader GLM-5.x ROCm EAGLE enablement upstream in #32175 (still open).🤖 Generated with Claude Code