recipe.toml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. # r28 4x DCP4 cell (2026-09-08) — clone of the r27 4x-dcp4 recipe (160/176
  2. # RoCEnante, 46.8 t/s) retargeted at the FULL r28 source lock (cut 2026-09-06
  3. # ~18:30 UTC across all three forks): vLLM 62f6385c (prefill/decode
  4. # compute-time sharing + interleaved parallel prefills, chat-template
  5. # rendering parity, GLM boundary restore, partial prefix-cache hits),
  6. # b12x 7216f6b9 (21 commits over r27: GLM/DeepSeek loader fixes, W4A4 FC1
  7. # fusion, M8 route prep, M1 FC2 overlap, GDN/MHC perf), LMCache 934c287a
  8. # (3 MP-transfer robustness fixes). Same model/flags/KV pin; the image is
  9. # the r27 build dir with the named version profile profiles/glm53-r28.env
  10. # (clone-at-pin fetches each commit directly, the tree gates verify them).
  11. # GLM-5.3-Flash NVFP4 — local-inference-lab quant (vLLM) — 2× DGX Spark, TP=2.
  12. #
  13. # local-inference-lab mixed quant: NVFP4 routed experts (layers 3–44,
  14. # group-16) + MXFP8 MTP experts (layer 45) + W4A4 input scales. Best agent
  15. # quant so far: tool-eval-bench 89/100 (vs 85 LibertAIDAI, 90 official FP8).
  16. # Model: https://huggingface.co/local-inference-lab/GLM-5.3-Flash-NVFP4
  17. # (~186 GB → 92.72 GiB weights/node; KV pinned at 10 GiB, see below)
  18. #
  19. # Image: glm53-flash-nvfp4-lab:local (docker-images/glm53-flash-nvfp4-lab/ —
  20. # day-0 arm64 image + NoPE-MLA mod + the four FujitsuPolycom lab-checkpoint
  21. # patches: model naming shim, modelopt MTP namespace fix, persistent_topk
  22. # CC-12.x guards). Their launch config is mirrored below.
  23. # PROVENANCE: https://github.com/FujitsuPolycom/glm53-flash-tp2-spark
  24. # (Apache-2.0; see patches/UPSTREAM.md) + forum 381350 #41.
  25. #
  26. # Deviations from their launch script (intentional):
  27. # * no --kda-prefill-backend flashkda (needs their base-image patch — skipped)
  28. # * --kv-cache-dtype fp8_ds_mla instead of `fp8` (same packed layout; this
  29. # spelling is what the NoPE-MLA mod booted with on the LibertAIDAI stack)
  30. # * --language-model-only + no mm-renderer patch/env (text-only)
  31. # * no bundled NCCL/LD_PRELOAD, no NCCL_* fabric block (our switched fabric
  32. # is configured via [nccl.ds4] + launcher GID auto-detect)
  33. # * no --moe-backend marlin: their proven stack uses the default backend for
  34. # THIS quant and reports clean evals. Sanity-check output for token loops
  35. # anyway (the silent FP4 MoE corruption gotcha) before trusting a new node.
  36. # * flashinfer autotune disabled via --kernel-config (their proven boot);
  37. # VLLM_ENGINE_READY_TIMEOUT_S stays high regardless.
  38. #
  39. # Boot success markers (engine log, in order):
  40. # "Model loading took 92.72 GiB" → "[quantprobe] ... algo=MXFP8" (MTP fix
  41. # active; algo=None means broken) → "GPU KV cache size: 1,164,369 tokens" →
  42. # "Application startup complete". ~700 s sequential weight load.
  43. #
  44. # Test request: chat completions need "chat_template_kwargs":{"reasoning_effort"
  45. # :"low"} — omitted/other values select MAX reasoning effort (empty content on
  46. # short max_tokens).
  47. #
  48. # Optional: instanttensor loader (~30 s weight load vs ~700 s):
  49. # FROM glm53-flash-nvfp4-lab:local + pip install --no-deps --no-build-isolation
  50. # instanttensor==0.1.9, then add --load-format instanttensor (--no-deps is
  51. # required: resolution would downgrade the image's NCCL).
  52. #
  53. # PREREQUISITES: weights cached on both nodes:
  54. # [A/B CELL 2026-09-03] ship recipe verbatim, checkpoint swapped to the lab
  55. # non-Spark NVFP4 (isolates checkpoint from image lineage vs the lab-image cell).
  56. # [BISECT A2 2026-09-03] EXACT 90/100 recipe (236ce5a) + instanttensor + JIT
  57. # mounts, on the CURRENT eugr-patched image. Isolates image lineage from the
  58. # execution-env/flag cluster (AOT/V2/b12x/card-env). Comparator: 124/138.
  59. # GLM-5.3-Flash NVFP4-Spark — local-inference-lab quant with the speculative
  60. # layers embedded — 2× DGX Spark, TP=2.
  61. #
  62. # local-inference-lab/GLM-5.3-Flash-NVFP4-Spark (rev 06972cdee7280cec849aedf05a02062b3e870246):
  63. # NVFP4 routed experts (layers 3+, group-16) + NVFP4 MTP expert layer in the
  64. # separate model-mtp-0000x.safetensors shards (mtp_tokens: 5 per their
  65. # lil.yaml), amax/nonexpert/inputscales side shards, Glm5NextForConditionalGeneration.
  66. # THE "DSpark speculative embedded" checkpoint — no separate DFlash2 download
  67. # needed; lil.yaml: default_speculator mtp, dflash2_tokens 7 (r12 doc fr: their
  68. # standalone-Q: MTP:3 254 tok/s CC1, 333 Sieve, 94 steps/s).
  69. #
  70. # Image: glm53-flash-nvfp4-lab:local (same proven day-0 arm64 stack + NoPE-MLA
  71. # mod + modelopt MTP namespace patch used by the 92/100 lab lane). The MTP
  72. # layer here is NVFP4 (not MXFP8) — the quantprobe marker may print
  73. # algo=NVFP4/- different; algo=None = patch missed (fall back to 4p67 image).
  74. #
  75. # Deviations from lab (unchanged mechanics): same fabric/env/GMU/KV pinning.
  76. # lil.yaml launch mirrors: block 256, disable_flashinfer_autotune, mm data
  77. # mode — our text-only flags identical to glm53-flash-nvfp4-lab.
  78. #
  79. # Boot markers: "Model loading took ~XX GiB" → "[quantprobe] ..." →
  80. # "GPU KV cache size" → "Application startup complete".
  81. #
  82. # PREREQUISITES: weights on the NAS hub (175 GiB): hf download local-inference-lab/GLM-5.3-Flash-NVFP4-Spark
  83. engine = "vllm"
  84. name = "GLM-5.3-Flash NVFP4 (r31 img, lab ckpt, 4x DCP4)"
  85. docker_image = "glm53-jovian-r31:local" # full r28 lock (build_profile) over the r27 image tree
  86. docker_image_dir = "glm53-jovian-r27"
  87. # NOTE: build_profile must stay a TOP-LEVEL key — a bare key after
  88. # [[extra_mounts]] would parse into the last mount table and be silently
  89. # ignored (2026-09-08).
  90. # FULL r28 source lock (2026-09-06 cut, all three forks): the named version
  91. # profile docker-images/glm53-jovian-r27/profiles/glm53-r28.env — vLLM
  92. # 62f6385c + b12x 7216f6b9 (21 commits over r27: GLM/DeepSeek loader fixes,
  93. # MoE perf) + LMCache 934c287a (3 MP-transfer fixes). Merged over the image
  94. # dir's versions.env and folded into the build checksum, so this is a
  95. # distinct image (tag glm53-jovian-r28:local) sharing the r27 build tree.
  96. # Clone-at-pin fetches each commit directly; the Dockerfile gates HEAD + tree
  97. # hash per repo. Both r28 branches are strictly ahead of their r27/r26 pins
  98. # (0 behind) — a clean superset. The r28 vLLM tree has NO requirements/cmake
  99. # changes vs r27 (verified via the GitHub compare API, 13 commits / 29 files),
  100. # so the fetch-deps.sh dep gates still hold.
  101. build_profile = "glm53-r31"
  102. # Required: the clean r12 image follows the solar contract (ENTRYPOINT []
  103. # + CMD bash), so the recipe carries the entrypoint (the old day-0-based
  104. # r12 image had ["vllm","serve"] baked in, which is why this was absent
  105. # until the clean rebuild).
  106. entrypoint = ["vllm", "serve"]
  107. model = "local-inference-lab/GLM-5.3-Flash-NVFP4"
  108. required_nodes = 4
  109. tensor_parallel_size = 4
  110. pipeline_parallel_size = 1
  111. distributed_backend = "mp"
  112. shm_size = "32gb"
  113. args = [
  114. # R31 delta (their r28.1-r31 locks): adaptive prefill/decode
  115. # compute-time sharing with a fixed 40% prefill floor.
  116. "--prefill-compute-share", "0.4",
  117. # Stable served name — quant-agnostic (shared across glm53 quants)
  118. "--served-model-name", "glm53",
  119. "--trust-remote-code",
  120. "--distributed-executor-backend", "mp",
  121. # GMU is ONLY a startup guardrail here (KV pool is pinned below): 0.90
  122. # demands 109.46 GiB free on GB10's 121.63 GiB, but driver reserve +
  123. # page cache routinely leave ~108.5 -> flaky
  124. # "Free memory ... less than desired" boot deaths (this was the class
  125. # of the old "54-second death"), and post-crash reruns see ~106.6 GiB.
  126. # 0.82 = 99.7 GiB, below any realistic dip; does NOT change what gets
  127. # allocated (weights ~93 + pinned KV 10 + activations).
  128. # 0.88 (not 0.90): the startup admission gate is free-mem >= GMU*total
  129. # (107.0 vs 109.5 GiB); ~12 GiB of starting vLLM processes + docker
  130. # daemon can push the 0.90 check under the line (2026-09-08, #48140).
  131. # KV is explicitly pinned (--kv-cache-memory-bytes) so capacity is unchanged.
  132. "--gpu-memory-utilization", "0.88",
  133. # Pinned 10 GiB KV (≈1.16M tokens) — GMU sizing has no headroom at
  134. # 92.72 GiB weights/node; pinning also keeps warmup off the swap path
  135. "--kv-cache-memory-bytes", "17179869184", # 16 GiB: 4x NVFP4 has the headroom (47.1 GiB weights/node vs 108 usable); 2x stays 10
  136. "--decode-context-parallel-size", "4",
  137. "--cp-kv-cache-interleave-size", "4",
  138. # No --kv-cache-dtype: let the r12 fork pick its default (the explicit
  139. # fp8 / fp8_ds_mla both failed auto-selection on this build).
  140. # The GLM5Next model wires the B12X sparse-MLA backend (sm_120/sm_121)
  141. # when the global backend is B12X (glm5next/nvidia/attention.py:
  142. # _select_sparse_backend); the sm12x auto-priority list never offers it
  143. # (FLASHINFER_MLA_SPARSE_SM120 only supports head 576, not GLM's 512).
  144. "--attention-backend", "B12X",
  145. # pure I/O loader (kept across every config; 171 GB in ~5.5 min vs ~16 NFS)
  146. "--load-format", "instanttensor",
  147. # [R17 FULL-CLUSTER TEST] lil manifest backends (quality gate: hardmode
  148. # must stay ≥88; r12-era this cluster dropped it to 74 — r17 may carry
  149. # the fix through — one boot decides).
  150. "--block-size", "256",
  151. # FINAL BISECT (2026-09-03, hardmode 176pt, r17 img):
  152. # knobs-only 87: d0 c1 24.1, d8192 23.8
  153. # +moe b12x 88: d0 c1 23.5, d8192 26.6 <- SHIP (2 pts d8192)
  154. # +linear b12x 44: W4A4 linear kernel destroys numerics (param-precision 0%)
  155. # +align 88: but d0 c1 18.6 (-5) — perf-negative, dropped
  156. # (all three together = 44-74; the lab needs its private packed package)
  157. "--max-model-len", "524288",
  158. "--max-num-seqs", "16",
  159. "--max-num-batched-tokens", "4096",
  160. "--enable-chunked-prefill",
  161. "--async-scheduling",
  162. "--enable-prefix-caching",
  163. # NO --disable-custom-all-reduce here: in the r27 fork the RoCEnante
  164. # adapter is gated on the custom-all-reduce enable flag
  165. # (use_roce_allreduce = use_custom_allreduce && VLLM_ENABLE_ROCE_ALLREDUCE).
  166. # On 2x/4x 1-GPU-node clusters vLLM's own CUDA-IPC custom AR is functionally
  167. # inert (no cross-node P2P), so dropping the flag only opens the b12x path;
  168. # the b12x-PCIe branch stays off (VLLM_ENABLE_PCIE_ALLREDUCE defaults False).
  169. # Their proven boot: no flashinfer autotune, no CuTe-DSL warmup
  170. "--kernel-config", """
  171. '{"enable_cutedsl_warmup":false,"enable_flashinfer_autotune":false}'""",
  172. # Built-in MTP draft, 3 tokens (the r12-qualified "mtp:3" mode — their
  173. # x86 numbers: 254 tok/s CC1, 2.37 accept; the checkpoint embeds up to
  174. # 5 via the model-mtp-0000x shards but 3 is the verified depth). This is
  175. # the checkpoint's own MTP head (Glm5NextMTPModel), NOT dspark — dspark
  176. # is the DeepSeek-V4 family's mechanism; GLM's other r12 mode is
  177. # dflash2:7 with a separate trained draft checkpoint.
  178. # The draft model's vllm_config takes its attention backend from the
  179. # SPECULATIVE config, not the global flag (eagle/utils.py:
  180. # _make_eagle_draft_vllm_config) — B12X here mirrors the main model's.
  181. "--speculative-config", """
  182. '{"method":"mtp","num_speculative_tokens":3,"attention_backend":"B12X"}'""",
  183. "--language-model-only",
  184. # MTP + CUDA graphs degrades OUTPUT QUALITY on the glm53 day-0 dev build
  185. # (forum #381350/#44, CONFIRMED by A/B bench 2026-08-28: same seed/flags,
  186. # graphs on = 89/100, eager = 92/100; decode unchanged 28.4 t/s @ c1,
  187. # c2 -7%, TTFT +1.6s). The b12x glm52 stack does NOT need this (its
  188. # graphs+MTP combo benches clean at 100/100) — bug is build-specific.
  189. # graphs moved BEFORE tool-call-parser; enforce-eager removed for the
  190. # r17-graphs test (bisect A2 was 88/100 eager; graphs+MTP fix is public
  191. # in r17 refs? verify by bench).
  192. "--tool-call-parser", "glm47",
  193. "--enable-auto-tool-choice",
  194. "--reasoning-parser", "glm45",
  195. ]
  196. [env]
  197. # R31 lock: 16 NCCL channels (their qualified runtime).
  198. NCCL_NCHANNELS = "16"
  199. HF_HUB_OFFLINE = "1"
  200. # RoCEnante (b12x one-shot RoCE all-reduce/all-gather) — default on for r27
  201. # lanes since the 2026-09-08 A/B (4x DCP4: decode +31..+90%, quality 160 vs
  202. # 155, prefill within noise; specs/tech-architecture/glm53-recipe-state.md,
  203. # history/night-shifts/2026-09-07.md). Needs the CX-7 RoCE fabric (all of
  204. # ours); single-node serves skip it silently. Caps default 2MB AR / 16MB AG.
  205. VLLM_ENABLE_ROCE_ALLREDUCE = "1"
  206. # FlashInfer JIT (mxfp8_gemm_cutlass_sm120, ~12 kernels) compiles at first
  207. # boot with 12 parallel nvcc jobs -> OOM-killed (code 137) on GB10's
  208. # 121 GB unified while the 93 GB weights + 10 GB KV pin are resident.
  209. # MAX_JOBS caps ninja parallelism so the JIT fits in the remaining ~20 GB.
  210. MAX_JOBS = "2"
  211. # NoPE-MLA rope-pad runtime gate (mod baked into the image)
  212. VLLM_MLA_NOPE_PAD_ROPE = "1"
  213. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  214. # Upstream launch-script env (memory + compile knobs)
  215. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  216. VLLM_USE_AOT_COMPILE = "0"
  217. VLLM_USE_STANDALONE_COMPILE = "1"
  218. VLLM_USE_FLASHINFER_SAMPLER = "1"
  219. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  220. TORCH_USE_RTLD_GLOBAL = "1"
  221. VLLM_NO_USAGE_STATS = "1"
  222. # Architecture (aarch64 / sm_121a DGX Spark)
  223. TORCH_CUDA_ARCH_LIST = "12.1a"
  224. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  225. CUTE_DSL_ARCH = "sm_121a"
  226. CMAKE_CUDA_ARCHITECTURES = "121"
  227. OMP_NUM_THREADS = "2"
  228. [[extra_mounts]]
  229. host = "~/sm121-cache/glm53-jit-121f/b12x"
  230. container = "/root/.cache/b12x"
  231. # JIT caches persist per-node across serves (was: cold /root/.cache per
  232. # container -> ~20 min flashinfer/torch recompile every serve). The host
  233. # dirs are shared between lanes of the same arch — each cache
  234. # self-namespaces by its engine version key internally.
  235. [[extra_mounts]]
  236. host = "~/sm121-cache/jit-121f/flashinfer"
  237. container = "/root/.cache/flashinfer"
  238. [[extra_mounts]]
  239. host = "~/sm121-cache/jit-121f/torchinductor"
  240. container = "/root/.cache/torchinductor"
  241. [[extra_mounts]]
  242. host = "~/sm121-cache/jit-121f/vllm"
  243. container = "/root/.cache/vllm"