Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/configs/nvidia-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,24 @@ qwen3.5-fp4-b200-sglang:
search-space:
- { tp: 4, ep: 1, conc-start: 4, conc-end: 128 }

qwen3.5-fp4-b200-sglang-mtp:
image: lmsysorg/sglang:nightly-dev-20260402-d7256eb6
model: nvidia/Qwen3.5-397B-A17B-NVFP4
model-prefix: qwen3.5
runner: b200
precision: fp4
framework: sglang
multinode: false
seq-len-configs:
- isl: 1024
osl: 1024
search-space:
- { tp: 4, ep: 1, conc-start: 4, conc-end: 128, spec-decoding: mtp }
- isl: 8192
osl: 1024
search-space:
- { tp: 4, ep: 1, conc-start: 4, conc-end: 128, spec-decoding: mtp }

glm5-fp8-b200-sglang:
image: lmsysorg/sglang:nightly-dev-cu13-20260317-1eea7448
model: zai-org/GLM-5-FP8
Expand Down
107 changes: 107 additions & 0 deletions benchmarks/single_node/qwen3.5_fp4_b200_mtp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env bash

source "$(dirname "$0")/../benchmark_lib.sh"

check_env_vars \
MODEL \
TP \
CONC \
ISL \
OSL \
RANDOM_RANGE_RATIO \
RESULT_FILENAME \
EP_SIZE

if [[ -n "$SLURM_JOB_ID" ]]; then
echo "JOB $SLURM_JOB_ID running on $SLURMD_NODENAME"
fi

nvidia-smi

hf download "$MODEL"

export NCCL_NVLS_ENABLE=1
export SGL_ENABLE_JIT_DEEPGEMM=false
export SGLANG_ENABLE_FLASHINFER_GEMM=true
export PYTHONUNBUFFERED=1

SERVER_LOG=/workspace/server.log
PORT=${PORT:-8888}

# Default: recv every ~10 requests; if CONC >= 16, relax to ~30 requests between scheduler recv polls.
if [[ $CONC -ge 16 ]]; then
SCHEDULER_RECV_INTERVAL=30
else
SCHEDULER_RECV_INTERVAL=10
fi

MEM_FRAC_STATIC=0.85
CHUNKED_PREFILL_SIZE=32768
MAX_PREFILL_TOKENS=32768
CUDA_GRAPH_MAX_BATCH_SIZE=$CONC
MAX_RUNNING_REQUESTS=128
CONTEXT_LENGTH=$((ISL + OSL + 20))
if [ "${EVAL_ONLY}" = "true" ]; then
setup_eval_context
CONTEXT_LENGTH="$EVAL_MAX_MODEL_LEN"
fi

if [[ $TP -eq 8 ]]; then
EXTRA_ARGS="--enable-flashinfer-allreduce-fusion"
else
EXTRA_ARGS=""
fi

echo "SCHEDULER_RECV_INTERVAL: $SCHEDULER_RECV_INTERVAL, CONC: $CONC, ISL: $ISL, OSL: $OSL"

# Start GPU monitoring (power, temperature, clocks every second)
start_gpu_monitor

set -x
PYTHONNOUSERSITE=1 python3 -m sglang.launch_server --model-path=$MODEL --host=0.0.0.0 --port=$PORT \
--trust-remote-code \
--tensor-parallel-size=$TP --data-parallel-size=1 --ep-size $EP_SIZE \
--quantization modelopt_fp4 --fp4-gemm-backend flashinfer_cutlass \
--kv-cache-dtype fp8_e4m3 \
--mamba-ssm-dtype bfloat16 \
--cuda-graph-max-bs $CUDA_GRAPH_MAX_BATCH_SIZE --max-running-requests $MAX_RUNNING_REQUESTS \
--mem-fraction-static $MEM_FRAC_STATIC --chunked-prefill-size $CHUNKED_PREFILL_SIZE --max-prefill-tokens $MAX_PREFILL_TOKENS \
--context-length $CONTEXT_LENGTH --disable-radix-cache \
--attention-backend trtllm_mha --moe-runner-backend flashinfer_trtllm \
$EXTRA_ARGS --scheduler-recv-interval $SCHEDULER_RECV_INTERVAL \
--tokenizer-worker-num 6 --stream-interval 30 \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
Comment on lines +56 to +75
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 The new qwen3.5_fp4_b200_mtp.sh script is missing SGLANG_ENABLE_SPEC_V2=1 in its server launch command, which is present in most comparable MTP scripts (qwen3.5_fp8_h200_mtp.sh, qwen3.5_fp8_b300_mtp.sh, dsr1_fp8_b200_mtp.sh, dsr1_fp8_b300_mtp.sh). Without this env var, SGLang may fall back to the older Spec V1 speculative decoding code path, producing non-representative MTP benchmark numbers. Add SGLANG_ENABLE_SPEC_V2=1 before the PYTHONNOUSERSITE=1 python3 -m sglang.launch_server invocation to match the established pattern.

Extended reasoning...

What the bug is and how it manifests

The server launch command in benchmarks/single_node/qwen3.5_fp4_b200_mtp.sh (lines 56–75) starts with PYTHONNOUSERSITE=1 python3 -m sglang.launch_server ... but is missing the SGLANG_ENABLE_SPEC_V2=1 environment variable prefix. SGLang's speculative decoding has two implementations: the newer, optimized Spec V2 path and the older Spec V1 path. Without the env var, SGLang defaults to Spec V1, producing suboptimal MTP throughput numbers.

The specific code path that triggers it

Lines 56–75 of the new script launch the SGLang server with EAGLE flags (--speculative-algorithm EAGLE --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4) but omit SGLANG_ENABLE_SPEC_V2=1. Compare with qwen3.5_fp8_h200_mtp.sh line 38 and qwen3.5_fp8_b300_mtp.sh line 34, both of which prepend SGLANG_ENABLE_SPEC_V2=1 to identical launch patterns.

Why existing code doesn't prevent it

The script was created by copying the non-MTP base script qwen3.5_fp4_b200.sh and adding EAGLE flags — but the non-MTP base has no need for SGLANG_ENABLE_SPEC_V2=1, so the env var was never present to copy over. There is no linting or template enforcement to catch this class of omission.

Addressing the refutation

One verifier noted that qwen3.5_fp8_b200_mtp.sh also lacks SGLANG_ENABLE_SPEC_V2=1, suggesting this may be an intentional pattern for same-hardware (B200) scripts or that newer nightly images default to Spec V2. This is a fair observation. However: (1) there is no documented evidence that the nightly-dev-20260402 image enables Spec V2 by default; (2) PR #1017 was explicitly created to retroactively add this var to qwen3.5_fp8_h200_mtp.sh after it was missed, establishing that its omission produces non-representative results and must be corrected; (3) four of the six single-node MTP SGLang scripts include it. The safer and more consistent choice is to explicitly set the env var.

Step-by-step proof

  1. Runner picks up qwen3.5-fp4-b200-sglang-mtp config (spec-decoding: mtp → selects qwen3.5_fp4_b200_mtp.sh).
  2. Script executes: PYTHONNOUSERSITE=1 python3 -m sglang.launch_server ... --speculative-algorithm EAGLE ...
  3. Because SGLANG_ENABLE_SPEC_V2 is unset, SGLang initializes the legacy Spec V1 speculative decoding engine.
  4. Benchmark runs against a server using Spec V1 instead of the optimized Spec V2, yielding lower (non-representative) MTP throughput numbers compared to the H200 and B300 MTP configs.

How to fix it

Prefix the launch command with SGLANG_ENABLE_SPEC_V2=1, matching the pattern in qwen3.5_fp8_b300_mtp.sh line 34:

SGLANG_ENABLE_SPEC_V2=1 PYTHONNOUSERSITE=1 python3 -m sglang.launch_server ...

--speculative-num-draft-tokens 4 \
> $SERVER_LOG 2>&1 &

SERVER_PID=$!

# Wait for server to be ready
wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID"

pip install -q datasets pandas

run_benchmark_serving \
--model "$MODEL" \
--port "$PORT" \
--backend vllm \
--input-len "$ISL" \
--output-len "$OSL" \
--random-range-ratio "$RANDOM_RANGE_RATIO" \
--num-prompts "$((CONC * 10))" \
--max-concurrency "$CONC" \
--result-filename "$RESULT_FILENAME" \
--result-dir /workspace/ \
--use-chat-template

# After throughput, run evaluation only if RUN_EVAL is true
if [ "${RUN_EVAL}" = "true" ]; then
run_eval --framework lm-eval --port "$PORT"
append_lm_eval_summary
fi

# Stop GPU monitoring
stop_gpu_monitor
set +x
10 changes: 10 additions & 0 deletions perf-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1586,3 +1586,13 @@
- "Mirrors the glm5-fp8-mi355x-sglang non-MTP recipe and adds EAGLE speculative decoding (num-steps=3, eagle-topk=1, num-draft-tokens=4) behind SGLANG_ENABLE_SPEC_V2=1"
- "Configs: 1k1k and 8k1k, TP=8 conc 4-64 with spec-decoding=mtp"
pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/XXXX

- config-keys:
- qwen3.5-fp4-b200-sglang-mtp
description:
- "Add Qwen3.5-397B-A17B NVFP4 B200 SGLang MTP benchmark"
- "Image: lmsysorg/sglang:nightly-dev-20260402-d7256eb6"
- "Model: nvidia/Qwen3.5-397B-A17B-NVFP4"
- "Mirrors the qwen3.5-fp4-b200-sglang non-MTP recipe and adds EAGLE speculative decoding (num-steps=3, eagle-topk=1, num-draft-tokens=4)"
- "Configs: 1k1k and 8k1k, TP=4/EP=1 conc 4-128 with spec-decoding=mtp"
pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/XXXX
Loading