{"record":{"id":"ecb93abe08543145","repo":"sgl-project/sglang","slug":"swa-full-tokens-ratio-should-be-in-range-0-1-0","errorCode":null,"errorMessage":"--swa-full-tokens-ratio should be in range (0, 1.0].","messagePattern":"--swa-full-tokens-ratio should be in range \\(0, 1\\.0\\]\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":9160,"sourceCode":"                raise ValueError(\n                    \"The argument disaggregation-decode-enable-offload-kvcache is only supported for decode side.\"\n                )\n            if cfg.hicache_storage_backend is None:\n                raise ValueError(\n                    \"The argument disaggregation-decode-enable-offload-kvcache is only supported when hicache-storage-backend is provided.\"\n                )\n            if cfg.disaggregation_decode_retraction_backup == \"host_pool\":\n                raise ValueError(\n                    \"The arguments disaggregation-decode-enable-offload-kvcache and \"\n                    \"disaggregation-decode-retraction-backup=host_pool are mutually exclusive: \"\n                    \"both build a decode host pool.\"\n                )\n\n        # Validate the effective ratio: model branches may declare a reset\n        # (e.g. Step3p forces 1.0 under hierarchical cache) that supersedes\n        # the user input before it ever takes effect.\n        if not (0 < self._resolved().swa_full_tokens_ratio <= 1.0):\n            raise ValueError(\"--swa-full-tokens-ratio should be in range (0, 1.0].\")\n\n    def _handle_deterministic_inference(self):\n        cfg = resolving_view(self)\n        if cfg.rl_on_policy_target is not None:\n            logger.warning(\n                \"Enable deterministic inference because of rl_on_policy_target.\"\n            )\n            self._declare(\n                \"_handle_deterministic_inference\",\n                enable_deterministic_inference=True,\n            )\n\n            # For VLM\n            envs.SGLANG_VLM_CACHE_SIZE_MB.set(0)\n            # TODO remove this environment variable as a whole\n            envs.SGLANG_ENABLE_DETERMINISTIC_INFERENCE.set(True)\n\n        if cfg.enable_deterministic_inference:","sourceCodeStart":9142,"sourceCodeEnd":9178,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L9142-L9178","documentation":"This ValueError is raised during ServerArgs validation when the effective SWA/full attention tokens ratio falls outside (0, 1.0]. The check runs on the *resolved* value because model branches may reset it (e.g. Step3p forces 1.0 under hierarchical cache), superseding user input before it takes effect.","triggerScenarios":"Launching the server with --swa-full-tokens-ratio 0, a negative value, or a value > 1.0; or a model-specific resolution layer producing an out-of-range effective ratio.","commonSituations":"Setting --swa-full-tokens-ratio 0 expecting to disable full attention; copy-pasting a ratio > 1 from another config; a custom model branch overriding the ratio incorrectly.","solutions":["Set --swa-full-tokens-ratio to a value in (0, 1.0], e.g. 0.8 or 1.0","If you intended full-token cache, use 1.0 explicitly","If using a custom model that overrides the ratio, check its resolution branch sets a valid value"],"exampleFix":"# before\npython -m sglang.launch_server --swa-full-tokens-ratio 0\n# after\npython -m sglang.launch_server --swa-full-tokens-ratio 1.0","handlingStrategy":"validation","validationCode":"ratio = args.swa_full_tokens_ratio\nif args.swa_full_tokens_ratio is not None and not (0 < ratio <= 1.0):\n    raise SystemExit(f\"invalid swa_full_tokens_ratio: {ratio}; must be in (0, 1.0]\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate numeric CLI ranges in your launch wrapper before invoking the server","Prefer omitting the flag to accept model-resolved defaults"],"tags":["sglang","server-args","swa","validation","config"],"backgroundTag":"config-value-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}