sgl-project/sglang · error · ValueError
--enable-linear-replayssm-spec with DSPARK/DFLASH requires a
Error message
--enable-linear-replayssm-spec with DSPARK/DFLASH requires a KDA (kimi_linear) model; got a non-KDA model.
What it means
When building the hybrid request pool, the linear-replay SSM speculative path (--enable-linear-replayssm-spec with DSPARK or DFLASH) is gated on the model actually being a KDA (kimi_linear) model; kimi_linear_config() returning None for any other architecture triggers this error.
Source
Thrown at python/sglang/srt/mem_cache/kv_cache_configurator.py:873
pre_alloc_size=pre_alloc_size,
)
return req_to_token_pool
def _build_hybrid_req_pool(
self,
*,
max_num_reqs: int,
extra_max_context_len: int,
) -> ReqToTokenPool:
# DSPARK/DFLASH commit routes through the backend fold (KDA-only); a
# non-KDA model there would scatter a None intermediate_ssm and crash.
_algo = (get_spec().speculative_algorithm or "").upper()
if (
get_exec().mamba.enable_linear_replayssm_spec
and _algo in ("DSPARK", "DFLASH")
and kimi_linear_config(self.model_config) is None
):
raise ValueError(
"--enable-linear-replayssm-spec with DSPARK/DFLASH requires a KDA "
"(kimi_linear) model; got a non-KDA model."
)
req_to_token_pool = HybridReqToTokenPool(
size=max_num_reqs,
mamba_size=get_schedule().max_mamba_cache_size,
mamba_spec_state_size=max_num_reqs,
max_context_len=self.model_config.context_len + extra_max_context_len,
device=self.device,
enable_memory_saver=get_exec().features.enable_memory_saver,
cache_params=self.mambaish_config.mamba2_cache_params,
mamba_layer_ids=(
[
i
for i in self.mambaish_config.mamba2_cache_params.layers
if self.layer_info.start_layer <= i < self.layer_info.end_layer
]
),View on GitHub (pinned to 0132848349)
Solutions
- Drop --enable-linear-replayssm-spec when running non-KDA models
- Use a kimi_linear (KDA) checkpoint with this combination
- Switch the speculative algorithm to one not named DSPARK/DFLASH
Example fix
# before python -m sglang.launch_server --model qwen3-... --speculative-algorithm DFLASH --enable-linear-replayssm-spec # after python -m sglang.launch_server --model qwen3-... --speculative-algorithm DFLASH
Defensive patterns
Strategy: validation
Validate before calling
is_kda = any("Kimi" in a or "kimi_linear" in a.lower() for a in model_config.hf_config.architectures)
if exec_cfg.mamba.enable_linear_replayssm_spec and (server_args.speculative_algorithm or "").upper() in ("DSPARK", "DFLASH") and not is_kda:
exec_cfg.mamba.enable_linear_replayssm_spec = False Prevention
- Tie KDA-only spec flags to a model-family check in the launch wrapper
When it happens
Trigger: Enable the exec flag get_exec().mamba.enable_linear_replayssm_spec together with a DSPARK/DFLASH speculative algorithm on a non-kimi_linear checkpoint.
Common situations: Reusing a KDA-specific spec-decode flag on a different hybrid model, or a mis-set speculative_algorithm string.
Related errors
- expected q/k shape {expected_shape}
- expected v/g shape {expected_shape}
- Kimi-K3 DCP + DSPARK currently requires SGLANG_RAGGED_VERIFY
- DFLASH speculative decoding only supports CUDA and NPU devic
- Currently DFLASH speculative decoding does not support dp at
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a78d8bae92fe4090.
Report an issue: GitHub.