saricles commited on
Commit
0ba0662
·
verified ·
1 Parent(s): 8e8ae7d

run_vllm.sh: default to Marlin NVFP4 MoE + ngram (Agentic profile); SPECULATIVE_CONFIG var; rationale comments

Browse files
Files changed (1) hide show
  1. run_vllm.sh +41 -20
run_vllm.sh CHANGED
@@ -1,14 +1,19 @@
1
  #!/usr/bin/env bash
2
  # run_vllm.sh — reference vLLM launch for MiniMax-M2.7-NVFP4-GB10-AC on dual-Spark TP=2.
3
  #
4
- # Intended as a drop-in starter. Adjust MODEL_PATH, HOST, PORT, and the TP/cluster args
5
- # for your own Ray topology. See README.md §"Running on DGX Spark (Tensor Parallel)"
6
- # for rationale behind every flag.
 
 
 
 
 
7
  #
8
  # Assumes:
9
- # - Ray head + worker are already running (one per Spark)
10
- # - Model is on a shared path or bind-mounted into both containers at MODEL_PATH
11
- # - vllm 0.19 with FlashInfer MoE FP4 support
12
 
13
  set -euo pipefail
14
 
@@ -23,29 +28,44 @@ MAX_NUM_BATCHED_TOKENS="${MAX_NUM_BATCHED_TOKENS:-32768}"
23
  TP_SIZE="${TP_SIZE:-2}"
24
 
25
  # --- Tuned environment variables ----------------------------------------------
26
- # Forum + vendor-recipe validated for MiniMax-M2.7 NVFP4 on Blackwell/GB10.
27
- # The single biggest win is VLLM_USE_FLASHINFER_MOE_FP4=1 many older images
28
- # default this to 0, which falls back to the slower CUTLASS MoE path.
 
 
 
 
 
29
 
30
- export VLLM_USE_FLASHINFER_MOE_FP4=1
31
- export VLLM_NVFP4_GEMM_BACKEND=flashinfer-cutlass
32
- export VLLM_FLASHINFER_MOE_BACKEND=throughput
33
  export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
34
  export VLLM_FLOAT32_MATMUL_PRECISION=high
 
35
  export VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=1
36
- export SAFETENSORS_FAST_GPU=1
37
- export OMP_NUM_THREADS=8
 
 
 
 
38
 
39
  # --- Compilation config -------------------------------------------------------
40
- # cudagraph_mode=none is INTENTIONAL for dual-Spark Ray TP.
41
  # PIECEWISE captures cleanly in current vLLM builds (historical deadlock is fixed)
42
- # but measurably regresses decode throughput 12–20% on multi-node TP because each
43
- # piece boundary forces a cross-node sync whose cost exceeds the launch-overhead
44
- # savings. Revisit if you change the distributed_executor_backend away from Ray
45
- # or run on a single Spark.
46
 
47
  COMPILATION_CONFIG='{"cudagraph_mode":"none","inductor_compile_config":{"combo_kernels":false,"benchmark_combo_kernel":false,"max_autotune":false,"max_autotune_gemm":false}}'
48
 
 
 
 
 
 
 
 
 
 
49
  # --- vLLM serve ---------------------------------------------------------------
50
  exec vllm serve "$MODEL_PATH" \
51
  --host "$HOST" --port "$PORT" \
@@ -64,4 +84,5 @@ exec vllm serve "$MODEL_PATH" \
64
  --trust-remote-code \
65
  --enable-auto-tool-choice --tool-call-parser minimax_m2 \
66
  --reasoning-parser minimax_m2_append_think \
67
- --compilation-config "$COMPILATION_CONFIG"
 
 
1
  #!/usr/bin/env bash
2
  # run_vllm.sh — reference vLLM launch for MiniMax-M2.7-NVFP4-GB10-AC on dual-Spark TP=2.
3
  #
4
+ # Ships configured for the "Agentic" deployment profile (Marlin NVFP4 MoE + ngram speculative
5
+ # decoding). Comment out the --speculative-config line below to switch to the
6
+ # "Throughput-stable" profile for novel-text / batch workloads.
7
+ #
8
+ # See DEPLOYMENT.md in this repo for:
9
+ # - Profile tradeoffs and when to pick which
10
+ # - Measured numbers on 2× DGX Spark (GB10, SM 12.1)
11
+ # - Observations, caveats, and links to the community threads / PRs that informed this recipe.
12
  #
13
  # Assumes:
14
+ # - Ray head + worker already running (one per Spark)
15
+ # - Model mounted/available at $MODEL_PATH on both hosts
16
+ # - vLLM >= 0.19.x with the Marlin NVFP4 backend built in (eugr/spark-vllm-docker nightly is the reference image)
17
 
18
  set -euo pipefail
19
 
 
28
  TP_SIZE="${TP_SIZE:-2}"
29
 
30
  # --- Tuned environment variables ----------------------------------------------
31
+ # Forum + vendor-recipe validated for MiniMax-M2.7 NVFP4 on GB10 (SM 12.1).
32
+ # On SM 12.1, the Marlin NVFP4 MoE backend is currently the fastest path — the
33
+ # FlashInfer CUTLASS NVFP4 MoE path has maturity issues on this specific compute
34
+ # capability (see DEPLOYMENT.md § "Why Marlin MoE on GB10").
35
+
36
+ export SAFETENSORS_FAST_GPU=1
37
+ export OMP_NUM_THREADS=8
38
+ export TORCHINDUCTOR_MAX_AUTOTUNE=0
39
 
 
 
 
40
  export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
41
  export VLLM_FLOAT32_MATMUL_PRECISION=high
42
+ export VLLM_FLASHINFER_MOE_BACKEND=throughput
43
  export VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=1
44
+
45
+ # Marlin NVFP4 MoE path
46
+ export VLLM_NVFP4_GEMM_BACKEND=marlin
47
+ export VLLM_USE_FLASHINFER_MOE_FP4=0
48
+ export VLLM_TEST_FORCE_FP8_MARLIN=1
49
+ export VLLM_MARLIN_USE_ATOMIC_ADD=1
50
 
51
  # --- Compilation config -------------------------------------------------------
52
+ # cudagraph_mode=none is INTENTIONAL on dual-Spark Ray TP.
53
  # PIECEWISE captures cleanly in current vLLM builds (historical deadlock is fixed)
54
+ # but measurably regresses decode 12–20% on multi-node Ray TP because each piece
55
+ # boundary forces a cross-node sync over QSFP56 whose cost exceeds launch-overhead
56
+ # savings. Retest only if you change away from Ray or run on a single Spark.
 
57
 
58
  COMPILATION_CONFIG='{"cudagraph_mode":"none","inductor_compile_config":{"combo_kernels":false,"benchmark_combo_kernel":false,"max_autotune":false,"max_autotune_gemm":false}}'
59
 
60
+ # --- Speculative decoding (Agentic profile) -----------------------------------
61
+ # ngram speculation wins on agentic / code traffic (repeated tool names, file paths,
62
+ # JSON keys) — peak 48.34 tok/s, avg 36.44 tok/s across our 12-prompt agent set.
63
+ # On synthetic benchmarks with low token repetition it slightly regresses decode.
64
+ # To switch to the "Throughput-stable" profile, comment out the SPECULATIVE_CONFIG
65
+ # line below and remove --speculative-config from the vllm serve invocation.
66
+
67
+ SPECULATIVE_CONFIG='{"method":"ngram","num_speculative_tokens":5,"prompt_lookup_max":4,"prompt_lookup_min":2}'
68
+
69
  # --- vLLM serve ---------------------------------------------------------------
70
  exec vllm serve "$MODEL_PATH" \
71
  --host "$HOST" --port "$PORT" \
 
84
  --trust-remote-code \
85
  --enable-auto-tool-choice --tool-call-parser minimax_m2 \
86
  --reasoning-parser minimax_m2_append_think \
87
+ --compilation-config "$COMPILATION_CONFIG" \
88
+ --speculative-config "$SPECULATIVE_CONFIG"