Repository navigation
[Fix] glm5_3: Set SGLANG_ENABLE_EMBED_REPLICATION automatically again - #95
Merged
YAMY1234 merged 3 commits intoNov 29, 2026
Merged
Conversation
4 of 7 tasks
Merged
7 tasks done
YAMY1234
reviewed
Nov 27, 2026
YAMY1234
left a comment
Collaborator
There was a problem hiding this comment.
Logic matches SGLang's set_flag_env and looks good; one test fix needed so it does not leak the variable into later test files.
Since sgl-project#19 the GLM-5.3 spec pins its environment per TP size (pinned_reasons on ENV at TP8 / TP4, glm5_3/sm107's at TP16) and leaves Requirements.env empty, so SGLang's FLAG_SETS_ENV no longer sets SGLANG_ENABLE_EMBED_REPLICATION, and a server with the NextN draft (slot draft) stopped at startup with "SGLANG_ENABLE_EMBED_REPLICATION False is not True" unless the user set it. config_disable_reasons now sets the variables of ENV listed in the spec's own FLAG_SETS_ENV to their pinned value when they are unset, at argument resolution, as SGLang does for Requirements.env: only at TP8 / TP4 and only when slot draft is on. It logs what it set, keeps and checks a value the user set, and clears what it set when the setup is refused. TP16 is unchanged: its draft reads the vocab-sharded embedding, which is why the variable cannot go back into Requirements.env. The docs say again that the flag turns it on. Tests: test/unit/test_glm5_3_flag_env.py. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tests monkeypatch.delenv(raising=False) records nothing when the variable is absent, so the value the spec writes with envs.X.set() in the TP8/TP4 test stayed in os.environ for the rest of the test session. Set it to an empty value first so that monkeypatch records it and restores the original state at teardown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mattteochen
force-pushed
the
glm5_3-embed-replication-env
branch
from
November 27, 2026 11:03
f352ad0 to
abc73ea
Compare
YAMY1234
approved these changes
Nov 29, 2026
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
Follow-up from the review of #75. Since #19, a GLM-5.3 / GLM-5.2 server with the NextN draft does not start with
--enable-nvidia-megakernelalone. It stops at startup withSGLANG_ENABLE_EMBED_REPLICATION False is not Trueunless the user sets the variable.Requirements.envand checks them per TP size:ENVat TP8 / TP4,glm5_3/sm107's at TP16.FLAG_SETS_ENVsets only variables that a spec declares inRequirements.env, so it no longer setsSGLANG_ENABLE_EMBED_REPLICATIONfor GLM-5.3.Requirements.env. SGLang would then also set it, and require it, at TP16, where the draft reads the vocab-sharded embedding.Modifications
glm5_3/spec.py: at argument resolution,config_disable_reasonssets the variables ofENVthat are listed in the spec'sFLAG_SETS_ENV(SGLANG_ENABLE_EMBED_REPLICATION) to their pinned value when they are unset. This is what SGLang does forRequirements.env.draftis on (ENVpins the variable only then). TP16 is unchanged.--enable-nvidia-megakernel: set SGLANG_ENABLE_EMBED_REPLICATION=True for GLM-5.3 / GLM-5.2.0still stops the server, naming it.pinned_reasons) is unchanged.docs/models/glm5_3.md: the flag turns embedding replication on again, so the launch command needs no variable.test/unit/test_glm5_3_flag_env.py(new, CPU), checking that:draftpins the variable per TP size, outsideRequirements.env(target and draft) and outside TP16's environment;1) or refused (0);ENVis set.Accuracy Tests
GB300, one tray, TP4 aggregated, MTP 5/1/6 with natural acceptance,
SGLANG_ENABLE_EMBED_REPLICATIONunset, 2026-11-21 SGLang nightly image (the latest that accepts megakernel plugin API version 2, whichmaindeclares), Mega f352ad0:--enable-nvidia-megakernel: set SGLANG_ENABLE_EMBED_REPLICATION=True for GLM-5.3 / GLM-5.2. Onmainthe same launch stops at startup withSGLANG_ENABLE_EMBED_REPLICATION False is not True.NVIDIA megakernel: activefor the TP4 kernel units and the NextN draft. No tracebacks.Speed Tests and Profiling
Not applicable: the served path is the same as with the variable set by hand.
Checklist
pre-commit runpasses on the changed files.test/cover the change:test/unit/test_glm5_3_flag_env.py. CPUunitat the pinned SGLang (cf6133a): 1460 passed, 59 skipped vs 1452 / 59 onmain; the 8 new tests pass. On the 2026-11-21 SGLang nightly image: 1396 passed vs 1388 onmain, with the same failures on both (SGLang drift against the pin)..github/CODEOWNERS: not applicable.🤖 Generated with Claude Code