Fix NSA CP positions mismatch in eagle NextN model#19367
Merged
Conversation
When context parallelism (CP) is enabled, the eagle NextN model splits hidden_states across CP ranks but not positions, causing a shape mismatch in the NSA indexer's rotary embedding. This matches the fix already present in the main DeepseekV2 model (deepseek_v2.py:2707).
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Collaborator
Author
|
/tag-and-rerun-ci |
Collaborator
Author
Fridge003
approved these changes
Feb 26, 2026
Collaborator
Author
|
Previously, self.cp_size was set to the TP size (wrong), so nsa_use_prefill_cp likely never triggered the actual CP split path correctly. PR #19062 fixed it to use the real CP size, which activated the CP split for hidden_states, but since positions was never split (missing since the original #12065), the mismatch now exists as the runtime error. |
klhhhhh
pushed a commit
to klhhhhh/sglang
that referenced
this pull request
Feb 26, 2026
magicYang1573
pushed a commit
to magicYang1573/sglang
that referenced
this pull request
Mar 9, 2026
Wangzheee
pushed a commit
to Wangzheee/sglang
that referenced
this pull request
Mar 21, 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.
Summary
deepseek_nextn.py) splitshidden_statesacross CP ranks but does not splitpositions, causing a shape mismatch in the NSA indexer's rotary embeddingpositions.size(0)as batch size to reshapek_rope, butk_ropehas fewer elements becausehidden_stateswas already CP-splitcp_split_and_rebuild_positioncall, matching what the main model (deepseek_v2.py:2707) already doesError
at
rotary_embedding/base.py:292during eagle speculative decoding withATTN_CP4 TP4.Full trace: https://github.com/sgl-project/sglang/actions/runs/22376709996/job/64768484941
Test plan