recipe.toml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # GLM-5.3 (FULL, non-Flash) NVFP4-Spark — local-inference-lab quant, 4× DGX Spark, TP=4.
  2. #
  3. # Full GLM-5.3 (78 layers / hidden 6144 / 1M ctx, arch GlmMoeDsaForCausalLM)
  4. # in the lab's GB10-tailored quant: GLM-5.3-NVFP4-Spark (~406 GB →
  5. # ~101.5 GiB weights/node → 4x only; the plain NVFP4 build is 433 GB).
  6. # MIXED_PRECISION checkpoint (NVFP4 routed + MXFP8 elsewhere) handled by the
  7. # lab image's modelopt quant module.
  8. #
  9. # Image: glm53-flash-nvfp4-lab:local (same lab vLLM fork — it registers
  10. # GlmMoeDsaForCausalLM at deepseek_v2.py, which implements SupportsEagle3,
  11. # unlike the Flash GLM5Next target; that is why the lab's MXFP8 DFlash2
  12. # drafter is the full-model pairing, not the Flash one).
  13. #
  14. # First run: plain (no spec) to prove the stack end-to-end, then add spec.
  15. # KV pinned 4 GiB (weights leave ~17 GiB/node; pool is small by design —
  16. # this is a capability/quality lane, not a throughput lane).
  17. #
  18. # PREREQUISITES: weights cached in the shared NAS HF cache:
  19. # models--local-inference-lab--GLM-5.3-NVFP4-Spark (406G, verified 2026-09-04)
  20. engine = "vllm"
  21. name = "GLM-5.3 (full) NVFP4-Spark-lab (vLLM, 4x Spark)"
  22. docker_image = "glm53-flash-nvfp4-lab:local"
  23. docker_image_dir = "glm53-flash-nvfp4-lab"
  24. model = "local-inference-lab/GLM-5.3-NVFP4-Spark"
  25. parent_model = "zai-org/GLM-5.3"
  26. required_nodes = 4
  27. tensor_parallel_size = 4
  28. pipeline_parallel_size = 1
  29. distributed_backend = "mp"
  30. shm_size = "32gb"
  31. # required for the launcher's `--entrypoint sh -c` override path (mods below)
  32. entrypoint = ["vllm", "serve"]
  33. args = [
  34. # Stable served name — quant-agnostic (shared across glm53 quants)
  35. "--served-model-name", "glm53",
  36. "--trust-remote-code",
  37. "--distributed-executor-backend", "mp",
  38. # GMU is ONLY a startup guardrail here (KV pool is pinned below): 0.90
  39. # demands 109.46 GiB free on GB10's 121.63 GiB, but driver reserve +
  40. # page cache routinely leave ~108.5 -> flaky
  41. # "Free memory ... less than desired" boot deaths (this was the class
  42. # of the old "54-second death"), and post-crash reruns see ~106.6 GiB.
  43. # 0.82 = 99.7 GiB, below any realistic dip; does NOT change what gets
  44. # allocated (weights ~93 + pinned KV 10 + activations).
  45. "--gpu-memory-utilization", "0.82",
  46. # Pinned 4 GiB KV — full-model weights are ~101.5 GiB/node (406G/4),
  47. # far less headroom than the 92.7 GiB/node Flash lane; no MLA-specific
  48. # kv-cache-dtype/block-size here (GlmMoeDsa attention picks its own
  49. # native KV defaults — the fp8_ds_mla/256 pair was a Flash-MLA knob)
  50. "--kv-cache-memory-bytes", "4294967296",
  51. # 4 GiB KV pool holds ~79,616 tokens (engine-computed 2026-09-04);
  52. # 524288 would need 26.34 GiB — doesn't fit behind 101.5 GiB weights.
  53. # 79K context is far beyond anything the bench uses.
  54. "--max-model-len", "79616",
  55. "--max-num-seqs", "8",
  56. "--max-num-batched-tokens", "4096",
  57. "--enable-chunked-prefill",
  58. "--async-scheduling",
  59. "--enable-prefix-caching",
  60. "--disable-custom-all-reduce",
  61. # Their proven boot: no flashinfer autotune, no CuTe-DSL warmup
  62. "--kernel-config", """
  63. '{"enable_cutedsl_warmup":false,"enable_flashinfer_autotune":false}'""",
  64. # No spec: the lab DFlash2/MTP drafters are for the Flash model; first
  65. # full-model run runs plain to prove the stack, then add spec if clean
  66. # instanttensor was removed after the first full-model boot hung mid-load
  67. # (dgx2, 2026-09-04), then re-enabled for the parked retry run below
  68. # (flag at "--load-format", "instanttensor") with MAX_JOBS=2 + persistent
  69. # JIT caches as the anti-OOM guardrails.
  70. # NOTE: instanttensor + both mods seds ARE configured below (2026-09-04
  71. # retry) — the lane PARKED before that run happened: two sparse-MLA
  72. # engine crashes on first requests (masked_mha AttributeError +
  73. # forward_mha NotImplementedError), both hotfixed via [mods]; the
  74. # force-mqa + instanttensor boot never ran because the full-model work
  75. # was parked (dgx2 went down twice under this workload that day).
  76. # MTP + CUDA graphs degrades OUTPUT QUALITY on the glm53 day-0 dev build
  77. # (forum #381350/#44, CONFIRMED by A/B bench 2026-08-28: same seed/flags,
  78. # graphs on = 89/100, eager = 92/100; decode unchanged 28.4 t/s @ c1,
  79. # c2 -7%, TTFT +1.6s). The b12x glm52 stack does NOT need this (its
  80. # graphs+MTP combo benches clean at 100/100) — bug is build-specific.
  81. "--enforce-eager",
  82. # instanttensor loader (lab-fork feature; default loader is ~27 min here,
  83. # instanttensor ~2x faster when the NFS cooperates)
  84. "--load-format", "instanttensor",
  85. "--tool-call-parser", "glm47",
  86. "--enable-auto-tool-choice",
  87. "--reasoning-parser", "glm45",
  88. ]
  89. [mods]
  90. commands = [
  91. # Lab-fork bug: mla_attention.py:810 reads self.impl.masked_mha_available
  92. # on the sparse MLA impl, which never sets it -> AttributeError on the
  93. # first prefill step (engine crash, 2026-09-04). The attribute is
  94. # SM100-only anyway (gate: is_device_capability_family(100)); on GB10
  95. # (SM121) the masked-MHA path is off by design, so default to False.
  96. # 1-line hotfix until the lab image is rebuilt with the fix baked in.
  97. "sed -i \"s/and self\\.impl\\.masked_mha_available/and getattr(self.impl, 'masked_mha_available', False)/\" /usr/local/lib/python3.12/dist-packages/vllm/model_executor/layers/attention/mla_attention.py",
  98. # Second wall: the dense-MHA split routes prefill to impl.forward_mha,
  99. # which is an unimplemented stub on the SM120 sparse impl (engine crash
  100. # #2, 2026-09-04). vllm ships an intended escape hatch for exactly this:
  101. # attention_config.sparse_mla_force_mqa = True -> \"always use the MQA
  102. # path\" (the model's native sparse attention). No CLI flag exists for it
  103. # in this build, so set the documented default via sed.
  104. "sed -i \"s/sparse_mla_force_mqa: bool = False/sparse_mla_force_mqa: bool = True/\" /usr/local/lib/python3.12/dist-packages/vllm/config/attention.py",
  105. ]
  106. [env]
  107. HF_HUB_OFFLINE = "1"
  108. # instanttensor loader knobs (lab image bakes the loader; retrying after the
  109. # 2026-09-04 dgx2 hang — if that node dies mid-load again, drop this)
  110. INSTANTTENSOR_BACKEND = "BUFFERED"
  111. INSTANTTENSOR_CONCURRENCY = "1"
  112. INSTANTTENSOR_IO_DEPTH = "3"
  113. INSTANTTENSOR_BUFFER_SIZE = "67108864"
  114. INSTANTTENSOR_CHUNK_SIZE = "8388608"
  115. # NoPE-MLA rope-pad runtime gate (mod baked into the image)
  116. VLLM_MLA_NOPE_PAD_ROPE = "1"
  117. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  118. # Upstream launch-script env (memory + compile knobs)
  119. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  120. VLLM_USE_AOT_COMPILE = "0"
  121. TORCH_USE_RTLD_GLOBAL = "1"
  122. VLLM_NO_USAGE_STATS = "1"
  123. # Architecture (aarch64 / sm_121a DGX Spark)
  124. TORCH_CUDA_ARCH_LIST = "12.1a"
  125. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  126. CUTE_DSL_ARCH = "sm_121a"
  127. CMAKE_CUDA_ARCHITECTURES = "121"
  128. OMP_NUM_THREADS = "4"
  129. # Compile-OOM fix: first boot JIT-compiles the mxfp8 gemm module (12
  130. # nvcc/cicc jobs ~3 GB each) behind 101.5 GiB of weights -> cicc OOM-killed
  131. # (aiden lane, 2026-09-04). flashinfer run_ninja reads MAX_JOBS -> cap at 2.
  132. MAX_JOBS = "2"
  133. # Persistent JIT caches (containers run with --rm; without these every boot
  134. # re-runs the ~10 min nvcc compile of the mxfp8 gemm module)
  135. [[extra_mounts]]
  136. host = "~/.cache/glm53-full-flashinfer"
  137. container = "/root/.cache/flashinfer"
  138. [[extra_mounts]]
  139. host = "~/.cache/glm53-full-triton"
  140. container = "/root/.triton"