recipe.toml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.76.1 image (see
  4. # docker-images/deepseek-v4-flash-dspark).
  5. #
  6. # Image: sparkrun-vllm-ds4-gb10:fixed
  7. # production-3.76.1 base (DSpark, b12x MoE, patched NCCL 2.30.4, multi-node
  8. # fixes) + instanttensor for faster model loading.
  9. # Model: deepseek-ai/DeepSeek-V4-Flash-0731 — official release.
  10. # 0731 (and the -DSpark preview) both have dspark_block_size = 5. This image's
  11. # speculator hard-rejects num_speculative_tokens > block_size
  12. # (v1/worker/gpu/spec_decode/dspark/speculator.py, "must be <= dspark_block_size"),
  13. # so k=7 (as suggested by the 0731 model card) FAILS to boot. k=5 is the
  14. # model's native draft block and the correct value here.
  15. #
  16. # Note: this image lineage (vLLM 0.2x with the upstream DSpark speculator) does
  17. # NOT have the shared-expert draft-loader bug reported for the older fork
  18. # (tonyd2wild Patch 4). Its loader already maps mtp.*.shared_experts.w1/w3 into
  19. # gate_up_proj (dspark.py load_weights), so no patch is needed.
  20. #
  21. # Reference: Nvidia Developer Forum — DeepSeek-V4-Flash-0731 recipe
  22. # https://forums.developer.nvidia.com/t/deepseek-v4-flash-0731-dspark-1m-nvfp4-kv-2x-dgx-spark/378824
  23. # Encoder reasoning-effort fix source: 0rand's serving stack (thread 372268/708)
  24. # https://forums.developer.nvidia.com/t/deepseek-v4-flash-aiden-recipe-from-reddit-1m-token-session-operational-cuda-12-1-tailored-for-dgx-spark-gb10/372268/708
  25. # (three-level low/high/max ladder; bundled into the :fixed overlay here)
  26. engine = "vllm"
  27. name = "DeepSeek V4 Flash DSpark (vLLM)"
  28. docker_image = "sparkrun-vllm-ds4-gb10:fixed"
  29. model = "deepseek-ai/DeepSeek-V4-Flash-0731"
  30. required_nodes = 2
  31. tensor_parallel_size = 2
  32. pipeline_parallel_size = 1
  33. distributed_backend = "mp"
  34. shm_size = "32gb"
  35. docker_image_dir = "deepseek-v4-flash-dspark"
  36. entrypoint = ["vllm", "serve"]
  37. args = [
  38. "--kv-cache-dtype", "fp8",
  39. "--block-size", "256",
  40. "--load-format", "auto",
  41. "--max-model-len", "524288",
  42. "--max-num-seqs", "16",
  43. "--max-num-batched-tokens", "4096",
  44. "--max-cudagraph-capture-size", "128",
  45. "--gpu-memory-utilization", "0.78",
  46. "--served-model-name", "deepseek-v4-flash",
  47. # Engine backends
  48. "--attention-backend", "FLASHINFER_MLA_SPARSE_DSV4",
  49. "--moe-backend", "b12x",
  50. # Chunked prefill + prefix caching
  51. "--enable-chunked-prefill",
  52. "--enable-prefix-caching",
  53. "--enable-flashinfer-autotune",
  54. # Compilation
  55. "--compilation-config", """
  56. '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}'""",
  57. # Async scheduling
  58. "--async-scheduling",
  59. "--no-scheduler-reserve-full-isl",
  60. # DSpark speculative decoding — k=5 is DeepSeek-V4-Flash's native
  61. # dspark_block_size (0731 == preview). Do NOT raise to k=7 (0731 model-card
  62. # rec): this image hard-rejects k > block_size at boot. draft_sample_method
  63. # matches the image CMD (probabilistic).
  64. "--speculative-config", """
  65. '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic"}'""",
  66. # Tokenizer / reasoning
  67. "--tokenizer-mode", "deepseek_v4",
  68. "--tool-call-parser", "deepseek_v4",
  69. "--reasoning-parser", "deepseek_v4",
  70. "--enable-auto-tool-choice",
  71. # Proven generation defaults (thread 372268/708 serving stack; with
  72. # --generation-config vllm only the override params are applied, so these
  73. # set the served defaults). repetition_penalty 1.0 = identity: the field is
  74. # accepted by the spec but never deviates from no-op during req handling.
  75. "--override-generation-config", """
  76. '{"temperature":0.8,"top_p":0.25,"repetition_penalty":1.0}'""",
  77. "--generation-config", "vllm",
  78. "--default-chat-template-kwargs.thinking=true",
  79. "--default-chat-template-kwargs.reasoning_effort=max",
  80. # Disable custom all-reduce (not needed on GB10 single-NIC)
  81. "--disable-custom-all-reduce",
  82. "--trust-remote-code",
  83. ]
  84. # Persistent compile caches (speed up restarts — see guide §2/§7). The HF
  85. # cache is already mounted at /root/.cache/huggingface by the launcher.
  86. [[extra_mounts]]
  87. host = "~/.cache/vllm-ds4-dspark" # compiled vLLM/attention kernels
  88. container = "/cache"
  89. [[extra_mounts]]
  90. host = "~/.cache/tilelang-ds4" # DSpark speculative-decode kernels
  91. container = "/root/.tilelang"
  92. [env]
  93. # DSpark speculative decoding
  94. VLLM_DSPARK_REPLICATE_MARKOV_W1 = "1"
  95. # b12x MoE (this image's primary path)
  96. VLLM_USE_B12X_MOE = "1"
  97. # VLLM_USE_B12X_MOE = "0" # b12x MoE OFF -> cutlass W4A8 (b12x MoE prefill stalls on GB10)
  98. # b12x suite = REQUIRED by this image
  99. VLLM_USE_B12X_MHC = "1"
  100. VLLM_USE_B12X_WO_PROJECTION = "1"
  101. VLLM_USE_B12X_FP8_GEMM = "1"
  102. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  103. VLLM_USE_V2_MODEL_RUNNER = "1"
  104. VLLM_USE_FLASHINFER_SAMPLER = "1"
  105. VLLM_USE_AOT_COMPILE = "1"
  106. VLLM_USE_MEGA_AOT_ARTIFACT = "0"
  107. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  108. VLLM_MEMORY_PROFILE_INCLUDE_ATTN = "1"
  109. VLLM_PREFIX_CACHE_RETENTION_INTERVAL = "4096"
  110. B12X_MLA_SM120_UNIFIED = "1"
  111. B12X_DENSE_SPLITK_TURBO = "1"
  112. B12X_W4A16_TC_DECODE = "1"
  113. B12X_MHC_MAX_TOKENS = "16384"
  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_CROSS_NIC / NCCL_PROTO come from the cluster [nccl] section (2nodes-dac:
  124. # cross_nic=0, proto=LL,LL128,Simple) — matches the reference compose except
  125. # cross_nic (reference runs 1; our cluster config deliberately uses 0 for this
  126. # single-RoCE topology). NCCL_NVLS_ENABLE mirrors the reference compose.
  127. NCCL_P2P_LEVEL = "SYS"
  128. NCCL_CUMEM_ENABLE = "0"
  129. NCCL_NVLS_ENABLE = "0"
  130. NCCL_IB_TIMEOUT = "24"
  131. NCCL_IB_QPS_PER_CONNECTION = "8"
  132. NCCL_BUFFERSIZE = "16777216"
  133. NCCL_SOCKET_FAMILY = "inet"
  134. # PCIe allreduce not needed on GB10 single-NIC
  135. VLLM_ENABLE_PCIE_ALLREDUCE = "0"
  136. VLLM_PCIE_ALLREDUCE_BACKEND = "cpp"
  137. # GPU device isolation (single GPU per node)
  138. CUDA_VISIBLE_DEVICES = "0"
  139. CUDA_DEVICE_ORDER = "PCI_BUS_ID"
  140. CUDA_CACHE_MAXSIZE = "4294967296"