{"record":{"id":"e0010de948aa50ef","repo":"sgl-project/sglang","slug":"speculative-use-rejection-sampling-is-incompatib","errorCode":null,"errorMessage":"--speculative-use-rejection-sampling is incompatible with --speculative-accept-threshold-single / --speculative-accept-threshold-acc; rejection sampling ignores the accept thresholds.","messagePattern":"--speculative-use-rejection-sampling is incompatible with --speculative-accept-threshold-single / --speculative-accept-threshold-acc; rejection sampling ignores the accept thresholds\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/arg_groups/speculative_hook.py","lineNumber":786,"sourceCode":"        # Resolved alias by now: NEXTN -> EAGLE, Gemma4 draft -> FROZEN_KV_MTP.\n        # Only the EAGLE/EAGLE3 draft workers emit a target-vocab proposal that\n        # the rejection-sampling kernel consumes; everything else (STANDALONE,\n        # FROZEN_KV_MTP, NGRAM, DFLASH) is unsupported.\n        if cfg.speculative_algorithm not in (\"EAGLE\", \"EAGLE3\"):\n            raise NotImplementedError(\n                \"--speculative-use-rejection-sampling is only supported for \"\n                \"EAGLE / EAGLE3 / NEXTN, not \"\n                f\"speculative_algorithm={cfg.speculative_algorithm}.\"\n            )\n        if cfg.speculative_eagle_topk != 1:\n            raise ValueError(\n                \"--speculative-use-rejection-sampling requires --speculative-eagle-topk=1.\"\n            )\n        if (\n            cfg.speculative_accept_threshold_single != 1.0\n            or cfg.speculative_accept_threshold_acc != 1.0\n        ):\n            raise ValueError(\n                \"--speculative-use-rejection-sampling is incompatible with \"\n                \"--speculative-accept-threshold-single / \"\n                \"--speculative-accept-threshold-acc; rejection sampling ignores \"\n                \"the accept thresholds.\"\n            )\n        if cfg.enable_deterministic_inference:\n            raise ValueError(\n                \"--speculative-use-rejection-sampling is incompatible with \"\n                \"--enable-deterministic-inference; the sampling kernel draws \"\n                \"coins from the global RNG and is not batch-invariant.\"\n            )\n\n        from sglang.srt.arg_groups.overrides import resolved_view\n\n        if (\n            resolved_view(server_args).enable_multi_layer_eagle\n            and cfg.speculative_eagle_topk != 1\n        ):","sourceCodeStart":768,"sourceCodeEnd":804,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/arg_groups/speculative_hook.py#L768-L804","documentation":"Rejection sampling already guarantees exact sampling from the target distribution — every proposal is accepted/rejected with the exact target probability, so accept-threshold heuristics are meaningless. SGLang therefore refuses the combination of --speculative-use-rejection-sampling with non-default --speculative-accept-threshold-single or --speculative-accept-threshold-acc (both default 1.0) rather than silently ignoring them.","triggerScenarios":"Launching with --speculative-use-rejection-sampling plus --speculative-accept-threshold-single != 1.0 or --speculative-accept-threshold-acc != 1.0. Checked in _handle_eagle_family during handle_server_args.","commonSituations":"Tuning relaxed-acceptance thresholds (e.g. 0.95 / 0.85) for higher acceptance rate on a normal EAGLE setup and then flipping on rejection sampling in the same script; carrying over tuned threshold values in a shared config file.","solutions":["Remove the --speculative-accept-threshold-single / --speculative-accept-threshold-acc overrides (let them default to 1.0)","Or explicitly set both to 1.0 alongside rejection sampling","If you want threshold-based relaxed acceptance, drop --speculative-use-rejection-sampling instead"],"exampleFix":"# before\n--speculative-use-rejection-sampling \\\n  --speculative-accept-threshold-single 0.9 \\\n  --speculative-accept-threshold-acc 0.8\n# after\n--speculative-use-rejection-sampling  # thresholds left at default 1.0","handlingStrategy":"validation","validationCode":"if server_args.speculative_use_rejection_sampling:\n    server_args.speculative_accept_threshold_single = 1.0\n    server_args.speculative_accept_threshold_acc = 1.0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't mix relaxed-acceptance tuning with exact rejection sampling","Reset threshold overrides to defaults when switching verify mode"],"tags":["speculative-decoding","rejection-sampling","accept-threshold","server-args"],"backgroundTag":"incompatible-launch-flags","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}