{"record":{"id":"cc51dc204e1aa633","repo":"sgl-project/sglang","slug":"host-pool-retraction-does-not-support-pure-swa-mod","errorCode":null,"errorMessage":"Host-pool retraction does not support pure-SWA models.","messagePattern":"Host-pool retraction does not support pure-SWA models\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/mem_cache/registry.py","lineNumber":156,"sourceCode":"        # var that FlexKV's config loader actually reads.\n        if get_memory().flexkv_config_file and not os.environ.get(\"FLEXKV_CONFIG_PATH\"):\n            os.environ[\"FLEXKV_CONFIG_PATH\"] = get_memory().flexkv_config_file\n        return _flexkv_factory(ctx)\n\n    return _create_unified_radix_cache(ctx, server_args, params)\n\n\ndef _create_unified_radix_cache(\n    ctx: TreeCacheBuildContext,\n    server_args: ServerArgs,\n    params: CacheInitParams,\n) -> BasePrefixCache:\n    \"\"\"Initialize a UnifiedRadixCache with proper components and optional HiCache.\"\"\"\n    if get_disagg().disaggregation_decode_retraction_backup == \"host_pool\":\n        if ctx.is_hybrid_ssm:\n            raise ValueError(\"Host-pool retraction does not support Mamba models.\")\n        if ctx.is_hybrid_swa and ctx.full_tokens_per_layer == 0:\n            raise ValueError(\"Host-pool retraction does not support pure-SWA models.\")\n\n    from sglang.srt.mem_cache.unified_cache.components import ComponentType\n    from sglang.srt.mem_cache.unified_radix_cache import UnifiedRadixCache\n\n    tree_components = [ComponentType.FULL]\n    if ctx.is_hybrid_swa:\n        tree_components.append(ComponentType.SWA)\n    if ctx.is_hybrid_ssm:\n        tree_components.append(ComponentType.MAMBA)\n\n    if hasattr(params.req_to_token_pool, \"req_to_c128_sidecar\"):\n        from sglang.srt.hardware_backend.npu.dsv4.c128_sidecar_component import (\n            C128SidecarComponent,\n        )\n\n        tree_components.append(ComponentType.C128)\n        params.component_registry_override = {\n            **(params.component_registry_override or {}),","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/mem_cache/registry.py#L138-L174","documentation":"The unified radix cache factory rejects pure-SWA (sliding-window attention only) models when disagg decode retraction backup is 'host_pool': with full_tokens_per_layer == 0 there is no full-attention KV pool to back up to host, so host-pool retraction is meaningless. Only hybrid SWA models with a nonzero full-attention pool can use it.","triggerScenarios":"disaggregation_decode_retraction_backup='host_pool' with ctx.is_hybrid_swa True and ctx.full_tokens_per_layer == 0 (a sliding-window-only model like Gemma-2/3-style SWA or a pure SWA config).","commonSituations":"Enabling host-pool retraction backup cluster-wide in a PD setup, then serving a pure SWA model that lacks a full KV pool.","solutions":["Disable host_pool retraction backup for pure-SWA models (use the default backup mode)","Give the model a nonzero full-attention pool (hybrid config) if host backup is required","Gate the disagg setting per-model in your serving config"],"exampleFix":"# before\nretraction_backup=host_pool  # pure SWA model\n# after\nretraction_backup=default  # or unset for pure SWA models","handlingStrategy":"validation","validationCode":"if retraction_backup == \"host_pool\" and ctx.is_hybrid_swa and ctx.full_tokens_per_layer == 0:\n    set_retraction_backup(\"default\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use host_pool backup when full_tokens_per_layer > 0"],"tags":["disaggregation","retraction","sliding-window","swa","unified-cache","value-error"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}