Add --speculative-moe-runner-backend server arg (#10183)

This commit is contained in:
Trevor Morris
2025-11-04 00:20:56 -08:00
committed by GitHub
parent 83804bc626
commit dbcf85b7f0
15 changed files with 109 additions and 68 deletions

View File

@@ -36,6 +36,7 @@ from sglang.srt.utils.common import (
SUPPORTED_LORA_TARGET_MODULES,
configure_ipv6,
cpu_has_amx_support,
get_bool_env_var,
get_device,
get_device_memory_capacity,
get_device_sm,
@@ -377,6 +378,7 @@ class ServerArgs:
speculative_accept_threshold_acc: float = 1.0
speculative_token_map: Optional[str] = None
speculative_attention_mode: str = "prefill"
speculative_moe_runner_backend: Optional[str] = None
# For ngram only
speculative_ngram_min_match_window_size: int = 1
speculative_ngram_max_match_window_size: int = 12
@@ -1379,6 +1381,19 @@ class ServerArgs:
"FlashInfer TRTLLM MoE is enabled. --disable-shared-experts-fusion is automatically set."
)
if get_bool_env_var("SGLANG_CUTLASS_MOE"):
logger.warning(
"SGLANG_CUTLASS_MOE is deprecated, use --moe-runner-backend=cutlass and/or --speculative-moe-runner-backend=cutlass instead"
)
assert (
self.quantization == "fp8"
), "cutlass MoE is only supported with fp8 quantization"
self.moe_runner_backend = "cutlass"
if self.moe_runner_backend == "cutlass" and self.quantization == "fp8":
assert (
self.ep_size == 1
), "FP8 Cutlass MoE is only supported with ep_size == 1"
def _handle_a2a_moe(self):
if self.moe_a2a_backend == "deepep":
if self.deepep_mode == "normal":
@@ -2722,6 +2737,13 @@ class ServerArgs:
help="Attention backend for speculative decoding operations (both target verify and draft extend). Can be one of 'prefill' (default) or 'decode'.",
default=ServerArgs.speculative_attention_mode,
)
parser.add_argument(
"--speculative-moe-runner-backend",
type=str,
choices=MOE_RUNNER_BACKEND_CHOICES,
default=ServerArgs.speculative_moe_runner_backend,
help="Choose the runner backend for MoE in speculative decoding.",
)
# Ngram speculative decoding
parser.add_argument(
"--speculative-ngram-min-match-window-size",