{"record":{"id":"ce5cbefa16d6fad4","repo":"sgl-project/sglang","slug":"enable-unified-memory-only-supports-hybrid-mamba","errorCode":null,"errorMessage":"--enable-unified-memory only supports hybrid Mamba and hybrid sliding-window-attention models (DeepSeek-V4 excluded); the current model ({self.model_config.hf_config.architectures}) is neither, so the unified memory pool cannot be built. Drop --enable-unified-memory for this model.","messagePattern":"--enable-unified-memory only supports hybrid Mamba and hybrid sliding-window-attention models \\(DeepSeek-V4 excluded\\); the current model \\((.+?)\\) is neither, so the unified memory pool cannot be built\\. Drop --enable-unified-memory for this model\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/kv_cache_configurator.py","lineNumber":416,"sourceCode":"                    max_total_num_tokens=sizes.max_total_num_tokens,\n                )\n            elif self.is_hybrid_swa and not is_deepseek_v4(self.model_config.hf_config):\n                if pd_enabled:\n                    raise ValueError(\n                        \"--enable-unified-memory with PD disaggregation does \"\n                        \"not support hybrid-SWA models yet (no whole-envelope \"\n                        \"transfer scheme for the SWA sub-pool). Drop \"\n                        \"--enable-unified-memory or run without PD.\"\n                    )\n                bundle = self._init_unified_swa_pools(\n                    max_num_reqs=sizes.max_running_requests,\n                    full_max_total_num_tokens=sizes.full_max_total_num_tokens,\n                    swa_max_total_num_tokens=sizes.swa_max_total_num_tokens,\n                )\n            else:\n                # Fail loud, not silently fall through to the normal pools (which would\n                # leave the flag a no-op). The feature replaces the HYBRID pools only.\n                raise ValueError(\n                    \"--enable-unified-memory only supports hybrid Mamba and \"\n                    \"hybrid sliding-window-attention models (DeepSeek-V4 excluded); \"\n                    f\"the current model ({self.model_config.hf_config.architectures}) \"\n                    \"is neither, so the unified memory pool cannot be built. Drop \"\n                    \"--enable-unified-memory for this model.\"\n                )\n            return _InitializedPools(\n                req_to_token_pool=bundle.req_to_token_pool,\n                token_to_kv_pool=bundle.token_to_kv_pool,\n                token_to_kv_pool_allocator=bundle.token_to_kv_pool_allocator,\n                unified_memory_pool=bundle.unified_memory_pool,\n            )\n\n        # The unified allocator hands out VIRTUAL token ids from the whole\n        # virtual space (> max_total_num_tokens); the direct-indexed draft\n        # pool must be sized by that space.\n        draft_virtual_id_space: Optional[int] = None\n        if self.is_draft_worker and token_to_kv_pool_allocator is not None:","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/kv_cache_configurator.py#L398-L434","documentation":"--enable-unified-memory replaces only the HYBRID pools and supports hybrid Mamba and hybrid SWA models (DeepSeek-V4 excluded). This error fires when the flag is passed for any other architecture, refusing to silently fall through to the normal pools where the flag would be a no-op.","triggerScenarios":"Pass --enable-unified-memory with a model whose architectures are neither hybrid-Mamba nor hybrid-SWA (or is DeepSeek-V4); _init_pools hits the else branch and raises.","commonSituations":"Copy-pasting a launch command with the new flag onto a standard dense/LLM model, or onto DeepSeek-V4.","solutions":["Drop --enable-unified-memory for this model","Switch to a supported hybrid Mamba or hybrid SWA model if you need the feature"],"exampleFix":"# before\npython -m sglang.launch_server --model llama-... --enable-unified-memory\n# after\npython -m sglang.launch_server --model llama-...","handlingStrategy":"validation","validationCode":"arch = model_config.hf_config.architectures\nsupported = is_hybrid_mamba(model_config) or (is_hybrid_swa(model_config) and not is_deepseek_v4(model_config.hf_config))\nif server_args.enable_unified_memory and not supported:\n    server_args.enable_unified_memory = False  # or abort","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass --enable-unified-memory for hybrid Mamba / hybrid SWA checkpoints","Validate flags in a pre-launch config linter"],"tags":["unified-memory","model-architecture","kv-cache","boot-config"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}