recipe.toml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # GLM-5.3-Flash NVFP4-4p67 — local-inference-lab HIGHER-FIDELITY quant (vLLM)
  2. # — 2× DGX Spark, TP=2, MTP-3.
  3. #
  4. # "4p67" ≈ 4.67 bits/weight, KLD ~0.04 vs bf16 — the lab's fidelity-grade
  5. # variant of GLM-5.3-Flash-NVFP4 (our glm53-flash-nvfp4-lab recipe is the
  6. # workhorse). Quant recipe per the model card:
  7. # main model: routed experts NVFP4 (calibrated, ships A4 input scales)
  8. # + attention/shared/indexer MXFP8
  9. # MTP: routed experts NVFP4 A16-only + attention/shared MXFP8
  10. # hf_quant_config declares the routed experts as quant_algo=W4A16_NVFP4 under
  11. # MIXED_PRECISION — i.e. they execute via the Marlin W4A16 GEMM (bf16
  12. # activations), not the A4 path.
  13. # Model: https://huggingface.co/local-inference-lab/GLM-5.3-Flash-NVFP4-4p67
  14. #
  15. # IMAGE: the card says "should be used with local-inference-lab/vllm branch
  16. # dev/jovian-judgement" — every image they publish is amd64-only (RTX PRO
  17. # 6000 world, and the fork's model.py hard-imports the b12x backend). Our
  18. # day-0 lab base already carries the W4A16/MIXED_PRECISION/MXFP8 modelopt
  19. # methods; the ONE thing 4p67 additionally needs is fused-projection shard
  20. # resolution: it is the first glm5next checkpoint with quantized attention
  21. # projections, and without `packed_modules_mapping` on the model classes the
  22. # fused KDA/MLA/indexer linears load unquantized (KeyError
  23. # in_proj_qkvbfg_a.weight_scale after ~12 min of weight loading). So:
  24. # glm53-flash-nvfp4-4p67:local = lab image + patch_4p67.py (5-line class
  25. # attr on model.py + mtp.py, mirrors the fork's resolution path).
  26. #
  27. # Boot markers: weight load ~93 GiB/node (≈700 s) → "GPU KV cache size:
  28. # 1,164,369 tokens" → "Application startup complete" with the MTP speculator
  29. # attached. quantprobe lines here show algo=MXFP8 for attention projections
  30. # and W4A16_NVFP4 for routed experts (lab quant showed algo=None for attn —
  31. # that difference is the whole point of this image). Watch SpecDecoding
  32. # acceptance (MTP-3, target len ~3).
  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. # PREREQUISITES: weights cached on both nodes:
  39. # hf download local-inference-lab/GLM-5.3-Flash-NVFP4-4p67
  40. engine = "vllm"
  41. name = "GLM-5.3-Flash NVFP4-4p67 (vLLM, 2x Spark, MTP-3)"
  42. docker_image = "glm53-flash-nvfp4-4p67:local"
  43. docker_image_dir = "glm53-flash-nvfp4-4p67"
  44. model = "local-inference-lab/GLM-5.3-Flash-NVFP4-4p67"
  45. required_nodes = 2
  46. tensor_parallel_size = 2
  47. pipeline_parallel_size = 1
  48. distributed_backend = "mp"
  49. shm_size = "32gb"
  50. args = [
  51. # Stable served name — quant-agnostic (shared across glm53 quants)
  52. "--served-model-name", "glm53",
  53. "--trust-remote-code",
  54. "--distributed-executor-backend", "mp",
  55. # GMU is ONLY a startup guardrail here (KV pool is pinned below): 0.90
  56. # demands 109.46 GiB free on GB10's 121.63 GiB, but driver reserve +
  57. # page cache routinely leave ~108.5 -> flaky
  58. # "Free memory ... less than desired" boot deaths (this was the class
  59. # of the old "54-second death"), and post-crash reruns see ~106.6 GiB.
  60. # 0.82 = 99.7 GiB, below any realistic dip; does NOT change what gets
  61. # allocated (weights ~93 + pinned KV 10 + activations).
  62. "--gpu-memory-utilization", "0.82",
  63. # Pinned 10 GiB KV (≈1.16M tokens) — GMU sizing has no headroom at
  64. # ~93 GiB weights/node; pinning also keeps warmup off the swap path
  65. "--kv-cache-memory-bytes", "10737418240",
  66. "--kv-cache-dtype", "fp8_ds_mla",
  67. "--block-size", "256",
  68. "--max-model-len", "524288",
  69. "--max-num-seqs", "8",
  70. "--max-num-batched-tokens", "4096",
  71. "--enable-chunked-prefill",
  72. "--async-scheduling",
  73. "--enable-prefix-caching",
  74. "--disable-custom-all-reduce",
  75. # Proven lab boot: no flashinfer autotune, no CuTe-DSL warmup
  76. "--kernel-config", """
  77. '{"enable_cutedsl_warmup":false,"enable_flashinfer_autotune":false}'""",
  78. # MTP-3 draft (MTP experts are W4A16_NVFP4 in this checkpoint; needs the
  79. # modelopt.patch MTP-namespace fix baked into the image)
  80. "--speculative-config", """
  81. '{"method":"mtp","num_speculative_tokens":3}'""",
  82. "--language-model-only",
  83. # MTP + CUDA graphs degrades OUTPUT QUALITY on the glm53 day-0 dev build
  84. # (lab quant: graphs+MTP 89 vs eager 92). On the 4p67 quant the bug does
  85. # NOT reproduce (measured 2026-08-29: graphs 88 vs eager 87, tg within
  86. # ±5%) — but graphs buy nothing either, so eager stays: measurably free,
  87. # boots ~2 min faster, immune to the bug class. See
  88. # specs/tech-architecture/glm53-recipe-state.md for the A/B table.
  89. # (forum #381350/#44, CONFIRMED by A/B bench 2026-08-28: same seed/flags,
  90. # graphs on = 89/100, eager = 92/100). Same build → same guard here;
  91. # re-A/B only if the base image is ever refreshed past the fix.
  92. "--enforce-eager",
  93. "--tool-call-parser", "glm47",
  94. "--enable-auto-tool-choice",
  95. "--reasoning-parser", "glm45",
  96. ]
  97. [env]
  98. HF_HUB_OFFLINE = "1"
  99. # NoPE-MLA rope-pad runtime gate (mod baked into the image)
  100. VLLM_MLA_NOPE_PAD_ROPE = "1"
  101. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  102. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  103. VLLM_USE_AOT_COMPILE = "0"
  104. TORCH_USE_RTLD_GLOBAL = "1"
  105. VLLM_NO_USAGE_STATS = "1"
  106. # Architecture (aarch64 / sm_121a DGX Spark)
  107. TORCH_CUDA_ARCH_LIST = "12.1a"
  108. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  109. CUTE_DSL_ARCH = "sm_121a"
  110. CMAKE_CUDA_ARCHITECTURES = "121"
  111. OMP_NUM_THREADS = "4"