recipe.toml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # GLM-5.3-Flash NVFP4-Spark — local-inference-lab quant, r12 fork — 2× DGX
  2. # Spark, TP=2. The lab's own "DSpark" checkpoint (speculative MTP layers
  3. # embedded, no separate draft download).
  4. #
  5. # local-inference-lab/GLM-5.3-Flash-NVFP4-Spark (rev 06972cdee7280cec849aedf05a02062b3e870246):
  6. # NVFP4 routed experts (layers 3+, group-16) + NVFP4 MTP expert layer in the
  7. # separate model-mtp-0000x.safetensors shards (mtp_tokens: 5 per their
  8. # lil.yaml), amax/nonexpert/inputscales side shards, Glm5NextForConditionalGeneration.
  9. #
  10. # Image: glm53-jovian-r12:local (docker-images/glm53-jovian-r12/) — clean
  11. # solar-pattern build of the r12 stack: local-inference-lab/vllm
  12. # dev/jovian-judgement (base 54f6e98 + PR 550/552/553/554/555/557 by SHA) +
  13. # b12x 139e040 + PR 260/267/268/269/270, torch 2.13 cu130, flashinfer 0.6.17.
  14. #
  15. # Launch flags mirror the lab's lil launcher policy for this family
  16. # (local-inference-lab/lil, configs/models/_bases.yaml glm base + lil.yaml):
  17. # attention B12X, linear/moe backend b12x, MTP spec with moe_backend b12x,
  18. # instanttensor load, block 256, max-num-seqs 8, batched 4096, glm45/glm47
  19. # parsers, mamba-cache-mode align.
  20. #
  21. # Boot success markers: "Model loading took ~93 GiB" (instanttensor: ~1 min)
  22. # → "GPU KV cache size" → "Application startup complete".
  23. #
  24. # JIT cache: the flashinfer/b12x JIT caches are MOUNTED from
  25. # ~/sm121-cache/glm53-jit-121f (see [[extra_mounts]] at the bottom, same
  26. # pattern as the dsv4 recipe) — pre-baked on both nodes so boot skips the
  27. # ~15 min first-boot JIT (and the nvcc OOM risk; MAX_JOBS=2 stays as guard).
  28. #
  29. # Test request: chat completions need "chat_template_kwargs":{"reasoning_effort"
  30. # :"low"} — omitted/other values select MAX reasoning effort (empty content on
  31. # short max_tokens).
  32. #
  33. # PREREQUISITES: weights cached on both nodes:
  34. # ~/dsv4vision-hf is for DeepSeek — for GLM the launcher resolves the repo
  35. # from the node's HF cache (NAS hub: 175 GiB) or a local NVMe copy.
  36. # hf download local-inference-lab/GLM-5.3-Flash-NVFP4-Spark
  37. engine = "vllm"
  38. name = "GLM-5.3-Flash NVFP4-Spark (vLLM, 2x Spark, MTP-5)"
  39. docker_image = "glm53-jovian-r12:local" # r12 fork build (see docker-images/glm53-jovian-r12)
  40. docker_image_dir = "glm53-jovian-r12"
  41. # Required: the clean r12 image follows the solar contract (ENTRYPOINT []
  42. # + CMD bash), so the recipe carries the entrypoint (the old day-0-based
  43. # r12 image had ["vllm","serve"] baked in, which is why this was absent
  44. # until the clean rebuild).
  45. entrypoint = ["vllm", "serve"]
  46. model = "local-inference-lab/GLM-5.3-Flash-NVFP4-Spark"
  47. required_nodes = 2
  48. tensor_parallel_size = 2
  49. pipeline_parallel_size = 1
  50. distributed_backend = "mp"
  51. shm_size = "32gb"
  52. args = [
  53. # Stable served name — quant-agnostic (shared across glm53 quants)
  54. "--served-model-name", "glm53",
  55. "--trust-remote-code",
  56. "--distributed-executor-backend", "mp",
  57. # GMU is ONLY a startup guardrail here (KV pool is pinned below): 0.90
  58. # demands 109.46 GiB free on GB10's 121.63 GiB, but driver reserve +
  59. # page cache routinely leave ~108.5 -> flaky
  60. # "Free memory ... less than desired" boot deaths (this was the class
  61. # of the old "54-second death"), and post-crash reruns see ~106.6 GiB.
  62. # 0.82 = 99.7 GiB, below any realistic dip; does NOT change what gets
  63. # allocated (weights ~93 + pinned KV 10 + activations).
  64. "--gpu-memory-utilization", "0.82",
  65. # Pinned 10 GiB KV (≈1.16M tokens) — GMU sizing has no headroom at
  66. # 92.72 GiB weights/node; pinning also keeps warmup off the swap path
  67. "--kv-cache-memory-bytes", "10737418240",
  68. # No --kv-cache-dtype: let the r12 fork pick its default (the explicit
  69. # fp8 / fp8_ds_mla both failed auto-selection on this build).
  70. # The GLM5Next model wires the B12X sparse-MLA backend (sm_120/sm_121)
  71. # when the global backend is B12X (glm5next/nvidia/attention.py:
  72. # _select_sparse_backend); the sm12x auto-priority list never offers it
  73. # (FLASHINFER_MLA_SPARSE_SM120 only supports head 576, not GLM's 512).
  74. "--attention-backend", "B12X",
  75. # lab loader: instanttensor (0.1.9 is already in the r12 image) —
  76. # ~5 min weight load vs ~16 min from NFS; stays in every bisection run
  77. "--load-format", "instanttensor",
  78. # PERF RUN (2026-09-02): full lab execution engine per lil render
  79. # (vllm-node-eugr reference): b12x linear+MoE kernels, mamba state
  80. # cache align, no enforce-eager (lab runs CUDA graphs; the enforce-eager
  81. # quality bug was day-0-build-specific, r12 is the lab-qualified build).
  82. "--linear-backend", "b12x",
  83. "--moe-backend", "b12x",
  84. "--mamba-cache-mode", "align",
  85. "--block-size", "256",
  86. "--max-model-len", "524288",
  87. "--max-num-seqs", "8",
  88. "--max-num-batched-tokens", "4096",
  89. "--enable-chunked-prefill",
  90. "--async-scheduling",
  91. "--enable-prefix-caching",
  92. "--disable-custom-all-reduce",
  93. # Their proven boot: no flashinfer autotune, no CuTe-DSL warmup
  94. "--kernel-config", """
  95. '{"enable_cutedsl_warmup":false,"enable_flashinfer_autotune":false}'""",
  96. # lab spec config verbatim (lil render): k=5, moe_backend b12x
  97. # (nvfp4->b12x), attention B12X (draft's backend comes from the spec
  98. # config, not the global flag — eagle/utils.py _make_eagle_draft_vllm_config)
  99. "--speculative-config", """
  100. '{"method":"mtp","num_speculative_tokens":5,"moe_backend":"b12x","attention_backend":"B12X"}'""",
  101. "--language-model-only",
  102. "--tool-call-parser", "glm47",
  103. "--enable-auto-tool-choice",
  104. "--reasoning-parser", "glm45",
  105. ]
  106. [env]
  107. HF_HUB_OFFLINE = "1"
  108. # lab INSTANTTENSOR loader knobs (lil render: BACKEND/CONCURRENCY/IO_DEPTH
  109. # + the lil.yaml BUFFER_SIZE/CHUNK)
  110. INSTANTTENSOR_BACKEND = "BUFFERED"
  111. INSTANTTENSOR_CONCURRENCY = "1"
  112. INSTANTTENSOR_IO_DEPTH = "3"
  113. INSTANTTENSOR_BUFFER_SIZE = "67108864"
  114. INSTANTTENSOR_CHUNK_SIZE = "8388608"
  115. # FlashInfer JIT guard: if a kernel is missing from the mounted JIT cache it
  116. # compiles at boot — 12-way parallel nvcc got OOM-killed (code 137) on GB10's
  117. # 121 GB unified while the 93 GB weights + 10 GB KV pin are resident.
  118. MAX_JOBS = "2"
  119. # NoPE-MLA rope-pad runtime gate (mod baked into the image)
  120. VLLM_MLA_NOPE_PAD_ROPE = "1"
  121. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  122. # PERF RUN: lab execution engine (lil render reference)
  123. VLLM_USE_AOT_COMPILE = "1"
  124. VLLM_USE_STANDALONE_COMPILE = "1"
  125. VLLM_USE_V2_MODEL_RUNNER = "1"
  126. VLLM_USE_FLASHINFER_SAMPLER = "1"
  127. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  128. # NOTE: no VLLM_USE_MEGA_AOT_ARTIFACT — the prebuilt mega-AOT artifact ships
  129. # in the lab image, not in ours; the flag would only serialize.
  130. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  131. TORCH_USE_RTLD_GLOBAL = "1"
  132. VLLM_NO_USAGE_STATS = "1"
  133. # Architecture (aarch64 / sm_121a DGX Spark)
  134. TORCH_CUDA_ARCH_LIST = "12.1a"
  135. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  136. CUTE_DSL_ARCH = "sm_121a"
  137. CMAKE_CUDA_ARCHITECTURES = "121"
  138. OMP_NUM_THREADS = "4"
  139. # Pre-baked JIT caches (see header; same pattern as the dsv4 recipe's
  140. # ~/.cache/dsv4vision-jit mounts). RW on purpose: flashinfer writes lock
  141. # files into the cache. Missing on a node -> first boot JITs (~15 min at
  142. # MAX_JOBS=2) and the cache populates for the next boot.
  143. # NOTE: extra_mounts stay AFTER args (TOML table headers would swallow the
  144. # args array otherwise).
  145. [[extra_mounts]]
  146. host = "~/sm121-cache/glm53-jit-121f/flashinfer"
  147. container = "/root/.cache/flashinfer"
  148. [[extra_mounts]]
  149. host = "~/sm121-cache/glm53-jit-121f/b12x"
  150. container = "/root/.cache/b12x"