recipe.toml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # DeepSeek-V4.1-Flash on 4x DGX Spark — Mia AI-Lab TP4 production line
  2. # (github.com/MiaAI-Lab/DeepSeek-v4.1-Flash-DGX-Sparks @ cad252b7d3,
  3. # forum /t/382725 posts #136-#156). Their own TP4 profile, adapted to sm121:
  4. # the image is our docker-images/mia-tp4 build (Dockerfile.canary-roce —
  5. # SGLang dsv4.1 branch f80c91a4b + SG17 RoCEnante overlay + b12x/b12x_next,
  6. # everything pinned in runtime/sources.manifest); the boot.py entrypoint is
  7. # bypassed — we launch sglang.launch_server directly, so the flags boot.py
  8. # would emit live in `args` and the gated adapters live in [env] (the image's
  9. # PYTHONPATH/sitecustomize arms them from env alone).
  10. #
  11. # Their production shape (docs/tp4.md, measured 2026-09-25, switched fabric):
  12. # decode prose c1 87.7 tok/s, prefill 4.1-5.9K tok/s cold, 1M context with a
  13. # verified 1,011,084-token needle, qeval 72/75. Claims UNVERIFIED here.
  14. #
  15. # Model: NAS checkpoint via --hf-cache (same dba1be0a snapshot as the
  16. # aiden16 lane). Engram: UNPACKED read path (DSV41_SOURCE = the checkpoint)
  17. # for the v1 boot — their pack_engram.py packing (~48 GiB/rank) is exactly
  18. # our staging P2 (sparse-rows) and waits for that feature; per the repo the
  19. # unpacked worker read is a per-step penalty, so perf here is a floor.
  20. #
  21. # boot.py maps OFFLOAD_MODE=nvme + no DSV41_PACKED_DIR to "rows straight
  22. # from the checkpoint" (adapter/engram_backend.py) — the equivalent of the
  23. # aiden16 NAS fallback, but their engine (row store + prefetch + 4 GiB
  24. # cache). Their served-model-name is kept identical to aiden16 so bench
  25. # providers work unchanged.
  26. #
  27. # If a boot log line from docs/tp4.md's "must show" block is missing, the
  28. # line is not active — grep it: shared-expert padding, indexer chunked
  29. # ARMED, gamma=5/verify_num_draft_tokens=6, RoCEnante ready, moe_b12x_next
  30. # armed/EP_SIZE=1, hc_fused bit-identical, max_running_requests=16.
  31. engine = "sglang"
  32. name = "DeepSeek-V4.1-Flash (SGLang TP4, Mia production line)"
  33. docker_image = "dsv41-4x-spark:mia-tp4"
  34. docker_image_dir = "mia-tp4"
  35. model = "deepseek-ai/DeepSeek-V4.1-Flash"
  36. parent_model = "deepseek-ai/DeepSeek-V4.1-Flash"
  37. port = 30000
  38. required_nodes = 4
  39. tensor_parallel_size = 4
  40. distributed_backend = "mp"
  41. shm_size = "32gb"
  42. entrypoint = ["python3", "-m", "sglang.launch_server"]
  43. # = boot.py serve() + production EXTRA_SGLANG_ARGS, launcher appends
  44. # --model-path/--nnodes/--node-rank/--dist-init-addr/--host/--port.
  45. args = [
  46. "--served-model-name", "deepseek-v4.1-flash",
  47. "--trust-remote-code",
  48. "--load-format", "safetensors",
  49. "--ep-size", "1", # production: tensor-shard all 384 experts
  50. "--attention-backend", "dsv4",
  51. "--moe-runner-backend", "flashinfer_mxfp4",
  52. "--fp8-gemm-backend", "flashinfer_cutlass", # required for the MXFP8 route
  53. "--mem-fraction-static", "0.80",
  54. "--chunked-prefill-size", "4096",
  55. "--context-length", "1048576",
  56. "--max-total-tokens", "8000000", # pinned KV pool (their 0.80 budget)
  57. "--max-running-requests", "16",
  58. "--cuda-graph-max-bs-decode", "16",
  59. "--min-free-slots-delay", "1", # 16 means 16 (delayer default holds ~13)
  60. "--random-seed", "0",
  61. "--enable-decoder-swa-bounded-replay",
  62. "--enable-cache-report",
  63. "--speculative-algorithm", "DSPARK",
  64. "--speculative-dspark-block-size", "5",
  65. "--tool-call-parser", "deepseekv41",
  66. "--reasoning-parser", "deepseek-v41",
  67. "--enable-deepseek-v4-fp4-indexer", # kept to match their measured arg line
  68. "--watchdog-timeout", "1800",
  69. ]
  70. [env]
  71. # ---- image defaults our path must keep explicit ----
  72. OFFLOAD_MODE = "nvme" # never ram (Engram would evict the model)
  73. STATE_PATH = "/state" # boot.py's state dir (sparks tables, api key)
  74. DSV41_SOURCE = "/root/.cache/huggingface/hub/models--deepseek-ai--DeepSeek-V4.1-Flash/snapshots/dba1be0a40aa45a94ad051997016db3960a90277"
  75. SGLANG_FLASHINFER_MOE_FUSED_FINALIZE = "0" # determinism gate
  76. SGLANG_DSV41_REASONING_EFFORT = "100"
  77. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:False" # True => NaN logits >64-token prefills
  78. # ---- production-line adapter gates (docs/tp4.md "What runs" / EXTRA_CONTAINER_ENV) ----
  79. DSV41_INDEXER_CHUNKED = "1"
  80. SGLANG_DSPARK_FOLDED_SAMPLING = "2"
  81. SGLANG_ROCE_ALLREDUCE = "1"
  82. SGLANG_ROCE_MAX_SIZE = "2097152"
  83. DSV41_ROCE_GATHER = "2097152"
  84. B12X_ROCE_HCA = "rocep1s0f0,roceP2p1s0f0"
  85. B12X_ROCE_CACHE_DIR = "/state/b12x-roce"
  86. B12X_COMPILE_CACHE_DIR = "/state/b12x-compile"
  87. SPARK_PREFILL_TP_SPLIT = "1"
  88. SPARK_PREFILL_TP_MIN_CONTEXT = "32768"
  89. SPARK_PREFILL_TP_MIN_ROWS = "1024"
  90. SGLANG_RUST_BUILD_MODE = "never"
  91. DSV41_FAST_LOAD = "1"
  92. DSV41_FAST_LOAD_EP_SIZE = "1"
  93. DSV41_FAST_LOAD_TP_SLICE = "auto"
  94. DSV41_FAST_LOAD_N_EXPERTS = "384"
  95. DSV41_FAST_LOAD_INFLIGHT_GB = "6"
  96. DSV41_ENGRAM_PREFETCH = "1"
  97. DSV41_CACHE_GIB = "4" # engram row cache (67-76% hits)
  98. DSV41_CACHE_WAYS = "16"
  99. DSV41_SHARED_PAD_K = "1"
  100. DSV41_WO_A_W8 = "1"
  101. DSV41_WO_A_W8_MID = "1"
  102. DSV41_WO_A_W8_DROP = "1"
  103. DSV41_DRAFT_TAU = "0.7"
  104. DSV41_DRAFT_HEAD_FP8 = "1"
  105. DSV41_DRAFT_HEAD_FP8_IMPL = "tp4"
  106. DSV41_BLOCK_VERIFY = "1"
  107. DSV41_FOLDED_FENCE = "1"
  108. DSV41_VERIFY_CAP = "conf:0.1"
  109. DSV41_AUTOTUNE_KEEP = "1"
  110. DSV41_REPLICATED_SPLIT = "wqkv_a,engram.wkv"
  111. DSV41_DRAFT_MAIN_PROJ_SPLIT = "1"
  112. DSV41_ROUTER_LIVE = "1"
  113. DSV41_MOE_B12X_NEXT = "1"
  114. DSV41_MOE_B12X_NEXT_DETERMINISTIC = "1"
  115. DSV41_HC_FUSED = "1"
  116. DSV41_PREFILL_SP = "1"
  117. DSV41_PREFILL_SP_FP8 = "1"
  118. DSV41_L2_PREFETCH = "1"
  119. # ---- fabric / NCCL (their memory fix: 4.7 GiB pinned -> 139 MB; aiden16's
  120. # measured pins for the same NICs, plus Mia's buffer reduction) ----
  121. NCCL_NET = "IB"
  122. NCCL_IB_DISABLE = "0"
  123. NCCL_IB_HCA = "rocep1s0f0,roceP2p1s0f0"
  124. NCCL_SOCKET_IFNAME = "enp1s0f0np0"
  125. GLOO_SOCKET_IFNAME = "enp1s0f0np0"
  126. NCCL_IB_ROCE_VERSION_NUM = "2"
  127. NCCL_IB_ADDR_FAMILY = "AF_INET"
  128. NCCL_IB_ADDR_RANGE = "192.168.200.0/24"
  129. NCCL_IB_SUBNET_PREFIX_LEN = "24"
  130. NCCL_CROSS_NIC = "1"
  131. NCCL_IB_MERGE_NICS = "0"
  132. NCCL_IB_SUBNET_AWARE_ROUTING = "1"
  133. NCCL_CUMEM_ENABLE = "0"
  134. NCCL_P2P_DISABLE = "1"
  135. NCCL_SHM_DISABLE = "1"
  136. NCCL_BUFFSIZE = "1048576"
  137. NCCL_LL128_BUFFSIZE = "262144"
  138. NCCL_PROTO = "^LL128"
  139. NCCL_MAX_NCHANNELS = "8"
  140. [[extra_mounts]]
  141. # boot.py's state dir: dspark tables (future), b12x jit/roce caches; per-node host dir
  142. host = "/home/kilork/mia-state"
  143. container = "/state"