{"record":{"id":"026e7eb5aec78dea","repo":"sgl-project/sglang","slug":"pd-state-transfer-does-not-support-tp-mismatched-n","errorCode":null,"errorMessage":"PD state transfer does not support TP-mismatched non-MLA SWA models (prefill_tp_size={self.attn_tp_size}, decode_tp_size={peer_info.decode_tp_size})","messagePattern":"PD state transfer does not support TP-mismatched non-MLA SWA models \\(prefill_tp_size=(.+?), decode_tp_size=(.+?)\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/disaggregation/mori/conn.py","lineNumber":1373,"sourceCode":"        return statuses\n\n    def _send_swa_dsa_state(\n        self,\n        peer_info: KVArgsRegisterInfo,\n        src_state_indices: npt.NDArray[np.int32],\n        dst_state_indices: npt.NDArray[np.int32],\n        src_state_mem_descs: List[MemoryDesc],\n        src_state_item_lens: List[int],\n        dst_state_mem_descs: List[MemoryDesc],\n        state_type: str,\n    ) -> List[TransferStatus]:\n        # TP mismatch check for non-MLA SWA\n        if (\n            state_type == \"swa\"\n            and not self.is_mla_backend\n            and peer_info.decode_tp_size != self.attn_tp_size\n        ):\n            raise RuntimeError(\n                f\"PD state transfer does not support TP-mismatched non-MLA SWA models \"\n                f\"(prefill_tp_size={self.attn_tp_size}, decode_tp_size={peer_info.decode_tp_size})\"\n            )\n        if state_type == \"minimax_index_k\":\n            if self.pp_size is not None and self.pp_size > 1:\n                raise RuntimeError(\n                    \"PD disagg: PP>1 not supported for MiniMax sparse index yet.\"\n                )\n            if peer_info.decode_tp_size != self.attn_tp_size:\n                raise RuntimeError(\n                    \"PD disagg: heterogeneous TP not supported for MiniMax sparse index yet.\"\n                )\n\n        common_len = min(src_state_indices.size, dst_state_indices.size)\n        if (\n            state_type == \"c128_state\"\n            and common_len == 0\n            and src_state_indices.size == 0","sourceCodeStart":1355,"sourceCodeEnd":1391,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/disaggregation/mori/conn.py#L1355-L1391","documentation":"For SWA (sliding-window attention) state transfer on non-MLA backends, the sender requires prefill TP size to equal decode TP size. The SWA state layout depends on TP head sharding, and the transfer path has no slicing support for it unless MLA is used.","triggerScenarios":"send_state with state_type=='swa', a non-MLA attention backend, and peer_info.decode_tp_size != self.attn_tp_size — i.e. heterogeneous TP deployment of a sliding-window model.","commonSituations":"Deploying a SWA/hybrid model with more prefill GPUs than decode GPUs (common cost optimization), which works for MLA models but is unimplemented for standard GQA/SWA KV layouts.","solutions":["Set the same TP size on prefill and decode instances for SWA (non-MLA) models","Switch to an MLA-based model if heterogeneous TP is a hard requirement","Track SGLang releases for non-MLA SWA TP-slicing support"],"exampleFix":"# before\n--disaggregation-prefill --tp 8   /   --disaggregation-decode --tp 4  (SWA model)\n\n# after\n--disaggregation-prefill --tp 8   /   --disaggregation-decode --tp 8","handlingStrategy":"validation","validationCode":"if state_type == \"swa\" and not conn.is_mla_backend:\n    assert peer_info.decode_tp_size == conn.attn_tp_size, (\n        \"non-MLA SWA state transfer requires matching TP sizes\"\n    )\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match TP sizes for non-MLA SWA models in PD deployments","Prefer MLA models when heterogeneous TP is required"],"tags":["disaggregation","swa","tensor-parallel","heterogeneous-tp","unsupported-feature"],"backgroundTag":"unsupported-parallel-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}