recipe.toml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. # BLOCKED 2026-09-06 (night shift): the DFlash2 drafter inherits the engine's
  2. # FP8 KV dtype; B12X/FLASH_ATTN both reject it on SM121 ("FP8 KV cache requires
  3. # FA3 on SM90 or FA4 on SM100"); with drafter kv_cache_dtype=auto the fork's
  4. # own assertion fires: "GLM MLA parent-page stride must be an exact number of
  5. # C4 pages". Needs a fork-side fix (drafter KV geometry under C4 paging) before
  6. # the k=7 A/B can run. See specs/tech-architecture/glm53-recipe-state.md.
  7. #
  8. # GLM-5.3-Flash NVFP4 — local-inference-lab quant (vLLM) — 2× DGX Spark, TP=2.
  9. #
  10. # local-inference-lab mixed quant: NVFP4 routed experts (layers 3–44,
  11. # group-16) + MXFP8 MTP experts (layer 45) + W4A4 input scales. Best agent
  12. # quant so far: tool-eval-bench 89/100 (vs 85 LibertAIDAI, 90 official FP8).
  13. # Model: https://huggingface.co/local-inference-lab/GLM-5.3-Flash-NVFP4
  14. # (~186 GB → 92.72 GiB weights/node; KV pinned at 10 GiB, see below)
  15. #
  16. # Image: glm53-flash-nvfp4-lab:local (docker-images/glm53-flash-nvfp4-lab/ —
  17. # day-0 arm64 image + NoPE-MLA mod + the four FujitsuPolycom lab-checkpoint
  18. # patches: model naming shim, modelopt MTP namespace fix, persistent_topk
  19. # CC-12.x guards). Their launch config is mirrored below.
  20. # PROVENANCE: https://github.com/FujitsuPolycom/glm53-flash-tp2-spark
  21. # (Apache-2.0; see patches/UPSTREAM.md) + forum 381350 #41.
  22. #
  23. # Deviations from their launch script (intentional):
  24. # * no --kda-prefill-backend flashkda (needs their base-image patch — skipped)
  25. # * --kv-cache-dtype fp8_ds_mla instead of `fp8` (same packed layout; this
  26. # spelling is what the NoPE-MLA mod booted with on the LibertAIDAI stack)
  27. # * --language-model-only + no mm-renderer patch/env (text-only)
  28. # * no bundled NCCL/LD_PRELOAD, no NCCL_* fabric block (our switched fabric
  29. # is configured via [nccl.ds4] + launcher GID auto-detect)
  30. # * no --moe-backend marlin: their proven stack uses the default backend for
  31. # THIS quant and reports clean evals. Sanity-check output for token loops
  32. # anyway (the silent FP4 MoE corruption gotcha) before trusting a new node.
  33. # * flashinfer autotune disabled via --kernel-config (their proven boot);
  34. # VLLM_ENGINE_READY_TIMEOUT_S stays high regardless.
  35. #
  36. # Boot success markers (engine log, in order):
  37. # "Model loading took 92.72 GiB" → "[quantprobe] ... algo=MXFP8" (MTP fix
  38. # active; algo=None means broken) → "GPU KV cache size: 1,164,369 tokens" →
  39. # "Application startup complete". ~700 s sequential weight load.
  40. #
  41. # Test request: chat completions need "chat_template_kwargs":{"reasoning_effort"
  42. # :"low"} — omitted/other values select MAX reasoning effort (empty content on
  43. # short max_tokens).
  44. #
  45. # Optional: instanttensor loader (~30 s weight load vs ~700 s):
  46. # FROM glm53-flash-nvfp4-lab:local + pip install --no-deps --no-build-isolation
  47. # instanttensor==0.1.9, then add --load-format instanttensor (--no-deps is
  48. # required: resolution would downgrade the image's NCCL).
  49. #
  50. # PREREQUISITES: weights cached on both nodes:
  51. # [A/B CELL 2026-09-03] ship recipe verbatim, checkpoint swapped to the lab
  52. # non-Spark NVFP4 (isolates checkpoint from image lineage vs the lab-image cell).
  53. # [BISECT A2 2026-09-03] EXACT 90/100 recipe (236ce5a) + instanttensor + JIT
  54. # mounts, on the CURRENT eugr-patched image. Isolates image lineage from the
  55. # execution-env/flag cluster (AOT/V2/b12x/card-env). Comparator: 124/138.
  56. # GLM-5.3-Flash NVFP4-Spark — local-inference-lab quant with the speculative
  57. # layers embedded — 2× DGX Spark, TP=2.
  58. #
  59. # local-inference-lab/GLM-5.3-Flash-NVFP4-Spark (rev 06972cdee7280cec849aedf05a02062b3e870246):
  60. # NVFP4 routed experts (layers 3+, group-16) + NVFP4 MTP expert layer in the
  61. # separate model-mtp-0000x.safetensors shards (mtp_tokens: 5 per their
  62. # lil.yaml), amax/nonexpert/inputscales side shards, Glm5NextForConditionalGeneration.
  63. # THE "DSpark speculative embedded" checkpoint — no separate DFlash2 download
  64. # needed; lil.yaml: default_speculator mtp, dflash2_tokens 7 (r12 doc fr: their
  65. # standalone-Q: MTP:3 254 tok/s CC1, 333 Sieve, 94 steps/s).
  66. #
  67. # Image: glm53-flash-nvfp4-lab:local (same proven day-0 arm64 stack + NoPE-MLA
  68. # mod + modelopt MTP namespace patch used by the 92/100 lab lane). The MTP
  69. # layer here is NVFP4 (not MXFP8) — the quantprobe marker may print
  70. # algo=NVFP4/- different; algo=None = patch missed (fall back to 4p67 image).
  71. #
  72. # Deviations from lab (unchanged mechanics): same fabric/env/GMU/KV pinning.
  73. # lil.yaml launch mirrors: block 256, disable_flashinfer_autotune, mm data
  74. # mode — our text-only flags identical to glm53-flash-nvfp4-lab.
  75. #
  76. # Boot markers: "Model loading took ~XX GiB" → "[quantprobe] ..." →
  77. # "GPU KV cache size" → "Application startup complete".
  78. #
  79. # PREREQUISITES: weights on the NAS hub (175 GiB): hf download local-inference-lab/GLM-5.3-Flash-NVFP4-Spark
  80. # BLOCKED (2026-09-07, GB10/SM121): boots until the main-model KV layout
  81. # check in glm5next/nvidia/pooled_indexer.py:
  82. # ValueError: GLM MLA parent-page stride must be an exact number of C4 pages
  83. # The pooled FP8 C4 index tail must fit the parent page stride; with the
  84. # DFlash2 drafter pooled into the same pages the stride is no longer an
  85. # exact multiple of the C4 index page. Same class of failure as the r18
  86. # dflash2 block — it is tree-level (present in r27 @63a82f8d), not an
  87. # r18-build artifact. r27's upstream DFlash2 qualification ran on
  88. # x86/sm_120 (rtx6kpro), where the SM12x-only pooled-indexer path is not
  89. # exercised. A fork-level patch (drafter KV outside the C4-aligned page,
  90. # or drafter KV in fp8 with an SM121-capable backend) is required first.
  91. engine = "vllm"
  92. name = "GLM-5.3-Flash NVFP4 (r27 img, DFlash2 k=7, 2x) [BLOCKED]
  93. docker_image = "glm53-jovian-r27:local" # r27 clone-at-pin build
  94. docker_image_dir = "glm53-jovian-r27"
  95. # Required: the clean r12 image follows the solar contract (ENTRYPOINT []
  96. # + CMD bash), so the recipe carries the entrypoint (the old day-0-based
  97. # r12 image had ["vllm","serve"] baked in, which is why this was absent
  98. # until the clean rebuild).
  99. entrypoint = ["vllm", "serve"]
  100. model = "local-inference-lab/GLM-5.3-Flash-NVFP4"
  101. required_nodes = 2
  102. tensor_parallel_size = 2
  103. pipeline_parallel_size = 1
  104. distributed_backend = "mp"
  105. shm_size = "32gb"
  106. args = [
  107. # Stable served name — quant-agnostic (shared across glm53 quants)
  108. "--served-model-name", "glm53",
  109. "--trust-remote-code",
  110. "--distributed-executor-backend", "mp",
  111. # GMU is ONLY a startup guardrail here (KV pool is pinned below): 0.90
  112. # demands 109.46 GiB free on GB10's 121.63 GiB, but driver reserve +
  113. # page cache routinely leave ~108.5 -> flaky
  114. # "Free memory ... less than desired" boot deaths (this was the class
  115. # of the old "54-second death"), and post-crash reruns see ~106.6 GiB.
  116. # 0.82 = 99.7 GiB, below any realistic dip; does NOT change what gets
  117. # allocated (weights ~93 + pinned KV 10 + activations).
  118. "--gpu-memory-utilization", "0.90",
  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. # No --kv-cache-dtype: let the r12 fork pick its default (the explicit
  123. # fp8 / fp8_ds_mla both failed auto-selection on this build).
  124. # The GLM5Next model wires the B12X sparse-MLA backend (sm_120/sm_121)
  125. # when the global backend is B12X (glm5next/nvidia/attention.py:
  126. # _select_sparse_backend); the sm12x auto-priority list never offers it
  127. # (FLASHINFER_MLA_SPARSE_SM120 only supports head 576, not GLM's 512).
  128. "--attention-backend", "B12X",
  129. # pure I/O loader (kept across every config; 171 GB in ~5.5 min vs ~16 NFS)
  130. "--load-format", "instanttensor",
  131. # [R17 FULL-CLUSTER TEST] lil manifest backends (quality gate: hardmode
  132. # must stay ≥88; r12-era this cluster dropped it to 74 — r17 may carry
  133. # the fix through — one boot decides).
  134. "--block-size", "256",
  135. # FINAL BISECT (2026-09-03, hardmode 176pt, r17 img):
  136. # knobs-only 87: d0 c1 24.1, d8192 23.8
  137. # +moe b12x 88: d0 c1 23.5, d8192 26.6 <- SHIP (2 pts d8192)
  138. # +linear b12x 44: W4A4 linear kernel destroys numerics (param-precision 0%)
  139. # +align 88: but d0 c1 18.6 (-5) — perf-negative, dropped
  140. # (all three together = 44-74; the lab needs its private packed package)
  141. "--max-model-len", "524288",
  142. "--max-num-seqs", "16",
  143. "--max-num-batched-tokens", "4096",
  144. "--enable-chunked-prefill",
  145. "--async-scheduling",
  146. "--enable-prefix-caching",
  147. "--disable-custom-all-reduce",
  148. # Their proven boot: no flashinfer autotune, no CuTe-DSL warmup
  149. "--kernel-config", """
  150. '{"enable_cutedsl_warmup":false,"enable_flashinfer_autotune":false}'""",
  151. # Built-in MTP draft, 3 tokens (the r12-qualified "mtp:3" mode — their
  152. # x86 numbers: 254 tok/s CC1, 2.37 accept; the checkpoint embeds up to
  153. # 5 via the model-mtp-0000x shards but 3 is the verified depth). This is
  154. # the checkpoint's own MTP head (Glm5NextMTPModel), NOT dspark — dspark
  155. # is the DeepSeek-V4 family's mechanism; GLM's other r12 mode is
  156. # dflash2:7 with a separate trained draft checkpoint.
  157. # The draft model's vllm_config takes its attention backend from the
  158. # SPECULATIVE config, not the global flag (eagle/utils.py:
  159. # _make_eagle_draft_vllm_config) — B12X here mirrors the main model's.
  160. # r18 used draft_model/FLASH_ATTN/kv auto — the FP8-KV-drafter backend check
  161. # and the C4-page stride assert blocked it on that fork. r27 qualifies
  162. # dflash2 upstream (the #646 2048+256 page split is in this tree); drafter
  163. # repo/depth follow the working aiden GB10 lane (method "dflash", k=7).
  164. # kv_cache_dtype MUST be "auto" (bf16) for the drafter: without it the
  165. # drafter inherits the main model's fp8_ds_mla KV and every backend on
  166. # SM121 rejects it (FP8 KV needs FA3/SM90 or FA4/SM100).
  167. "--speculative-config", """
  168. '{"method":"dflash","model":"incoai/GLM-5.3-Flash-DFlash2","num_speculative_tokens":7,"kv_cache_dtype":"auto"}'""",
  169. "--language-model-only",
  170. # MTP + CUDA graphs degrades OUTPUT QUALITY on the glm53 day-0 dev build
  171. # (forum #381350/#44, CONFIRMED by A/B bench 2026-08-28: same seed/flags,
  172. # graphs on = 89/100, eager = 92/100; decode unchanged 28.4 t/s @ c1,
  173. # c2 -7%, TTFT +1.6s). The b12x glm52 stack does NOT need this (its
  174. # graphs+MTP combo benches clean at 100/100) — bug is build-specific.
  175. # graphs moved BEFORE tool-call-parser; enforce-eager removed for the
  176. # r17-graphs test (bisect A2 was 88/100 eager; graphs+MTP fix is public
  177. # in r17 refs? verify by bench).
  178. "--tool-call-parser", "glm47",
  179. "--enable-auto-tool-choice",
  180. "--reasoning-parser", "glm45",
  181. ]
  182. [env]
  183. HF_HUB_OFFLINE = "1"
  184. # FlashInfer JIT (mxfp8_gemm_cutlass_sm120, ~12 kernels) compiles at first
  185. # boot with 12 parallel nvcc jobs -> OOM-killed (code 137) on GB10's
  186. # 121 GB unified while the 93 GB weights + 10 GB KV pin are resident.
  187. # MAX_JOBS caps ninja parallelism so the JIT fits in the remaining ~20 GB.
  188. MAX_JOBS = "2"
  189. # NoPE-MLA rope-pad runtime gate (mod baked into the image)
  190. VLLM_MLA_NOPE_PAD_ROPE = "1"
  191. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  192. # Upstream launch-script env (memory + compile knobs)
  193. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  194. VLLM_USE_AOT_COMPILE = "0"
  195. VLLM_USE_STANDALONE_COMPILE = "1"
  196. VLLM_USE_FLASHINFER_SAMPLER = "1"
  197. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  198. TORCH_USE_RTLD_GLOBAL = "1"
  199. VLLM_NO_USAGE_STATS = "1"
  200. # Architecture (aarch64 / sm_121a DGX Spark)
  201. TORCH_CUDA_ARCH_LIST = "12.1a"
  202. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  203. CUTE_DSL_ARCH = "sm_121a"
  204. CMAKE_CUDA_ARCHITECTURES = "121"
  205. OMP_NUM_THREADS = "2"
  206. [[extra_mounts]]
  207. host = "~/sm121-cache/glm53-jit-121f/b12x"
  208. container = "/root/.cache/b12x"
  209. # JIT caches persist per-node across serves (was: cold /root/.cache per
  210. # container -> ~20 min flashinfer/torch recompile every serve). The host
  211. # dirs are shared between lanes of the same arch — each cache
  212. # self-namespaces by its engine version key internally.
  213. [[extra_mounts]]
  214. host = "~/sm121-cache/jit-121f/flashinfer"
  215. container = "/root/.cache/flashinfer"
  216. [[extra_mounts]]
  217. host = "~/sm121-cache/jit-121f/torchinductor"
  218. container = "/root/.cache/torchinductor"
  219. [[extra_mounts]]
  220. host = "~/sm121-cache/jit-121f/vllm"
  221. container = "/root/.cache/vllm"