Repository navigation
[Fix] Load HunyuanV3 NextN final_layernorm into the draft head's output norm - #30331
Merged
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
3 tasks done
Collaborator
|
/tag-and-rerun-ci |
… norm The released tencent/Hy3 checkpoint stores the MTP draft layer's output norm as model.layers.<num_hidden_layers>.final_layernorm.weight. The nextn key remap sent it to model.decoder.final_layernorm.weight, which does not exist in params_dict, so it was silently dropped and model.shared_head.norm ran with default-initialized weights. Map final_layernorm under the nextn prefix to model.shared_head.norm.weight, keeping the existing literal model.shared_head.norm.weight branch for preview-era checkpoints. Co-Authored-By: Claude Fable 5 <[email protected]>
BBuf
force-pushed
the
fix/hyv3-nextn-final-layernorm
branch
from
July 13, 2026 12:26
42e4268 to
d37c0bb
Compare
dougyster
added a commit
to dougyster/sglang
that referenced
this pull request
Jul 17, 2026
…ped in v0.5.15 Ancestry-checked each rolling-:dev model against v0.5.15.post1. Support that landed in the release moves to the stable tag: - Baidu Unlimited-OCR (sgl-project#29186), LFM2.5 (sgl-project#29659) -> :latest - MiniCPM-V-4.6 (sgl-project#24855): :dev -> :latest, :dev-cu12 -> :latest-cu129 Kept on :dev (support NOT in the release cut): - LongCat-2.0 (FP8 support sgl-project#30275 not in v0.5.15.post1) - Hy3 (HunyuanV3 NextN/MTP fix sgl-project#30331 not in release; MTP is a headline feature) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Chronostasys
pushed a commit
to MindLab-Research/sglang
that referenced
this pull request
Aug 24, 2026
…ut norm (sgl-project#30331) Co-authored-by: Auroter <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
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
On released
tencent/Hy3checkpoints, MTP speculative decoding is slower than plain decode. Root cause: the checkpoint stores the draft layer's output norm asmodel.layers.80.final_layernorm.weight, butHYV3ForCausalLMNextN.load_weightsremaps every non-spec key under the NextN prefix tomodel.decoder.<subname>.model.decoder.final_layernorm.weightexists on no module, so the key is silently dropped by thename not in params_dictguard — andshared_head.norm, the RMSNorm applied immediately before the draftlm_head, only loads from a literalmodel.shared_head.norm.weightkey that the released checkpoint does not contain. The draft head therefore runs a default-initialized output norm. The real tensor is materially non-identity (mean 1.16, range 0.81–1.23), so every draft logit is skewed and acceptance collapses.Modifications
elifin the NextN key remap routesfinal_layernorm.*tomodel.shared_head.norm.weight. The existing bare-key branch is kept for preview-era checkpoints.test/registered/unit/models/test_hunyuan_v3_nextn_weight_loading.py(CPU-only, mirrors the Nemotron-H exemplar) asserting the four mapping classes:final_layernorm→shared_head.norm, spec weights →model.*, decoder-layer keys →model.decoder.*, embed/lm_head skipped. The regression test fails against the unfixed source.Accuracy Tests
Output distribution is unchanged by construction — the fix touches only the draft model, and speculative verification is lossless. Unit tests: 4/4 pass.
Speed Tests and Profiling
tencent/Hy3-FP8, TP4 on 4× RTX PRO 6000 Blackwell (SM120), SGLang 0.5.14, fp8 KV.The dropped-tensor mechanism is configuration-independent.
Checklist
🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ⏳ Run #29249862209
Latest PR Test (Extra): ⏳ Run #29249862255