{"record":{"id":"3758b1da8974822c","repo":"sgl-project/sglang","slug":"unsupported-modelslim-moe-schemes-for-layer-prefi","errorCode":null,"errorMessage":"Unsupported ModelSlim MoE schemes for layer {prefix}: W13='{w13_scheme_name}', W2='{w2_scheme_name}'","messagePattern":"Unsupported ModelSlim MoE schemes for layer (.+?): W13='(.+?)', W2='(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/quantization/modelslim/modelslim.py","lineNumber":429,"sourceCode":"        # Map scheme names to classes\n        scheme_map = dict(\n            moe_quant_schemes\n        )  # dict: \"W4A4_DYNAMIC\" -> ModelSlimW4A4Int4MoE, etc.\n\n        # Instantiate the schemes\n        def instantiate(name, weight_group):\n            cls = scheme_map.get(name)\n            if cls is None:\n                logger.warning(\n                    f\"Unsupported scheme '{name}' for layer {resolved_prefix}\"\n                )\n                return None\n            return cls(self, weight_group)\n\n        w13_scheme = instantiate(w13_scheme_name, weight_group=\"w13\")\n        w2_scheme = instantiate(w2_scheme_name, weight_group=\"w2\")\n        if w13_scheme is None or w2_scheme is None:\n            raise ValueError(\n                f\"Unsupported ModelSlim MoE schemes for layer {prefix}: \"\n                f\"W13='{w13_scheme_name}', W2='{w2_scheme_name}'\"\n            )\n        logger.info_once(f\"Using {type(w13_scheme).__name__} for W13\")\n        logger.info_once(f\"Using {type(w2_scheme).__name__} for W2\")\n\n        return w13_scheme, w2_scheme\n\n    def is_layer_skipped(\n        self, prefix: str, fused_mapping: Mapping[str, List[str]] = MappingProxyType({})\n    ):\n        # adapted from vllm.model_executor.layers.quantization.utils.quant_utils.is_layer_skipped\n        proj_name = prefix.split(\".\")[-1]\n        if proj_name in fused_mapping:\n            shard_prefixes = [\n                prefix.replace(proj_name, shard_proj_name)\n                for shard_proj_name in fused_mapping[proj_name]\n            ]","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/quantization/modelslim/modelslim.py#L411-L447","documentation":"The w13/w2 scheme names found in the quant config resolved to None when passed through the scheme factory (instantiate), meaning they are not in the supported MoE scheme map for this SGLang build. Only specific schemes (e.g. int8, mxfp8, w4a8, w4a4 variants) have MoE implementations on Ascend NPU.","triggerScenarios":"quant_description contains scheme names like 'W8A16' or an unrecognized string for the MoE projections; instantiate(w13_scheme_name, ...) returns None for at least one of w13/w2 and the error reports both resolved names.","commonSituations":"Using a newer/older msModelSlim version emitting scheme names this SGLang release doesn't map to MoE classes; quantizing with an algorithm that has MoE support only in later SGLang versions; typos or locale/case differences in the config's scheme strings.","solutions":["Check the scheme names printed in the error against the scheme_map defined in get_moe_scheme in modelslim.py","Upgrade (or pin) SGLang to the version whose ModelSlim MoE schemes match your msModelSlim output","Re-quantize the MoE layers with a supported scheme such as W4A8/INT8/MXFP8","If downstream tooling renamed schemes, normalize the strings in quant_description to the expected names"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"SUPPORTED = {\"int8\", \"mxfp8\", \"w4a8\", \"w4a4\"}  # mirror scheme_map in get_moe_scheme\n\ndef scheme_supported(name: str) -> bool:\n    return name.lower() in SUPPORTED\n\nfor k, v in config.quant_description.items():\n    if k.startswith(moe_prefix):\n        assert scheme_supported(v), f\"{k}={v} unsupported for MoE\"","typeGuard":null,"tryCatchPattern":"try:\n    config.get_quant_method(layer, prefix)\nexcept ValueError as e:\n    if \"Unsupported ModelSlim MoE schemes\" in str(e):\n        logger.error(\"Upgrade SGLang or re-quantize %s with a supported scheme\", prefix)\n    raise","preventionTips":["Pin SGLang and msModelSlim versions known to be compatible","Check the scheme_map in modelslim.py before quantizing with a new algorithm","Test-load the model in CI right after quantization"],"tags":["modelslim","quantization","moe","unsupported-scheme","version-mismatch"],"backgroundTag":"unsupported-quantization-scheme","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}