sgl-project/sglang · error · ValueError

Unsupported ModelSlim MoE schemes for layer {prefix}: W13='{

Error message

Unsupported ModelSlim MoE schemes for layer {prefix}: W13='{w13_scheme_name}', W2='{w2_scheme_name}'

What it means

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.

Source

Thrown at python/sglang/srt/layers/quantization/modelslim/modelslim.py:429

        # Map scheme names to classes
        scheme_map = dict(
            moe_quant_schemes
        )  # dict: "W4A4_DYNAMIC" -> ModelSlimW4A4Int4MoE, etc.

        # Instantiate the schemes
        def instantiate(name, weight_group):
            cls = scheme_map.get(name)
            if cls is None:
                logger.warning(
                    f"Unsupported scheme '{name}' for layer {resolved_prefix}"
                )
                return None
            return cls(self, weight_group)

        w13_scheme = instantiate(w13_scheme_name, weight_group="w13")
        w2_scheme = instantiate(w2_scheme_name, weight_group="w2")
        if w13_scheme is None or w2_scheme is None:
            raise ValueError(
                f"Unsupported ModelSlim MoE schemes for layer {prefix}: "
                f"W13='{w13_scheme_name}', W2='{w2_scheme_name}'"
            )
        logger.info_once(f"Using {type(w13_scheme).__name__} for W13")
        logger.info_once(f"Using {type(w2_scheme).__name__} for W2")

        return w13_scheme, w2_scheme

    def is_layer_skipped(
        self, prefix: str, fused_mapping: Mapping[str, List[str]] = MappingProxyType({})
    ):
        # adapted from vllm.model_executor.layers.quantization.utils.quant_utils.is_layer_skipped
        proj_name = prefix.split(".")[-1]
        if proj_name in fused_mapping:
            shard_prefixes = [
                prefix.replace(proj_name, shard_proj_name)
                for shard_proj_name in fused_mapping[proj_name]
            ]

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the scheme names printed in the error against the scheme_map defined in get_moe_scheme in modelslim.py
  2. Upgrade (or pin) SGLang to the version whose ModelSlim MoE schemes match your msModelSlim output
  3. Re-quantize the MoE layers with a supported scheme such as W4A8/INT8/MXFP8
  4. If downstream tooling renamed schemes, normalize the strings in quant_description to the expected names
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"int8", "mxfp8", "w4a8", "w4a4"}  # mirror scheme_map in get_moe_scheme

def scheme_supported(name: str) -> bool:
    return name.lower() in SUPPORTED

for k, v in config.quant_description.items():
    if k.startswith(moe_prefix):
        assert scheme_supported(v), f"{k}={v} unsupported for MoE"

Try / catch

try:
    config.get_quant_method(layer, prefix)
except ValueError as e:
    if "Unsupported ModelSlim MoE schemes" in str(e):
        logger.error("Upgrade SGLang or re-quantize %s with a supported scheme", prefix)
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/3758b1da8974822c. Report an issue: GitHub.