{"record":{"id":"a78d8bae92fe4090","repo":"sgl-project/sglang","slug":"enable-linear-replayssm-spec-with-dspark-dflash","errorCode":null,"errorMessage":"--enable-linear-replayssm-spec with DSPARK/DFLASH requires a KDA (kimi_linear) model; got a non-KDA model.","messagePattern":"--enable-linear-replayssm-spec with DSPARK/DFLASH requires a KDA \\(kimi_linear\\) model; got a non-KDA model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/kv_cache_configurator.py","lineNumber":873,"sourceCode":"            pre_alloc_size=pre_alloc_size,\n        )\n        return req_to_token_pool\n\n    def _build_hybrid_req_pool(\n        self,\n        *,\n        max_num_reqs: int,\n        extra_max_context_len: int,\n    ) -> ReqToTokenPool:\n        # DSPARK/DFLASH commit routes through the backend fold (KDA-only); a\n        # non-KDA model there would scatter a None intermediate_ssm and crash.\n        _algo = (get_spec().speculative_algorithm or \"\").upper()\n        if (\n            get_exec().mamba.enable_linear_replayssm_spec\n            and _algo in (\"DSPARK\", \"DFLASH\")\n            and kimi_linear_config(self.model_config) is None\n        ):\n            raise ValueError(\n                \"--enable-linear-replayssm-spec with DSPARK/DFLASH requires a KDA \"\n                \"(kimi_linear) model; got a non-KDA model.\"\n            )\n        req_to_token_pool = HybridReqToTokenPool(\n            size=max_num_reqs,\n            mamba_size=get_schedule().max_mamba_cache_size,\n            mamba_spec_state_size=max_num_reqs,\n            max_context_len=self.model_config.context_len + extra_max_context_len,\n            device=self.device,\n            enable_memory_saver=get_exec().features.enable_memory_saver,\n            cache_params=self.mambaish_config.mamba2_cache_params,\n            mamba_layer_ids=(\n                [\n                    i\n                    for i in self.mambaish_config.mamba2_cache_params.layers\n                    if self.layer_info.start_layer <= i < self.layer_info.end_layer\n                ]\n            ),","sourceCodeStart":855,"sourceCodeEnd":891,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/kv_cache_configurator.py#L855-L891","documentation":"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.","triggerScenarios":"Enable the exec flag get_exec().mamba.enable_linear_replayssm_spec together with a DSPARK/DFLASH speculative algorithm on a non-kimi_linear checkpoint.","commonSituations":"Reusing a KDA-specific spec-decode flag on a different hybrid model, or a mis-set speculative_algorithm string.","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"],"exampleFix":"# before\npython -m sglang.launch_server --model qwen3-... --speculative-algorithm DFLASH --enable-linear-replayssm-spec\n# after\npython -m sglang.launch_server --model qwen3-... --speculative-algorithm DFLASH","handlingStrategy":"validation","validationCode":"is_kda = any(\"Kimi\" in a or \"kimi_linear\" in a.lower() for a in model_config.hf_config.architectures)\nif exec_cfg.mamba.enable_linear_replayssm_spec and (server_args.speculative_algorithm or \"\").upper() in (\"DSPARK\", \"DFLASH\") and not is_kda:\n    exec_cfg.mamba.enable_linear_replayssm_spec = False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Tie KDA-only spec flags to a model-family check in the launch wrapper"],"tags":["speculative-decoding","kda","kimi-linear","dspark","dflash","boot-config"],"backgroundTag":"model-feature-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}