{"record":{"id":"bae2ded76135fc88","repo":"sgl-project/sglang","slug":"dspark-could-not-resolve-speculative-num-draft-tok","errorCode":null,"errorMessage":"DSpark could not resolve speculative_num_draft_tokens; set --speculative-dspark-block-size (= gamma).","messagePattern":"DSpark could not resolve speculative_num_draft_tokens; set --speculative-dspark-block-size \\(= gamma\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/speculative_hook.py","lineNumber":506,"sourceCode":"    if gamma is not None:\n        verify_window = int(gamma) + 1\n        if (\n            cfg.speculative_num_draft_tokens is not None\n            and int(cfg.speculative_num_draft_tokens) != verify_window\n        ):\n            raise ValueError(\n                \"DSpark speculative_num_draft_tokens must equal gamma + 1 \"\n                f\"(= {verify_window} for gamma={gamma}), but got \"\n                f\"speculative_num_draft_tokens={cfg.speculative_num_draft_tokens}.\"\n            )\n        declare_resolution(\n            server_args,\n            \"_handle_dspark\",\n            speculative_num_draft_tokens=verify_window,\n        )\n\n    if cfg.speculative_num_draft_tokens is None:\n        raise ValueError(\n            \"DSpark could not resolve speculative_num_draft_tokens; set \"\n            \"--speculative-dspark-block-size (= gamma).\"\n        )\n    if int(cfg.speculative_num_draft_tokens) < 2:\n        raise ValueError(\n            \"DSpark speculative_num_draft_tokens must be >= 2 (= gamma + 1), \"\n            f\"got {cfg.speculative_num_draft_tokens}.\"\n        )\n\n    if cfg.max_running_requests is None:\n        declare_resolution(\n            server_args,\n            \"_handle_dspark\",\n            max_running_requests=48,\n        )\n        logger.warning(\n            \"Max running requests is reset to 48 for speculative decoding. You can override this by explicitly setting --max-running-requests.\"\n        )","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/speculative_hook.py#L488-L524","documentation":"After defaults and draft-config inference, DSpark still could not determine speculative_num_draft_tokens. This happens when no --speculative-dspark-block-size is given and the draft config provides no usable gamma, leaving the verify window unresolved.","triggerScenarios":"DSpark launch with neither --speculative-dspark-block-size nor a draft config from which gamma can be inferred, and no explicit --speculative-num-draft-tokens.","commonSituations":"Minimal launch command with only algorithm + model paths; draft checkpoint missing the gamma field in its config.json.","solutions":["Add --speculative-dspark-block-size (gamma), which also resolves num_draft_tokens = gamma + 1","Or set --speculative-num-draft-tokens explicitly","Check the draft checkpoint config exposes the block-size/gamma field so it can be inferred"],"exampleFix":"# before\n--speculative-algorithm DSPARK --model-path M --speculative-draft-model-path D\n# after\n--speculative-algorithm DSPARK --model-path M --speculative-draft-model-path D --speculative-dspark-block-size 4","handlingStrategy":"validation","validationCode":"if args.speculative_algorithm == 'DSPARK':\n    if args.speculative_dspark_block_size is None and args.speculative_num_draft_tokens is None:\n        raise SystemExit('set --speculative-dspark-block-size (gamma) for DSPARK')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pin gamma explicitly in DSpark launch configs"],"tags":["speculative-decoding","dspark","missing-argument","num-draft-tokens"],"backgroundTag":"missing-required-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}