recipe.toml 7.2 KB

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