{"record":{"id":"c45f638fea09b0f8","repo":"sgl-project/sglang","slug":"dspark-with-dp-attention-supports-moe-a2a-backend","errorCode":null,"errorMessage":"DSpark with dp attention supports moe_a2a_backend 'none' (built-in TP MoE) or 'megamoe', got {}.","messagePattern":"DSpark with dp attention supports moe_a2a_backend 'none' \\(built-in TP MoE\\) or 'megamoe', got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/speculative_hook.py","lineNumber":360,"sourceCode":"    )\n\n    return checkpoint_bundles_dspark_draft(server_args.get_model_config().hf_config)\n\n\ndef _handle_dspark(server_args: ServerArgs) -> None:\n    cfg = resolving_view(server_args)\n    _is_npu = cfg.device.startswith(\"npu\")\n    if not cfg.device.startswith((\"cuda\", \"npu\")):\n        raise ValueError(\n            \"DSpark speculative decoding only supports CUDA or NPU device.\"\n        )\n\n    # dp_size==1 with dp_attention is a degenerate flag under DSV4 CP; skip DP-only checks.\n    if cfg.enable_dp_attention and cfg.dp_size > 1:\n        if not cfg.enable_dp_lm_head:\n            raise ValueError(\"DSpark with dp attention requires --enable-dp-lm-head.\")\n        if not _is_npu and cfg.moe_a2a_backend not in (\"none\", \"megamoe\"):\n            raise ValueError(\n                \"DSpark with dp attention supports moe_a2a_backend 'none' \"\n                \"(built-in TP MoE) or 'megamoe', got \"\n                f\"{cfg.moe_a2a_backend!r}.\"\n            )\n        if not _is_npu and cfg.moe_a2a_backend != \"none\":\n            from sglang.srt.speculative.ragged_verify import (\n                RaggedVerifyMode,\n                read_ragged_verify_mode,\n            )\n\n            if read_ragged_verify_mode() is not RaggedVerifyMode.STATIC:\n                raise ValueError(\n                    \"DSpark with dp attention + \"\n                    f\"moe_a2a_backend={cfg.moe_a2a_backend!r} requires \"\n                    \"SGLANG_RAGGED_VERIFY_MODE=static.\"\n                )\n        if cfg.attn_cp_size > 1:\n            raise ValueError(","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/speculative_hook.py#L342-L378","documentation":"With DSpark + dp attention on CUDA, the MoE all-to-all backend must be 'none' (built-in TP MoE) or 'megamoe'. Other a2a backends (e.g. deep_ep, mooncake) are incompatible with DSpark's DP verification path.","triggerScenarios":"Launching DSpark with dp_size>1, enable_dp_attention, on CUDA, with --moe-a2a-backend set to something other than none/megamoe (commonly deep_ep).","commonSituations":"EP-style DeepSeek deployments default to --moe-a2a-backend deep_ep; adding DSpark spec decoding to such a command line triggers this.","solutions":["Set --moe-a2a-backend none or --moe-a2a-backend megamoe","Remove the --moe-a2a-backend flag if 'none' is the default for your setup","Note the check is skipped on NPU; on CUDA it is strict"],"exampleFix":"# before\n--speculative-algorithm DSPARK --enable-dp-attention --dp-size 4 --moe-a2a-backend deep_ep\n# after\n--speculative-algorithm DSPARK --enable-dp-attention --dp-size 4 --moe-a2a-backend megamoe","handlingStrategy":"validation","validationCode":"if args.enable_dp_attention and args.dp_size > 1:\n    if not args.device.startswith('npu') and args.moe_a2a_backend not in ('none', 'megamoe'):\n        raise SystemExit('DSPARK dp attention needs moe_a2a_backend none or megamoe')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not reuse deep_ep EP presets with DSpark"],"tags":["speculative-decoding","dspark","moe","a2a-backend","dp-attention"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}