glm5_next: do not require a residual in the PP proxy tensors - #11
Merged
Merged
Conversation
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.
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.
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.
CI States
Latest PR Test (Base): 🚫 Run #34178113809
Latest PR Test (Extra): 🚫 Run #34178113729
Latest PR Test (AMD ROCm 7.2): 🚫 Run #34178113896