From 141ff35acd0674064c2882c196ddee215fc2f60d Mon Sep 17 00:00:00 2001 From: Alison Shao Date: Wed, 25 Feb 2026 15:23:04 -0800 Subject: [PATCH] Fix NSA CP positions mismatch in eagle NextN model 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). --- python/sglang/srt/models/deepseek_nextn.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/sglang/srt/models/deepseek_nextn.py b/python/sglang/srt/models/deepseek_nextn.py index cb13a7c676a9..d62111471436 100644 --- a/python/sglang/srt/models/deepseek_nextn.py +++ b/python/sglang/srt/models/deepseek_nextn.py @@ -29,6 +29,7 @@ can_cp_split, cp_all_gather_rerange_output, cp_split_and_rebuild_data, + cp_split_and_rebuild_position, is_nsa_enable_prefill_cp, nsa_use_prefill_cp, prepare_input_dp_with_cp_dsa, @@ -160,6 +161,7 @@ def forward( if nsa_use_prefill_cp(forward_batch, self.nsa_enable_prefill_cp): hidden_states = cp_split_and_rebuild_data(forward_batch, hidden_states) + positions = cp_split_and_rebuild_position(forward_batch, positions) residual = None with get_global_expert_distribution_recorder().disable_this_region(): hidden_states, residual = self.decoder(