{"record":{"id":"3fe9ad44079a5344","repo":"sgl-project/sglang","slug":"deepep-v2-moe-is-not-validated-as-a-speculative-dr","errorCode":null,"errorMessage":"DeepEP v2 MoE is not validated as a speculative draft backend. Select another --speculative-moe-a2a-backend.","messagePattern":"DeepEP v2 MoE is not validated as a speculative draft backend\\. Select another --speculative-moe-a2a-backend\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":7632,"sourceCode":"            raise ValueError(\n                f\"DeepEP v2 MoE is not validated for {architecture!r}; supported \"\n                f\"architectures are {sorted(validated_architectures)}. \"\n                \"Other model workflows may require an all-reduce after A2A \"\n                \"combine. Use --moe-a2a-backend deepep.\"\n            )\n\n    def _validate_deepep_v2_speculative_draft(self) -> None:\n        \"\"\"Reject an explicit or inherited DeepEP v2 draft backend.\"\"\"\n        view = resolved_view(self)\n        draft_backend = view.speculative_moe_a2a_backend\n        if draft_backend is None and view.speculative_algorithm:\n            from sglang.srt.speculative.spec_info import SpeculativeAlgorithm\n\n            algorithm = SpeculativeAlgorithm.from_string(view.speculative_algorithm)\n            if not algorithm.is_ngram():\n                draft_backend = view.moe_a2a_backend\n        if draft_backend == \"deepep_v2\":\n            raise ValueError(\n                \"DeepEP v2 MoE is not validated as a speculative draft backend. \"\n                \"Select another --speculative-moe-a2a-backend.\"\n            )\n\n    def _handle_a2a_moe(self):\n        # The backend overrides and the ep_size=tp_size adjustments moved to\n        # the resolution pipeline (arg_groups/overrides.py:\n        # _a2a_backend_overrides / _a2a_ep_size); the per-backend logs,\n        # asserts, fusion/deepep_mode/env/cuda-graph writes stay below.\n        cfg = resolving_view(self)\n        from sglang.srt.arg_groups.overrides import (\n            _a2a_backend_overrides,\n            _a2a_ep_size,\n            _a2a_fusion_adjustments,\n            run_post_process_pass,\n        )\n\n        run_post_process_pass(self, _a2a_backend_overrides)","sourceCodeStart":7614,"sourceCodeEnd":7650,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L7614-L7650","documentation":"Raised when the resolved speculative draft path would use moe_a2a_backend == 'deepep_v2'. DeepEP v2 has not been validated as a speculative draft backend, so draft models cannot run on it. The check resolves the SpeculativeAlgorithm; non-ngram algorithms inherit the target's moe_a2a_backend as the draft backend, which trips the guard.","triggerScenarios":"Enabling --speculative-algorithm EAGLE (or any non-ngram algorithm) together with --moe-a2a-backend deepep_v2 without setting a separate --speculative-moe-a2a-backend; the draft inherits deepep_v2 from the target model.","commonSituations":"Turning on speculative decoding on a DeepSeek/Qwen3 MoE deployment that was upgraded to deepep_v2 for throughput; inheriting the a2a backend implicitly instead of setting a draft-specific one.","solutions":["Set --speculative-moe-a2a-backend deepep (or another supported backend) explicitly for the draft","Use --speculative-algorithm NGRAM, which does not use a draft MoE backend","Drop --moe-a2a-backend deepep_v2 and run the whole stack on deepep"],"exampleFix":"# before\n--speculative-algorithm EAGLE --moe-a2a-backend deepep_v2\n# after\n--speculative-algorithm EAGLE --moe-a2a-backend deepep_v2 --speculative-moe-a2a-backend deepep","handlingStrategy":"validation","validationCode":"if spec_algorithm not in (None, \"NGRAM\") and a2a_backend == \"deepep_v2\":\n    draft_a2a = draft_a2a or \"deepep\"\n    cmd += [\"--speculative-moe-a2a-backend\", draft_a2a]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set --speculative-moe-a2a-backend explicitly when enabling speculative decoding on MoE models","Prefer NGRAM if you only need lightweight speculation on deepep_v2"],"tags":["speculative-decoding","deepep","moe","draft-model","server-args"],"backgroundTag":"unsupported-configuration-combo","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}