recipe.toml 13 KB

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