{"record":{"id":"4b7c3432601aa855","repo":"sgl-project/sglang","slug":"expert-pack-requires-disable-shared-experts-fusi","errorCode":null,"errorMessage":"expert-pack requires --disable-shared-experts-fusion so the shared expert remains on the dense GGUF path","messagePattern":"expert-pack requires --disable-shared-experts-fusion so the shared expert remains on the dense GGUF path","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/quantization/expert_pack.py","lineNumber":99,"sourceCode":"        self.hidden_size: int | None = None\n        self.intermediate_size: int | None = None\n        self.activation = \"silu\"\n        self.swiglu_limit: float | None = None\n        self.situ_beta: float | None = None\n        self.situ_linear_beta: float | None = None\n\n    def create_weights(\n        self,\n        layer: torch.nn.Module,\n        num_experts: int,\n        hidden_size: int,\n        intermediate_size_per_partition: int,\n        params_dtype: torch.dtype,\n        **extra_weight_attrs,\n    ) -> None:\n        del extra_weight_attrs\n        if layer.num_fused_shared_experts:\n            raise ValueError(\n                \"expert-pack requires --disable-shared-experts-fusion so the \"\n                \"shared expert remains on the dense GGUF path\"\n            )\n        if layer.moe_ep_size != 1 or layer.moe_tp_size != 1:\n            raise ValueError(\"expert-pack v1 supports only single-GPU TP=EP=1\")\n        if num_experts != self.store.header.num_experts:\n            raise ValueError(\"FusedMoE expert count does not match expert-pack\")\n        if params_dtype not in (torch.bfloat16, torch.float16):\n            raise ValueError(\"expert-pack kernel requires BF16 or FP16 activations\")\n        gate_shape = self.store.entries[(layer.layer_id, 0, 0)].shape\n        down_shape = self.store.entries[(layer.layer_id, 0, 2)].shape\n        if gate_shape != (hidden_size, intermediate_size_per_partition):\n            raise ValueError(\n                f\"expert-pack gate shape {gate_shape} does not match \"\n                f\"{(hidden_size, intermediate_size_per_partition)}\"\n            )\n        if down_shape != (intermediate_size_per_partition, hidden_size):\n            raise ValueError(","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/quantization/expert_pack.py#L81-L117","documentation":"The expert-pack path stores experts in a fused GGUF-like pack and requires shared experts to stay on the dense path. If shared-experts fusion is enabled (layer.num_fused_shared_experts != 0), the fused MoE layout conflicts with the pack, so create_weights raises.","triggerScenarios":"Launching an expert-pack quantized MoE model without --disable-shared-experts-fusion, so SGLang fuses the shared expert into the MoE layer before expert-pack weight creation.","commonSituations":"Default server args enabling shared-experts fusion on models like DeepSeek-V3 expert-pack builds.","solutions":["Launch with --disable-shared-experts-fusion","Verify the layer then has num_fused_shared_experts == 0","Check other expert-pack constraints (TP=EP=1) at the same time"],"exampleFix":"# before\npython -m sglang.launch_server --model ds-expert-pack --tp 1\n# after\npython -m sglang.launch_server --model ds-expert-pack --tp 1 --disable-shared-experts-fusion","handlingStrategy":"validation","validationCode":"assert \"--disable-shared-experts-fusion\" in server_args, \"expert-pack requires --disable-shared-experts-fusion\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake required flags into launch scripts for expert-pack models"],"tags":["expert-pack","moe","shared-experts","launch-flag"],"backgroundTag":"incompatible-server-flag","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}