[Spec] Retire Spec V1 (#27964)

This commit is contained in:
Liangsheng Yin
2026-06-11 16:15:15 -07:00
committed by GitHub
parent 949326d922
commit c0480a88be
46 changed files with 111 additions and 252 deletions
@@ -9,7 +9,6 @@ logger = logging.getLogger(__name__)
def apply_deepseek_v4_defaults(server_args: "ServerArgs", model_arch: str) -> None:
"""Apply DeepSeek V4 model-specific server arg defaults and constraints."""
from sglang.srt.environ import envs
from sglang.srt.server_args import ServerArgs
server_args.attention_backend = "dsv4"
@@ -41,10 +40,6 @@ def apply_deepseek_v4_defaults(server_args: "ServerArgs", model_arch: str) -> No
server_args.speculative_eagle_topk == 1
), f"Only EAGLE speculative algorithm with topk == 1 is supported for {model_arch}"
if not envs.SGLANG_ENABLE_SPEC_V2.get():
envs.SGLANG_ENABLE_SPEC_V2.set(True)
logger.warning("Spec v2 is enabled for EAGLE speculative decoding.")
if server_args.swa_full_tokens_ratio == ServerArgs.swa_full_tokens_ratio:
server_args.swa_full_tokens_ratio = 0.1
logger.info(
@@ -1,9 +1,8 @@
import json
import logging
import os
from typing import TYPE_CHECKING, Optional
from sglang.srt.environ import envs
if TYPE_CHECKING:
from sglang.srt.server_args import ServerArgs
@@ -63,6 +62,15 @@ def handle_speculative_decoding(server_args: "ServerArgs") -> None:
if server_args.speculative_algorithm is not None:
server_args.speculative_algorithm = server_args.speculative_algorithm.upper()
# Removal notice for the retired env var; raw os.getenv on purpose -- the
# Envs descriptor is gone. Drop this check after one release.
if os.getenv("SGLANG_ENABLE_SPEC_V2") is not None:
logger.warning(
"SGLANG_ENABLE_SPEC_V2 has been removed: speculative decoding "
"always runs the V2 worker. Use --disable-overlap-schedule to "
"select the non-overlap (synchronous) path."
)
kwargs = {}
override_config_file = server_args.decrypted_draft_config_file
@@ -230,14 +238,6 @@ def _handle_dflash(server_args: "ServerArgs") -> None:
"Max running requests is reset to 48 for speculative decoding. You can override this by explicitly setting --max-running-requests."
)
# SGLANG_ENABLE_SPEC_V2=False selects the non-overlap (synchronous) spec v2
# path instead of the overlap-scheduled one; both run the V2 worker.
if (
not envs.SGLANG_ENABLE_SPEC_V2.get()
and not server_args.disable_overlap_schedule
):
server_args.disable_overlap_schedule = True
if server_args.enable_mixed_chunk:
server_args.enable_mixed_chunk = False
logger.warning(
@@ -252,14 +252,6 @@ def _handle_frozen_kv_mtp(server_args: "ServerArgs") -> None:
"Max running requests is reset to 48 for speculative decoding. You can override this by explicitly setting --max-running-requests."
)
# SGLANG_ENABLE_SPEC_V2=False selects the non-overlap (synchronous) spec v2
# path instead of the overlap-scheduled one; both run the V2 worker.
if (
not envs.SGLANG_ENABLE_SPEC_V2.get()
and not server_args.disable_overlap_schedule
):
server_args.disable_overlap_schedule = True
if server_args.enable_mixed_chunk:
server_args.enable_mixed_chunk = False
logger.warning(
@@ -284,14 +276,6 @@ def _handle_eagle_family(server_args: "ServerArgs") -> None:
"Max running requests is reset to 48 for speculative decoding. You can override this by explicitly setting --max-running-requests."
)
# SGLANG_ENABLE_SPEC_V2=False selects the non-overlap (synchronous) spec v2
# path instead of the overlap-scheduled one; both run the V2 worker.
if (
not envs.SGLANG_ENABLE_SPEC_V2.get()
and not server_args.disable_overlap_schedule
):
server_args.disable_overlap_schedule = True
if server_args.disable_overlap_schedule:
logger.warning(
"Non-overlap (synchronous) spec v2 is used for eagle/eagle3/standalone "
-1
View File
@@ -623,7 +623,6 @@ class Envs:
SGLANG_ROPE_CACHE_ALIGN = EnvInt(128)
# Overlap Spec V2
SGLANG_ENABLE_SPEC_V2 = EnvBool(True)
SGLANG_ENABLE_OVERLAP_PLAN_STREAM = EnvBool(False)
SGLANG_DFLASH_PREFILL_REFILL_TARGET = EnvInt(None)
+1 -1
View File
@@ -2910,7 +2910,7 @@ class ServerArgs:
else:
raise ValueError(
f"Speculative decoding for {model_arch} is not compatible with radix cache when using --mamba-scheduler-strategy no_buffer."
"To use radix cache with speculative decoding, please use --mamba-scheduler-strategy extra_buffer and set SGLANG_ENABLE_SPEC_V2=1."
"To use radix cache with speculative decoding, please use --mamba-scheduler-strategy extra_buffer."
)
def _handle_sampling_backend(self):
@@ -6,8 +6,8 @@ backend, env overrides). Pair it with the kits in
``sglang.test.kits.spec_server_kits`` to assemble test classes.
The primary axis is ``disable_overlap``:
- ``False`` -> spec v2 (overlap scheduler)
- ``True`` -> spec v1 (overlap disabled)
- ``False`` -> overlap scheduler
- ``True`` -> synchronous (non-overlap) scheduling
"""
import contextlib
@@ -56,7 +56,7 @@ class SpecEagleServerBase(CustomTestCase):
# -- runtime config --
page_size = 1
attention_backend = "flashinfer"
# Primary axis: False -> spec v2 (overlap); True -> spec v1 (overlap off).
# Primary axis: False -> overlap scheduler; True -> synchronous (non-overlap).
disable_overlap = False
mem_fraction_static = 0.75
max_running_requests = 8
@@ -220,7 +220,7 @@ class Eagle3Base(SpecEagleServerBase):
class EagleLlama2Base(SpecEagleServerBase):
"""EAGLE (Llama-2) config preset. topk=8 tree -> spec v1; gsm8k is low."""
"""EAGLE (Llama-2) config preset. topk=8 tree -> synchronous path; gsm8k is low."""
model = DEFAULT_TARGET_MODEL_EAGLE
draft_model = DEFAULT_DRAFT_MODEL_EAGLE
@@ -234,5 +234,5 @@ class EagleLlama2Base(SpecEagleServerBase):
gsm8k_score_thres = 0.20
acc_length_thres = 3.0
batch_accept_len_thres = 1.8
# EAGLE topk>1 already routes to v1; force it explicitly to preserve intent.
env_overrides = ((envs.SGLANG_ENABLE_SPEC_V2, False),)
# topk>1 tree verify runs on the synchronous (non-overlap) path.
disable_overlap = True
@@ -2,7 +2,7 @@
Variants combine this base with `CustomTestCase` and override class
attributes (`attention_backend`, plus optional `speculative_eagle_topk` /
`speculative_num_draft_tokens` / `enable_spec_v2` /
`speculative_num_draft_tokens` / `disable_overlap` /
`enable_deterministic_inference`) to select a backend, deterministic mode,
and the V1 / V2 spec engine.
@@ -37,11 +37,11 @@ class StandaloneServerBase:
# Subclasses set these:
attention_backend: str = ""
# V2 defaults; V1 subclasses override to (2, 7, False).
# Overlap defaults; synchronous subclasses override to (2, 7, True).
speculative_num_steps: int = 4
speculative_eagle_topk: int = 1
speculative_num_draft_tokens: int = 5
enable_spec_v2: bool = True
disable_overlap: bool = False
enable_deterministic_inference: bool = False
@classmethod
@@ -76,20 +76,19 @@ class StandaloneServerBase:
# please don't do this if you want to make your inference workload faster
envs.SGLANG_JIT_DEEPGEMM_PRECOMPILE.set(False)
envs.SGLANG_ENABLE_JIT_DEEPGEMM.set(False)
if not cls.enable_spec_v2:
envs.SGLANG_ENABLE_SPEC_V2.set(False)
other_args = cls.get_server_args()
if cls.disable_overlap:
other_args = other_args + ["--disable-overlap-schedule"]
cls.process = popen_launch_server(
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=cls.get_server_args(),
other_args=other_args,
)
@classmethod
def tearDownClass(cls):
kill_process_tree(cls.process.pid)
if not cls.enable_spec_v2:
envs.SGLANG_ENABLE_SPEC_V2.clear()
def test_gsm8k(self):
requests.get(self.base_url + "/flush_cache")