recipe.toml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # DeepSeek-V4-Flash-DSpark — 2× GB10 / DGX Spark, TP=2 over RoCE.
  2. # DSpark speculative decoding on the official DeepSeek-V4-Flash-0731 release
  3. # via the local :fixed overlay on aidendle94's production-3.8 image (see
  4. # docker-images/deepseek-v4-flash-dspark).
  5. #
  6. # Image: sparkrun-vllm-ds4-gb10:fixed
  7. # production-3.8 clean-overlay base (vLLM 0.21.1, b12x MoE, NCCL 2.30.4,
  8. # flashinfer 0.6.12, opt-in DSPARK tiny-A8 decode kernel) + patched
  9. # deepseek_v4 tokenizer (thinking_mode kwarg, anti-injection, strict JSON).
  10. # Model: deepseek-ai/DeepSeek-V4-Flash-0731 — official release.
  11. # 0731 (and the -DSpark preview) both have dspark_block_size = 5. This image's
  12. # speculator hard-rejects num_speculative_tokens > block_size
  13. # (v1/worker/gpu/spec_decode/dspark/speculator.py, "must be <= dspark_block_size"),
  14. # so k=7 (as suggested by the 0731 model card) FAILS to boot. k=5 is the
  15. # model's native draft block and the correct value here.
  16. #
  17. # Note: this image lineage (vLLM 0.2x with the upstream DSpark speculator) does
  18. # NOT have the shared-expert draft-loader bug reported for the older fork
  19. # (tonyd2wild Patch 4). Its loader already maps mtp.*.shared_experts.w1/w3 into
  20. # gate_up_proj (dspark.py load_weights), so no patch is needed.
  21. #
  22. # Reference: Nvidia Developer Forum — DeepSeek-V4-Flash-0731 recipe
  23. # https://forums.developer.nvidia.com/t/deepseek-v4-flash-0731-dspark-1m-nvfp4-kv-2x-dgx-spark/378824
  24. engine = "vllm"
  25. name = "DeepSeek V4 Flash DSpark (vLLM)"
  26. docker_image = "sparkrun-vllm-ds4-gb10:fixed"
  27. model = "deepseek-ai/DeepSeek-V4-Flash-0731"
  28. required_nodes = 2
  29. tensor_parallel_size = 2
  30. pipeline_parallel_size = 1
  31. distributed_backend = "mp"
  32. shm_size = "32gb"
  33. docker_image_dir = "deepseek-v4-flash-dspark"
  34. entrypoint = ["vllm", "serve"]
  35. args = [
  36. "--kv-cache-dtype", "fp8",
  37. "--block-size", "256",
  38. "--load-format", "auto",
  39. "--max-model-len", "393216",
  40. "--max-num-seqs", "16",
  41. "--max-num-batched-tokens", "16536",
  42. "--max-cudagraph-capture-size", "16",
  43. "--gpu-memory-utilization", "0.9",
  44. "--served-model-name", "deepseek-v4-flash", "default",
  45. # Attention: vLLM 0.21 (production-3.8) renamed/removed the SM120 sparse-MLA
  46. # backend names (FLASHINFER_MLA_SPARSE_DSV4 no longer exists). On GB10 the
  47. # platform auto-selects SPARSE_MLA_SM120 for MLA; the b12x unified sparse-MLA
  48. # backend (same fp8_ds_mla envelope) is selected explicitly via
  49. # VLLM_ATTENTION_BACKEND=B12X_MLA_SPARSE (env below) to pair with the b12x
  50. # MoE + tiny-decode path.
  51. "--moe-backend", "b12x",
  52. # Chunked prefill + prefix caching
  53. "--enable-chunked-prefill",
  54. "--enable-prefix-caching",
  55. "--enable-flashinfer-autotune",
  56. # Compilation
  57. "--compilation-config", """
  58. '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}'""",
  59. # Async scheduling
  60. "--async-scheduling",
  61. "--no-scheduler-reserve-full-isl",
  62. "--speculative-config", """
  63. '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"greedy"}'""",
  64. # Tokenizer / reasoning
  65. "--tokenizer-mode", "deepseek_v4",
  66. "--tool-call-parser", "deepseek_v4",
  67. "--reasoning-parser", "deepseek_v4",
  68. "--enable-auto-tool-choice",
  69. "--generation-config", "vllm",
  70. # vLLM 0.21 (production-3.8) accepts default_chat_template_kwargs as a
  71. # single JSON arg (json.loads), not the per-key dotted form used on 3.75.
  72. "--default-chat-template-kwargs", """
  73. '{"thinking":true,"reasoning_effort":"high","temperature":1,"top_p":0.95}'""",
  74. # Disable custom all-reduce (not needed on GB10 single-NIC)
  75. "--disable-custom-all-reduce",
  76. "--trust-remote-code",
  77. ]
  78. # Persistent compile caches (speed up restarts — see guide §2/§7). The HF
  79. # cache is already mounted at /root/.cache/huggingface by the launcher.
  80. [[extra_mounts]]
  81. host = "~/.cache/vllm-ds4-dspark" # compiled vLLM/attention kernels
  82. container = "/cache"
  83. [[extra_mounts]]
  84. host = "~/.cache/tilelang-ds4" # DSpark speculative-decode kernels
  85. container = "/root/.tilelang"
  86. [env]
  87. # DSpark speculative decoding
  88. VLLM_DSPARK_REPLICATE_MARKOV_W1 = "1"
  89. # b12x MoE (this image's primary path)
  90. VLLM_USE_B12X_MOE = "1"
  91. # VLLM_USE_B12X_MOE = "0" # b12x MoE OFF -> cutlass W4A8 (b12x MoE prefill stalls on GB10)
  92. # b12x suite = REQUIRED by this image
  93. VLLM_USE_B12X_MHC = "1"
  94. VLLM_USE_B12X_WO_PROJECTION = "1"
  95. VLLM_USE_B12X_FP8_GEMM = "1"
  96. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  97. VLLM_USE_V2_MODEL_RUNNER = "1"
  98. VLLM_USE_FLASHINFER_SAMPLER = "1"
  99. VLLM_USE_AOT_COMPILE = "1"
  100. VLLM_USE_MEGA_AOT_ARTIFACT = "0"
  101. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  102. B12X_MHC_MAX_TOKENS = "16384"
  103. # vLLM 0.21 (production-3.8): b12x unified sparse-MLA attention for DSV4 on
  104. # GB10 (selects B12xMLASparseBackend; supports fp8_ds_mla KV). No longer
  105. # reachable via --attention-backend (FLASHINFER_MLA_SPARSE_DSV4 removed).
  106. VLLM_ATTENTION_BACKEND = "B12X_MLA_SPARSE"
  107. # DSPARK tiny-A8 decode kernel (production-3.8 /opt/tinydec): routes small-M
  108. # MoE decode (M<=VLLM_B12X_TINY_MAX_M) through the custom w4a8mx Triton
  109. # kernel; stock b12x path otherwise. sitecustomize hook reads these at start.
  110. # Fail-open: any kernel error falls back to stock b12x automatically.
  111. VLLM_B12X_TINY_DECODE = "1"
  112. VLLM_B12X_TINY_MAX_M = "8"
  113. VLLM_B12X_TINY_CHUNK = "8"
  114. # GPU memory management
  115. CUTE_DSL_ARCH = "sm_121a"
  116. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  117. OMP_NUM_THREADS = "4"
  118. # Offline mode
  119. HF_HUB_OFFLINE = "1"
  120. # Compile-time arch hints
  121. TORCH_CUDA_ARCH_LIST = "12.1a"
  122. # NCCL overrides (cluster config ib_hca/socket_ifname used for most; recipe wins last)
  123. NCCL_P2P_LEVEL = "SYS"
  124. NCCL_CUMEM_ENABLE = "0"
  125. NCCL_IB_TIMEOUT = "24"
  126. NCCL_IB_QPS_PER_CONNECTION = "8"
  127. NCCL_BUFFERSIZE = "16777216"
  128. NCCL_SOCKET_FAMILY = "inet"
  129. # PCIe allreduce not needed on GB10 single-NIC
  130. VLLM_ENABLE_PCIE_ALLREDUCE = "0"
  131. VLLM_PCIE_ALLREDUCE_BACKEND = "cpp"
  132. # GPU device isolation (single GPU per node)
  133. CUDA_VISIBLE_DEVICES = "0"
  134. CUDA_DEVICE_ORDER = "PCI_BUS_ID"
  135. CUDA_CACHE_MAXSIZE = "4294967296"