recipe.toml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. "--kv-cache-memory-bytes", "20000000000",
  50. "--block-size", "256",
  51. "--load-format", "instanttensor",
  52. "--max-model-len", "1048576",
  53. "--max-num-seqs", "8",
  54. "--max-num-batched-tokens", "8192",
  55. "--max-cudagraph-capture-size", "64",
  56. # 0.78, not higher: the SvangenStudios agent-serving benchmark (v0.1.1) on
  57. # this exact stack found "0.80 boots but dies under traffic". GMU is a KV
  58. # lever, not a safety lever, when weights dominate memory (~77.7 GiB of
  59. # ~119.6 GiB node). For interactive agent traffic prefer the
  60. # deepseek-v4-flash-eugr-agent profile (2048 chunk). See
  61. # specs/tech-architecture/dgx-spark-agent-serving-findings.md.
  62. "--gpu-memory-utilization", "0.78",
  63. "--served-model-name", "deepseek-v4-flash",
  64. # Engine backends — b12x across attention / MoE / linear
  65. "--attention-backend", "B12X_MLA_SPARSE",
  66. "--moe-backend", "b12x",
  67. "--linear-backend", "b12x",
  68. # Prefix caching
  69. "--enable-prefix-caching",
  70. # Compilation
  71. "--compilation-config", """
  72. '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}'""",
  73. # DSpark speculative decoding — k=5 (DeepSeek-V4-Flash native
  74. # dspark_block_size). draft_sample_method per eugr recipe; draft attention
  75. # backend B12X_MLA_SPARSE. The baked mod makes the embedded draft load via
  76. # lazy safetensors while the target stays on InstantTensor.
  77. "--speculative-config", """
  78. '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","attention_backend":"B12X_MLA_SPARSE"}'""",
  79. # Tokenizer / reasoning — reasoning-config pins the parser + empty
  80. # reasoning markers (deepseek_v4 tokenizer mode emits them itself).
  81. "--tokenizer-mode", "deepseek_v4",
  82. "--tool-call-parser", "deepseek_v4",
  83. "--reasoning-parser", "deepseek_v4",
  84. "--reasoning-config", """
  85. '{"reasoning_parser":"deepseek_v4","reasoning_start_str":"","reasoning_end_str":""}'""",
  86. "--enable-auto-tool-choice",
  87. "--generation-config", "vllm",
  88. "--default-chat-template-kwargs.thinking=true",
  89. "--default-chat-template-kwargs.reasoning_effort=high",
  90. "--disable-custom-all-reduce",
  91. "--trust-remote-code",
  92. ]
  93. # Persistent vLLM compile cache (speeds up restarts). Mounted at vLLM's
  94. # default cache root for root (/root/.cache/vllm); the HF cache is already
  95. # mounted at /root/.cache/huggingface by the launcher.
  96. [[extra_mounts]]
  97. host = "~/.cache/vllm-ds4-eugr"
  98. container = "/root/.cache/vllm"
  99. [env]
  100. # --- b12x + compile (from eugr's recipe env, verbatim) ---
  101. CUTE_DSL_ARCH = "sm_121a"
  102. VLLM_USE_AOT_COMPILE = "1"
  103. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  104. VLLM_USE_MEGA_AOT_ARTIFACT = "-1"
  105. VLLM_MEMORY_PROFILE_INCLUDE_ATTN = "1"
  106. VLLM_USE_FLASHINFER_SAMPLER = "1"
  107. VLLM_USE_B12X_WO_PROJECTION = "1"
  108. VLLM_USE_B12X_MHC = "1"
  109. VLLM_USE_B12X_FP8_GEMM = "1"
  110. VLLM_USE_B12X_MOE = "1"
  111. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  112. VLLM_USE_V2_MODEL_RUNNER = "1"
  113. B12X_MLA_SM120_UNIFIED = "1"
  114. B12X_MOE_FORCE_A8 = "1"
  115. # --- arch / memory / GPU isolation (operational on the sm121 cluster) ---
  116. TORCH_CUDA_ARCH_LIST = "12.1a"
  117. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  118. OMP_NUM_THREADS = "4"
  119. CUDA_VISIBLE_DEVICES = "0"
  120. CUDA_DEVICE_ORDER = "PCI_BUS_ID"
  121. CUDA_CACHE_MAXSIZE = "4294967296"
  122. # --- offline ---
  123. HF_HUB_OFFLINE = "1"
  124. # --- NCCL overrides (GB10 single-NIC tuning; image-agnostic — mirrors
  125. # recipes/deepseek-v4-flash. The launcher still injects IB/HCA/socket
  126. # vars from the cluster config; these are recipe-level extras.) ---
  127. NCCL_P2P_LEVEL = "SYS"
  128. NCCL_CUMEM_ENABLE = "0"
  129. NCCL_IB_TIMEOUT = "24"
  130. NCCL_IB_QPS_PER_CONNECTION = "8"
  131. NCCL_BUFFERSIZE = "16777216"
  132. NCCL_SOCKET_FAMILY = "inet"
  133. # PCIe allreduce not needed on GB10 single-NIC
  134. VLLM_ENABLE_PCIE_ALLREDUCE = "0"
  135. VLLM_PCIE_ALLREDUCE_BACKEND = "cpp"