recipe.toml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # GLM-5.3-Flash NVFP4 — local-inference-lab quant (vLLM) — 2× DGX Spark, TP=2.
  2. #
  3. # local-inference-lab mixed quant: NVFP4 routed experts (layers 3–44,
  4. # group-16) + MXFP8 MTP experts (layer 45) + W4A4 input scales. Best agent
  5. # quant so far: tool-eval-bench 89/100 (vs 85 LibertAIDAI, 90 official FP8).
  6. # Model: https://huggingface.co/local-inference-lab/GLM-5.3-Flash-NVFP4
  7. # (~186 GB → 92.72 GiB weights/node; KV pinned at 10 GiB, see below)
  8. #
  9. # Image: glm53-flash-nvfp4-lab:local (docker-images/glm53-flash-nvfp4-lab/ —
  10. # day-0 arm64 image + NoPE-MLA mod + the four FujitsuPolycom lab-checkpoint
  11. # patches: model naming shim, modelopt MTP namespace fix, persistent_topk
  12. # CC-12.x guards). Their launch config is mirrored below.
  13. # PROVENANCE: https://github.com/FujitsuPolycom/glm53-flash-tp2-spark
  14. # (Apache-2.0; see patches/UPSTREAM.md) + forum 381350 #41.
  15. #
  16. # Deviations from their launch script (intentional):
  17. # * no --kda-prefill-backend flashkda (needs their base-image patch — skipped)
  18. # * --kv-cache-dtype fp8_ds_mla instead of `fp8` (same packed layout; this
  19. # spelling is what the NoPE-MLA mod booted with on the LibertAIDAI stack)
  20. # * --language-model-only + no mm-renderer patch/env (text-only)
  21. # * no bundled NCCL/LD_PRELOAD, no NCCL_* fabric block (our switched fabric
  22. # is configured via [nccl.ds4] + launcher GID auto-detect)
  23. # * no --moe-backend marlin: their proven stack uses the default backend for
  24. # THIS quant and reports clean evals. Sanity-check output for token loops
  25. # anyway (the silent FP4 MoE corruption gotcha) before trusting a new node.
  26. # * flashinfer autotune disabled via --kernel-config (their proven boot);
  27. # VLLM_ENGINE_READY_TIMEOUT_S stays high regardless.
  28. #
  29. # Boot success markers (engine log, in order):
  30. # "Model loading took 92.72 GiB" → "[quantprobe] ... algo=MXFP8" (MTP fix
  31. # active; algo=None means broken) → "GPU KV cache size: 1,164,369 tokens" →
  32. # "Application startup complete". ~700 s sequential weight load.
  33. #
  34. # Test request: chat completions need "chat_template_kwargs":{"reasoning_effort"
  35. # :"low"} — omitted/other values select MAX reasoning effort (empty content on
  36. # short max_tokens).
  37. #
  38. # Optional: instanttensor loader (~30 s weight load vs ~700 s):
  39. # FROM glm53-flash-nvfp4-lab:local + pip install --no-deps --no-build-isolation
  40. # instanttensor==0.1.9, then add --load-format instanttensor (--no-deps is
  41. # required: resolution would downgrade the image's NCCL).
  42. #
  43. # PREREQUISITES: weights cached on both nodes:
  44. # GLM-5.3-Flash NVFP4-Spark — local-inference-lab quant with the speculative
  45. # layers embedded — 2× DGX Spark, TP=2.
  46. #
  47. # local-inference-lab/GLM-5.3-Flash-NVFP4-Spark (rev 06972cdee7280cec849aedf05a02062b3e870246):
  48. # NVFP4 routed experts (layers 3+, group-16) + NVFP4 MTP expert layer in the
  49. # separate model-mtp-0000x.safetensors shards (mtp_tokens: 5 per their
  50. # lil.yaml), amax/nonexpert/inputscales side shards, Glm5NextForConditionalGeneration.
  51. # THE "DSpark speculative embedded" checkpoint — no separate DFlash2 download
  52. # needed; lil.yaml: default_speculator mtp, dflash2_tokens 7 (r12 doc fr: their
  53. # standalone-Q: MTP:3 254 tok/s CC1, 333 Sieve, 94 steps/s).
  54. #
  55. # Image: glm53-flash-nvfp4-lab:local (same proven day-0 arm64 stack + NoPE-MLA
  56. # mod + modelopt MTP namespace patch used by the 92/100 lab lane). The MTP
  57. # layer here is NVFP4 (not MXFP8) — the quantprobe marker may print
  58. # algo=NVFP4/- different; algo=None = patch missed (fall back to 4p67 image).
  59. #
  60. # Deviations from lab (unchanged mechanics): same fabric/env/GMU/KV pinning.
  61. # lil.yaml launch mirrors: block 256, disable_flashinfer_autotune, mm data
  62. # mode — our text-only flags identical to glm53-flash-nvfp4-lab.
  63. #
  64. # Boot markers: "Model loading took ~XX GiB" → "[quantprobe] ..." →
  65. # "GPU KV cache size" → "Application startup complete".
  66. #
  67. # PREREQUISITES: weights on the NAS hub (175 GiB): hf download local-inference-lab/GLM-5.3-Flash-NVFP4-Spark
  68. engine = "vllm"
  69. name = "GLM-5.3-Flash NVFP4-Spark (vLLM, 2x Spark, MTP-5)"
  70. docker_image = "glm53-jovian-r12:local" # r12 fork build (see docker-images/glm53-jovian-r12)
  71. docker_image_dir = "glm53-flash-nvfp4-lab"
  72. model = "local-inference-lab/GLM-5.3-Flash-NVFP4-Spark"
  73. required_nodes = 2
  74. tensor_parallel_size = 2
  75. pipeline_parallel_size = 1
  76. distributed_backend = "mp"
  77. shm_size = "32gb"
  78. args = [
  79. # Stable served name — quant-agnostic (shared across glm53 quants)
  80. "--served-model-name", "glm53",
  81. "--trust-remote-code",
  82. "--distributed-executor-backend", "mp",
  83. # GMU is ONLY a startup guardrail here (KV pool is pinned below): 0.90
  84. # demands 109.46 GiB free on GB10's 121.63 GiB, but driver reserve +
  85. # page cache routinely leave ~108.5 -> flaky
  86. # "Free memory ... less than desired" boot deaths (this was the class
  87. # of the old "54-second death"), and post-crash reruns see ~106.6 GiB.
  88. # 0.82 = 99.7 GiB, below any realistic dip; does NOT change what gets
  89. # allocated (weights ~93 + pinned KV 10 + activations).
  90. "--gpu-memory-utilization", "0.82",
  91. # Pinned 10 GiB KV (≈1.16M tokens) — GMU sizing has no headroom at
  92. # 92.72 GiB weights/node; pinning also keeps warmup off the swap path
  93. "--kv-cache-memory-bytes", "10737418240",
  94. # No --kv-cache-dtype: let the r12 fork pick its default (the explicit
  95. # fp8 / fp8_ds_mla both failed auto-selection on this build).
  96. # The GLM5Next model wires the B12X sparse-MLA backend (sm_120/sm_121)
  97. # when the global backend is B12X (glm5next/nvidia/attention.py:
  98. # _select_sparse_backend); the sm12x auto-priority list never offers it
  99. # (FLASHINFER_MLA_SPARSE_SM120 only supports head 576, not GLM's 512).
  100. "--attention-backend", "B12X",
  101. "--block-size", "256",
  102. "--max-model-len", "524288",
  103. "--max-num-seqs", "8",
  104. "--max-num-batched-tokens", "4096",
  105. "--enable-chunked-prefill",
  106. "--async-scheduling",
  107. "--enable-prefix-caching",
  108. "--disable-custom-all-reduce",
  109. # Their proven boot: no flashinfer autotune, no CuTe-DSL warmup
  110. "--kernel-config", """
  111. '{"enable_cutedsl_warmup":false,"enable_flashinfer_autotune":false}'""",
  112. # MTP-5 draft from the embedded NVFP4 MTP shards (lil.yaml mtp_tokens: 5)
  113. # The draft model's vllm_config takes its attention backend from the
  114. # SPECULATIVE config, not the global flag (eagle/utils.py:
  115. # _make_eagle_draft_vllm_config) — B12X here mirrors the main model's.
  116. "--speculative-config", """
  117. '{"method":"mtp","num_speculative_tokens":3,"attention_backend":"B12X"}'""",
  118. "--language-model-only",
  119. # MTP + CUDA graphs degrades OUTPUT QUALITY on the glm53 day-0 dev build
  120. # (forum #381350/#44, CONFIRMED by A/B bench 2026-08-28: same seed/flags,
  121. # graphs on = 89/100, eager = 92/100; decode unchanged 28.4 t/s @ c1,
  122. # c2 -7%, TTFT +1.6s). The b12x glm52 stack does NOT need this (its
  123. # graphs+MTP combo benches clean at 100/100) — bug is build-specific.
  124. "--enforce-eager",
  125. "--tool-call-parser", "glm47",
  126. "--enable-auto-tool-choice",
  127. "--reasoning-parser", "glm45",
  128. ]
  129. [env]
  130. HF_HUB_OFFLINE = "1"
  131. # NoPE-MLA rope-pad runtime gate (mod baked into the image)
  132. VLLM_MLA_NOPE_PAD_ROPE = "1"
  133. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  134. # Upstream launch-script env (memory + compile knobs)
  135. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  136. VLLM_USE_AOT_COMPILE = "0"
  137. TORCH_USE_RTLD_GLOBAL = "1"
  138. VLLM_NO_USAGE_STATS = "1"
  139. # Architecture (aarch64 / sm_121a DGX Spark)
  140. TORCH_CUDA_ARCH_LIST = "12.1a"
  141. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  142. CUTE_DSL_ARCH = "sm_121a"
  143. CMAKE_CUDA_ARCHITECTURES = "121"
  144. OMP_NUM_THREADS = "4"