recipe.toml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # DeepSeek-V4.1-Flash on 4x DGX Spark with Aiden's SGLang production-1.6
  2. # (aidenle.com/recipes/deepseek-v4-1-flash-sglang-4x-dgx-spark).
  3. #
  4. # Image: aidendle94/sparkrun-sglang-dsv41-gb10:production-1.6 (Docker Hub,
  5. # arm64, 33.3 GB) = lmsysorg/sglang:dev-dsv41 (SGLang team's own DSV4.1
  6. # image, unmodified) + Aiden's MIT overlay (import hooks: Engram row store
  7. # from node-local/shard files inside the CUDA graph, b12x SM12x FP8 dense
  8. # kernels, SM120 prefill paging, allocator flush, one-shot RDMA collectives,
  9. # request guard). Lineage: replaced the vLLM stack as Aiden's production
  10. # 2026-09-17 (prefill +30-45%, KV pool +23%); 1.2: 16 concurrent; 1.5: rank
  11. # crash fix + 2 GB10 speedups; 1.6 current. Measured by Aiden on 4x: decode
  12. # 107/87/36 tok/s (count/code/prose C1), prefill 3.3K tok/s @32K, KV pool
  13. # ~4.2M, 524K context, ~10 min to healthy.
  14. #
  15. # Model: deepseek-ai/DeepSeek-V4.1-Flash (510 GB, fp8 native) on the NAS —
  16. # serve with --hf-cache /mnt/nas/ai/huggingface. The checkpoint snapshot
  17. # dba1be0a... is also the Engram row source (SPARK_ENGRAM_DIR): all four
  18. # ranks read their rows directly from the NAS shards (Aiden's fallback path;
  19. # his measured config uses 47.2 GiB node-local sparse copies, which needs the
  20. # private engram_local.py — the NFS read costs ~3-5 ms/step extra, acceptable
  21. # for a validation run).
  22. #
  23. # Per-rank Engram row ranges: the two tables have DIFFERENT row counts
  24. # (layer 1: 384,006,168; layer 14: 384,016,682 rows for this snapshot) and the
  25. # overlay refuses to start unless the ranks' ranges tile [0, N) exactly per
  26. # layer. Computed per node by aiden4x-launch.sh (next to this recipe) from
  27. # $NODE_RANK + the checkpoint's safetensors headers (floor/ceil tiling; the
  28. # launcher exports NODE_RANK per rank). A full range on every rank would
  29. # double-count row contributions in the reduce — the range is mandatory.
  30. #
  31. # B12X_ROCE_GID_INDEX reuses the launcher's per-node NCCL GID auto-detect
  32. # (the wrapper exports it), so no pinned GID anywhere.
  33. #
  34. # Measured 2026-09-26 (4nodes-switch, NAS model, NAS Engram rows):
  35. # 162/176 (92/100, ★★★★★) — best DSV4.1 score on this cluster; fails
  36. # TC-68/74/88, partials TC-03/14/50/51/57/58/62/81. Smoke: count-20 exact,
  37. # tools OK, 155K-token needle OK, 524K context, KV pool 9.5M full tokens.
  38. # PERF CAVEAT (engram/NAS, not the engine): every FRESH context pays a
  39. # 2-10 s prefill penalty (llama-benchy: pp 154-359 t/s, tg 8.6-21.8 t/s)
  40. # while prefix-cached repeats run 0.3 s TTFT — the engram n-gram rows come
  41. # from the NAS shards (30 ms mean gather; the 4 GB page cache releases once
  42. # and misses re-fetch). Aiden's production uses 47.2 GiB node-local sparse
  43. # copies (private engram_local.py). Agent traffic (short, repeated system
  44. # prompts) sits in the cached regime and is fast; long fresh-context loads
  45. # are slow. The tool-eval-bench llama-benchy perf table for this lane
  46. # reflects the fresh-context penalty (see the shift notes 2026-09-26).
  47. engine = "sglang"
  48. name = "DeepSeek-V4.1-Flash (SGLang 4x, Aiden production-1.6)"
  49. docker_image = "aidendle94/sparkrun-sglang-dsv41-gb10:production-1.6"
  50. model = "deepseek-ai/DeepSeek-V4.1-Flash"
  51. parent_model = "deepseek-ai/DeepSeek-V4.1-Flash"
  52. port = 30000
  53. required_nodes = 4
  54. tensor_parallel_size = 4
  55. distributed_backend = "mp"
  56. shm_size = "32gb"
  57. # The wrapper (mounted read-only from the host via extra_mounts below) sets
  58. # SPARK_ENGRAM_ROWS (+ B12X_ROCE_GID_INDEX) from NODE_RANK and execs the
  59. # engine with the launcher's full flag list in "$@".
  60. entrypoint = ["sh", "/aiden4x-launch.sh"]
  61. args = [
  62. "--trust-remote-code",
  63. "--served-model-name", "deepseek-v4.1-flash",
  64. "--load-format", "safetensors",
  65. # Aiden's measured shape (production-1.6); --tp 4 / --nnodes 4 /
  66. # --node-rank / --dist-init-addr are appended by the launcher
  67. "--ep-size", "4",
  68. "--attention-backend", "dsv4",
  69. "--moe-runner-backend", "flashinfer_mxfp4",
  70. # required for the MXFP8 route (selects the block-scaled path the hook wraps;
  71. # K=576 projections fall back to CUTLASS per shape)
  72. "--fp8-gemm-backend", "flashinfer_cutlass",
  73. "--mem-fraction-static", "0.80",
  74. "--chunked-prefill-size", "2048",
  75. "--context-length", "524288",
  76. "--max-running-requests", "16",
  77. "--cuda-graph-max-bs-decode", "16",
  78. "--random-seed", "0",
  79. "--enable-decoder-swa-bounded-replay",
  80. "--speculative-algorithm", "DSPARK",
  81. "--speculative-dspark-block-size", "5",
  82. "--tool-call-parser", "deepseekv41",
  83. "--reasoning-parser", "deepseek-v41",
  84. "--watchdog-timeout", "1800",
  85. "--min-free-slots-delay", "1",
  86. ]
  87. # The launcher also appends: --model-path <resolved NAS snapshot>, --nnodes 4,
  88. # --node-rank N, --dist-init-addr <head-ib>:25000, --host 0.0.0.0, --port 30000.
  89. # NOTE: no --default-chat-template-kwargs '{"thinking":true}' — the bench
  90. # harness controls thinking; Aiden's default is for his interactive fleet.
  91. # The per-rank Engram range wrapper, mounted read-only (bare keys above; the
  92. # table header must come after them or `args`/`[env]` would parse into it).
  93. [[extra_mounts]]
  94. host = "/home/kilork/aiden4x-launch.sh"
  95. container = "/aiden4x-launch.sh"
  96. read_only = true
  97. # Engram row source: the full checkpoint snapshot on the NAS (container-side
  98. # path — the launcher mounts --hf-cache /mnt/nas/ai/huggingface at
  99. # /root/.cache/huggingface). No engram-local.json manifest in a full snapshot,
  100. # so per-rank ranges come from SPARK_ENGRAM_ROWS (wrapper).
  101. [env]
  102. SPARK_ENGRAM_DIR = "/root/.cache/huggingface/hub/models--deepseek-ai--DeepSeek-V4.1-Flash/snapshots/dba1be0a40aa45a94ad051997016db3960a90277"
  103. SPARK_ENGRAM_MODE = "hostnode"
  104. SPARK_ENGRAM_EARLY = "1"
  105. SPARK_ENGRAM_PREFETCH = "1"
  106. SPARK_PAGE_CACHE_RELEASE = "1"
  107. SPARK_LATE_TAIL_SKIP = "1"
  108. SPARK_LATE_TAIL_SKIP_ALL = "1"
  109. SPARK_SM120_REAL_HEADS = "1"
  110. SPARK_ENGRAM_THREADS = "64"
  111. SPARK_ENGRAM_MAX_IDS = "65536"
  112. SPARK_MXFP8_BACKEND = "b12x"
  113. SPARK_ROCE_AR = "1"
  114. SPARK_ROCE_AR_MAX = "1MB"
  115. SPARK_ROCE_AG_MAX = "16MB"
  116. # b12x RoCE runtime (GID index set by the wrapper from the detected value)
  117. B12X_ROCE_HCA = "rocep1s0f0,roceP2p1s0f0"
  118. B12X_ROCE_SPIN_LIMIT = "300000000"
  119. # image defaults Aiden overrides
  120. SGLANG_ENABLE_DSV41_ENGRAM_HOST_TABLE = "0"
  121. SGLANG_FLASHINFER_MOE_FUSED_FINALIZE = "0"
  122. SGLANG_DSV41_REASONING_EFFORT = "100"
  123. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:False"
  124. CUDA_DEVICE_ORDER = "PCI_BUS_ID"
  125. # Aiden's NCCL pins (4x 200G RoCE fabric, 192.168.200.0/24) — [env] wins over
  126. # the config's [nccl."4nodes-switch"] where they differ
  127. NCCL_NET = "IB"
  128. NCCL_IB_DISABLE = "0"
  129. NCCL_IB_HCA = "rocep1s0f0,roceP2p1s0f0"
  130. NCCL_SOCKET_IFNAME = "enp1s0f0np0"
  131. GLOO_SOCKET_IFNAME = "enp1s0f0np0"
  132. NCCL_IB_ROCE_VERSION_NUM = "2"
  133. NCCL_IB_ADDR_FAMILY = "AF_INET"
  134. NCCL_IB_ADDR_RANGE = "192.168.200.0/24"
  135. NCCL_IB_SUBNET_PREFIX_LEN = "24"
  136. NCCL_CROSS_NIC = "1"
  137. NCCL_IB_MERGE_NICS = "0"
  138. NCCL_IB_SUBNET_AWARE_ROUTING = "1"
  139. NCCL_CUMEM_ENABLE = "0"
  140. NCCL_P2P_DISABLE = "1"
  141. NCCL_SHM_DISABLE = "1"
  142. NCCL_BUFFSIZE = "1048576"
  143. NCCL_LL128_BUFFSIZE = "262144"
  144. NCCL_PROTO = "^LL128"
  145. NCCL_MAX_NCHANNELS = "8"