Conversation
Use the flattened hidden state as the pipeline-parallel handoff for mHC GLM5 stages, which do not allocate a separate residual buffer. Preserve the existing residual handoff for non-mHC configurations. Fixes sgl-project#36906 Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: jikuixie <jikuixie@gmail.com>
Merged
|
@Fridge003 - why has this been closed? Is the code somewhere else? Thanks |
Thireus
added a commit
to Thireus/sglang
that referenced
this pull request
Sep 6, 2026
Any --pp-size > 1 worker dies at the first forward with KeyError: 'residual' on every non-first pipeline stage. Glm5NextModel.forward reads pp_proxy_tensors["residual"] unconditionally (glm5_next.py:1094) and returns both keys at :1183.
mHC folds the residual into the widened hidden state, so the previous stage never sends one. configs/model_config.py sets hc_mult = 4 and mhc = true for this checkpoint, so hc_hidden_size is 16384 rather than None; runner_utils/buffers.py and runner/base_runner.py both test is_mhc = hc_hidden_size is not None, allocate only hidden_states at the widened size, and guard the residual buffer behind `if not is_mhc:`. The reference mHC model deepseek_v4.py:3188 returns only {"hidden_states": hidden_states.flatten(1)}, so glm5_next is the odd one out.
Read the proxy with .tensors.get("residual") so an absent key means None, and send the key on only when it exists, because a None cannot travel over PP IPC.
Verified on 3 x RTX PRO 6000 Blackwell serving a GLM-5.3-Flash NVFP4 build as pp=3 x tp=1: without it there is no launchable three-GPU shape at all, since tp=3 is impossible at 64 heads and tp2 x pp2 inherits the same defect; with it the worker starts and the log carries no residual KeyError.
sgl-project#37375 proposed the same fix first, on 2026-09-01. It was stacked on xinyuan/glm-5.3-flash-support and GitHub auto-closed it unmerged on 2026-09-06 when that branch merged as sgl-project#36507. The bug survived the merge: main still reads the key unconditionally at models/glm5_next.py:983. Credit for the diagnosis belongs to that author.
Contributor
Author
|
Hi @Fridge003, thanks for reviewing #36507. We noticed that #37375 was closed at the same time that its base branch Could you please clarify whether #37375 was closed because its model-side pipeline-parallel proxy fix is already included elsewhere, or because dependent PRs should be recreated against If the fix is still needed, we would be happy to rebase or adjust it and submit a new PR against |
Thireus
added a commit
to Thireus/sglang
that referenced
this pull request
Sep 8, 2026
Any --pp-size > 1 worker dies at the first forward with KeyError: 'residual' on every non-first pipeline stage. Glm5NextModel.forward reads pp_proxy_tensors["residual"] unconditionally (glm5_next.py:1094) and returns both keys at :1183.
mHC folds the residual into the widened hidden state, so the previous stage never sends one. configs/model_config.py sets hc_mult = 4 and mhc = true for this checkpoint, so hc_hidden_size is 16384 rather than None; runner_utils/buffers.py and runner/base_runner.py both test is_mhc = hc_hidden_size is not None, allocate only hidden_states at the widened size, and guard the residual buffer behind `if not is_mhc:`. The reference mHC model deepseek_v4.py:3188 returns only {"hidden_states": hidden_states.flatten(1)}, so glm5_next is the odd one out.
Read the proxy with .tensors.get("residual") so an absent key means None, and send the key on only when it exists, because a None cannot travel over PP IPC.
Verified on 3 x RTX PRO 6000 Blackwell serving a GLM-5.3-Flash NVFP4 build as pp=3 x tp=1: without it there is no launchable three-GPU shape at all, since tp=3 is impossible at 64 heads and tp2 x pp2 inherits the same defect; with it the worker starts and the log carries no residual KeyError.
sgl-project#37375 proposed the same fix first, on 2026-09-01. It was stacked on xinyuan/glm-5.3-flash-support and GitHub auto-closed it unmerged on 2026-09-06 when that branch merged as sgl-project#36507. The bug survived the merge: main still reads the key unconditionally at models/glm5_next.py:983. Credit for the diagnosis belongs to that author.
36 tasks
yilin-void
added a commit
to yilin-void/sglang
that referenced
this pull request
Sep 14, 2026
mHC folds residual state into the widened hidden state, so pipeline stages may receive and forward PP proxy tensors without a residual entry. Treat a missing residual as None and omit it from outgoing proxies unless it exists. Add a CPU-only contract regression test for both missing and present residual paths. Rebased from sgl-project#38367 (d36b37c), with credit to sgl-project#37375 for the original fix.
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
hidden_states.residualforwarding behavior for the non-mHC path.Fixes #36906
Relationship to existing work
xinyuan/glm-5.3-flash-support; it addresses the model-side proxy contract without changing the engine.Testing
pre-commit: passed.compileall: passed.git diff --check: passed.AI assistance
AI assistance was used during implementation and validation. The human submitter should review every changed line and verify the behavior before merging.
CI States
Latest PR Test (Base): ❌ Run #33482846710
Latest PR Test (Extra): ❌ Run #33482846546
Latest PR Test (AMD ROCm 7.2): ❌ Run #33482846626