recipe.toml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # GLM-5.3-Flash + DFlash2 draft (MXFP8) — speculative decoding — 2× Spark TP=2
  2. #
  3. # DFlash2-MXFP8 (local-inference-lab) is a ~1B BLOCK-DIFFUSION DRAFT model,
  4. # NOT a standalone LLM. It is loaded beside the TARGET
  5. # `local-inference-lab/GLM-5.3-Flash-NVFP4` (the lab quant) and every drafted
  6. # token is verified against it. Draft: 5 sliding-attention layers, block_size
  7. # 8, proposal length 7, reads target hidden states at layers 5/14/24/33/42.
  8. # Model card: https://huggingface.co/local-inference-lab/GLM-5.3-Flash-DFlash2-MXFP8
  9. #
  10. # DRAFT LICENSE: source incoai/GLM-5.3-Flash-DFlash2 is CC BY-NC-ND 4.0
  11. # (non-commercial, no derivatives) — this image is a quantization of it; the
  12. # MXFP8 conversion itself is the "qualified" upstream artifact. Keep to
  13. # personal/non-commercial use.
  14. #
  15. # WHY THIS IMAGE: the card's qualified image (voipmonitor/vllm, TP=4 B12X on
  16. # 4× RTX PRO 6000) is amd64-only and its B12X attention/moe/linear/allreduce
  17. # backends do not exist on GB10. Neither DFlash2DraftModel nor the DFlash2
  18. # serialized-MXFP8 projection path was in our day-0 base. So we PORTED the
  19. # three DFlash2 source files from local-inference-lab/vllm
  20. # dev/jovian-judgement @ da4d7be6 (Apache-2.0, see docker-images/.../UPSTREAM.md)
  21. # onto our proven lab image → glm53-flash-dflash2:local. The day-0 base
  22. # already shipped W4A16_NVFP4 / MIXED_PRECISION / ModelOptMxFp8LinearMethod /
  23. # the dflash proposer, so the whole port is those 3 files + 1 registry line.
  24. #
  25. # DEVIATIONS from the card's qualified config (forced by hardware):
  26. # * TP=4 → TP=2; no B12X attention/moe/linear/allreduce (fall back to the
  27. # lab image's proven SM121 backends).
  28. # * --enforce-eager ON: CUDA-graph+spec-decode quality regression is
  29. # build-specific to this day-0 base (our 2026-08-28 A/B: graphs+MTP
  30. # 89 vs eager 92). Card runs CUDAGRAPH_MODE=FULL on a newer build.
  31. # * TP=2 keeps draft KV in BF16 (auto), same as the card's config.
  32. # Adopted verbatim from the card: --speculative-config {method:dflash,
  33. # model:...DFlash2-MXFP8, num_speculative_tokens:7, kv_cache_dtype:auto}.
  34. #
  35. # =====================================================================
  36. # STATUS 2026-08-29: BLOCKED on GB10 — boots to weight-load + draft load
  37. # (both fine, MXFP8 draft kernel binds), then dies in KV-cache setup:
  38. #
  39. # NotImplementedError: layers.3.self_attn.indexer.k_cache: page size is
  40. # not divisible by the maximum page size and cannot be padded
  41. # (indexes_kv_by_block_stride is False).
  42. #
  43. # MATH (block size cancels, so no --block-size / draft kv dtype fixes it):
  44. # per-token pages on this base are indexer 132 B, MLA fp8_ds_mla 660 B,
  45. # DFlash2 draft (8 kv heads x 128) bf16 4096 B / fp8 2048 B. vLLM unifies
  46. # target+draft pages by integer block-size scaling, which needs divisio-
  47. # nility: 4096%660 != 0, 2048%660 != 0. Tried and eliminated: draft
  48. # kv_cache_dtype fp8, target kv-cache-dtype variants, --disable-hybrid-
  49. # kv-cache-manager (then: "failed to convert the KV cache specs to one
  50. # unified type" — the kpool indexer spec is not coercible either).
  51. #
  52. # WHY THE FORK DOES NOT HIT THIS: its qualified run (voipmonitor image,
  53. # sm_120) uses B12X attention/indexer backends which opt into
  54. # indexes_kv_by_block_stride, so unify PADS the strided pages instead.
  55. # The b12x kernels are not part of the arm64 GB10 base and are compiled
  56. # for sm_120 consumer Blackwell.
  57. #
  58. # PATHS FORWARD (pick before spending boot time on this again):
  59. # a) build local-inference-lab/vllm dev/jovian-judgement for arm64/cu130
  60. # incl. b12x kernels (hours; sm_120->sm_121 compat unknown);
  61. # b) wait for a GB10 indexer/MLA backend that sets
  62. # indexes_kv_by_block_stride (upstream);
  63. # c) give up — acceptance-rate comparison falls back to MTP (already
  64. # characterized in specs/tech-architecture/glm53-recipe-state.md).
  65. #
  66. # What IS done and committed regardless: glm53-flash-dflash2:local image
  67. # (DFlash2DraftModel port + registry), patch_eagle3.py (target-side
  68. # EAGLE3/aux-hidden-state support for Glm5Next, fork parity), verified
  69. # config plumbing (spec JSON parsed, aux layers 5/14/24/33/42 extracted
  70. # from the draft config, FlashInferCutlassMxfp8LinearKernel bound).
  71. #
  72. # PREREQUISITES: BOTH models cached on both nodes:
  73. # hf download local-inference-lab/GLM-5.3-Flash-NVFP4
  74. # hf download local-inference-lab/GLM-5.3-Flash-DFlash2-MXFP8
  75. engine = "vllm"
  76. name = "GLM-5.3-Flash + DFlash2 draft (vLLM, 2x Spark, spec-k7)"
  77. docker_image = "glm53-flash-dflash2:local"
  78. docker_image_dir = "glm53-flash-dflash2"
  79. # TARGET model — the DFlash2 draft model is referenced only via
  80. # --speculative-config below, never as the top-level model.
  81. model = "local-inference-lab/GLM-5.3-Flash-NVFP4"
  82. required_nodes = 2
  83. tensor_parallel_size = 2
  84. pipeline_parallel_size = 1
  85. distributed_backend = "mp"
  86. shm_size = "32gb"
  87. args = [
  88. # Stable served name — quant-agnostic (shared across glm53 quants)
  89. "--served-model-name", "glm53",
  90. "--trust-remote-code",
  91. "--distributed-executor-backend", "mp",
  92. # GMU is ONLY a startup guardrail (KV pinned below): 0.90 demands
  93. # 109.46 GiB free on GB10's 121.63 and driver reserve + page cache
  94. # routinely leave ~108.5 -> flaky boot deaths. 0.82 always fits.
  95. "--gpu-memory-utilization", "0.82",
  96. # Pinned 10 GiB KV; the draft adds 5 small sliding-window layers on top
  97. "--kv-cache-memory-bytes", "10737418240",
  98. "--kv-cache-dtype", "fp8_ds_mla",
  99. "--block-size", "256",
  100. "--max-model-len", "262144",
  101. "--max-num-seqs", "8",
  102. "--max-num-batched-tokens", "4096",
  103. "--enable-chunked-prefill",
  104. "--async-scheduling",
  105. "--enable-prefix-caching",
  106. "--disable-custom-all-reduce",
  107. # DFlash2 draft from local-inference-lab/GLM-5.3-Flash-DFlash2-MXFP8
  108. # (block-diffusion drafter, proposal length 7 — verbatim from the card)
  109. # Card: kv_cache_dtype auto (bf16 draft pages) — kept faithful.
  110. "--speculative-config", """
  111. '{"method":"dflash","model":"local-inference-lab/GLM-5.3-Flash-DFlash2-MXFP8","num_speculative_tokens":7,"kv_cache_dtype":"auto"}'""",
  112. "--language-model-only",
  113. # See header: eager is the safe control on the day-0 base (graphs+spec
  114. # quality regression). The card's newer build runs FULL graphs.
  115. "--enforce-eager",
  116. "--tool-call-parser", "glm47",
  117. "--enable-auto-tool-choice",
  118. "--reasoning-parser", "glm45",
  119. ]
  120. [env]
  121. HF_HUB_OFFLINE = "1"
  122. VLLM_MLA_NOPE_PAD_ROPE = "1"
  123. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  124. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  125. VLLM_USE_AOT_COMPILE = "0"
  126. TORCH_USE_RTLD_GLOBAL = "1"
  127. VLLM_NO_USAGE_STATS = "1"
  128. # Architecture (aarch64 / sm_121a DGX Spark)
  129. TORCH_CUDA_ARCH_LIST = "12.1a"
  130. FLASHINFER_CUDA_ARCH_LIST = "12.1f"
  131. CUTE_DSL_ARCH = "sm_121a"
  132. CMAKE_CUDA_ARCHITECTURES = "121"
  133. OMP_NUM_THREADS = "4"