recipe.toml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # DeepSeek-V4-Flash-0731 DSpark — 2× GB10 / DGX Spark, TP=2 over RoCE.
  2. #
  3. # This variant uses eugr's prebuilt b12x image (eugr/spark-vllm-b12x) and
  4. # mirrors eugr's recipes/deepseek-v4-flash-0731.yaml on the b12x branch — the
  5. # stack published in NVIDIA forum comment #28:
  6. # https://forums.developer.nvidia.com/t/instructions-for-running-deepseek-v4-flash-with-dspark-using-eugrs-repo/376220/28
  7. # ("While I'm working on integrating b12x into the build/test pipeline and
  8. # merging into main, I pushed prebuilt container as eugr/spark-vllm-b12x …
  9. # this version supports 3x Sparks with TP=3! To use, just add --tp 3.")
  10. #
  11. # Image: eugr/spark-vllm-b12x:sm121 — the prebuilt base with the
  12. # instanttensor-hybrid-draft-loader mod baked in at build time (see
  13. # docker-images/deepseek-v4-flash-eugr). eugr's recipe applies that mod via
  14. # run-recipe.sh --apply-mod; sm121 has no runtime mod-upload step for Docker
  15. # recipes, so the overlay patches vLLM's model_loader get_model() at image
  16. # build time instead. The recipe therefore carries no [mods] block.
  17. #
  18. # The mod keeps InstantTensor for the primary model while letting the embedded
  19. # dspark/MTP draft use lazy safetensors (avoids a second InstantTensor
  20. # GPU-streaming pass over the checkpoint). It activates only when
  21. # --load-format instanttensor is set (which this recipe does).
  22. #
  23. # Model: deepseek-ai/DeepSeek-V4-Flash-0731 — official release; native
  24. # dspark_block_size = 5, so num_speculative_tokens = 5.
  25. #
  26. # Differences vs recipes/deepseek-v4-flash (aidendle94 production-3.75 image):
  27. # - attention backend B12X_MLA_SPARSE (eugr) vs FLASHINFER_MLA_SPARSE_DSV4
  28. # - --linear-backend b12x + --load-format instanttensor (the mod's trigger)
  29. # - --reasoning-config pinned to deepseek_v4 parser w/ empty start/end strs
  30. # - draft_sample_method probabilistic + draft attention_backend B12X_MLA_SPARSE
  31. # - max_num_seqs=8 / batched=8192 / cudagraph=64 (eugr defaults)
  32. # - VLLM_USE_MEGA_AOT_ARTIFACT="-1" (eugr) vs "0"
  33. #
  34. # 3× Sparks (TP=3): bump tensor_parallel_size + required_nodes to 3 (the eugr
  35. # image supports it per comment #28). k=5 is unchanged (model-native).
  36. engine = "vllm"
  37. name = "DeepSeek V4 Flash DSpark (eugr b12x)"
  38. docker_image = "eugr/spark-vllm-b12x:sm121"
  39. model = "deepseek-ai/DeepSeek-V4-Flash-0731"
  40. required_nodes = 2
  41. tensor_parallel_size = 2
  42. pipeline_parallel_size = 1
  43. distributed_backend = "mp"
  44. shm_size = "32gb"
  45. docker_image_dir = "deepseek-v4-flash-eugr"
  46. entrypoint = ["vllm", "serve"]
  47. args = [
  48. "--kv-cache-dtype", "fp8",
  49. "--block-size", "256",
  50. "--load-format", "instanttensor",
  51. "--max-model-len", "auto",
  52. "--max-num-seqs", "8",
  53. "--max-num-batched-tokens", "8192",
  54. "--max-cudagraph-capture-size", "64",
  55. # 0.78, not higher: the SvangenStudios agent-serving benchmark (v0.1.1) on
  56. # this exact stack found "0.80 boots but dies under traffic". GMU is a KV
  57. # lever, not a safety lever, when weights dominate memory (~77.7 GiB of
  58. # ~119.6 GiB node). For interactive agent traffic prefer the
  59. # deepseek-v4-flash-eugr-agent profile (2048 chunk). See
  60. # specs/tech-architecture/dgx-spark-agent-serving-findings.md.
  61. "--gpu-memory-utilization", "0.78",
  62. "--served-model-name", "deepseek-v4-flash",
  63. # Engine backends — b12x across attention / MoE / linear
  64. "--attention-backend", "B12X_MLA_SPARSE",
  65. "--moe-backend", "b12x",
  66. "--linear-backend", "b12x",
  67. # Prefix caching
  68. "--enable-prefix-caching",
  69. # Compilation
  70. "--compilation-config", """
  71. '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}'""",
  72. # DSpark speculative decoding — k=5 (DeepSeek-V4-Flash native
  73. # dspark_block_size). draft_sample_method per eugr recipe; draft attention
  74. # backend B12X_MLA_SPARSE. The baked mod makes the embedded draft load via
  75. # lazy safetensors while the target stays on InstantTensor.
  76. "--speculative-config", """
  77. '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","attention_backend":"B12X_MLA_SPARSE"}'""",
  78. # Tokenizer / reasoning — reasoning-config pins the parser + empty
  79. # reasoning markers (deepseek_v4 tokenizer mode emits them itself).
  80. "--tokenizer-mode", "deepseek_v4",
  81. "--tool-call-parser", "deepseek_v4",
  82. "--reasoning-parser", "deepseek_v4",
  83. "--reasoning-config", """
  84. '{"reasoning_parser":"deepseek_v4","reasoning_start_str":"","reasoning_end_str":""}'""",
  85. "--enable-auto-tool-choice",
  86. "--generation-config", "vllm",
  87. "--default-chat-template-kwargs.thinking=true",
  88. "--default-chat-template-kwargs.reasoning_effort=high",
  89. "--disable-custom-all-reduce",
  90. "--trust-remote-code",
  91. ]
  92. # Persistent vLLM compile cache (speeds up restarts). Mounted at vLLM's
  93. # default cache root for root (/root/.cache/vllm); the HF cache is already
  94. # mounted at /root/.cache/huggingface by the launcher.
  95. [[extra_mounts]]
  96. host = "~/.cache/vllm-ds4-eugr"
  97. container = "/root/.cache/vllm"
  98. [env]
  99. # --- b12x + compile (from eugr's recipe env, verbatim) ---
  100. CUTE_DSL_ARCH = "sm_121a"
  101. VLLM_USE_AOT_COMPILE = "1"
  102. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  103. VLLM_USE_MEGA_AOT_ARTIFACT = "-1"
  104. VLLM_MEMORY_PROFILE_INCLUDE_ATTN = "1"
  105. VLLM_USE_FLASHINFER_SAMPLER = "1"
  106. VLLM_USE_B12X_WO_PROJECTION = "1"
  107. VLLM_USE_B12X_MHC = "1"
  108. VLLM_USE_B12X_FP8_GEMM = "1"
  109. VLLM_USE_B12X_MOE = "1"
  110. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  111. VLLM_USE_V2_MODEL_RUNNER = "1"
  112. B12X_MLA_SM120_UNIFIED = "1"
  113. B12X_MOE_FORCE_A8 = "1"
  114. # --- arch / memory / GPU isolation (operational on the sm121 cluster) ---
  115. TORCH_CUDA_ARCH_LIST = "12.1a"
  116. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  117. OMP_NUM_THREADS = "4"
  118. CUDA_VISIBLE_DEVICES = "0"
  119. CUDA_DEVICE_ORDER = "PCI_BUS_ID"
  120. CUDA_CACHE_MAXSIZE = "4294967296"
  121. # --- offline ---
  122. HF_HUB_OFFLINE = "1"
  123. # --- NCCL overrides (GB10 single-NIC tuning; image-agnostic — mirrors
  124. # recipes/deepseek-v4-flash. The launcher still injects IB/HCA/socket
  125. # vars from the cluster config; these are recipe-level extras.) ---
  126. NCCL_P2P_LEVEL = "SYS"
  127. NCCL_CUMEM_ENABLE = "0"
  128. NCCL_IB_TIMEOUT = "24"
  129. NCCL_IB_QPS_PER_CONNECTION = "8"
  130. NCCL_BUFFERSIZE = "16777216"
  131. NCCL_SOCKET_FAMILY = "inet"
  132. # PCIe allreduce not needed on GB10 single-NIC
  133. VLLM_ENABLE_PCIE_ALLREDUCE = "0"
  134. VLLM_PCIE_ALLREDUCE_BACKEND = "cpp"