recipe.toml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # GLM-5.2 NF3-Hybrid — 🏎️ FAST LANE (DCP1, 200K max-len)
  2. # 4× DGX Spark (GB10, aarch64/sm_121a), TP=4, DCP=1.
  3. #
  4. # Model: madeby561/GLM-5.2-MXFP8-NVFP4-NF3-Hybrid
  5. # → https://huggingface.co/madeby561/GLM-5.2-MXFP8-NVFP4-NF3-Hybrid
  6. #
  7. # Unpruned GLM-5.2 (753B/40B MoE, all 256 experts) in 3-format hybrid quant:
  8. # 327GB — top-64 experts/layer in NVFP4, remaining 192 in NF3 (3-bit),
  9. # non-expert layers in MXFP8.
  10. #
  11. # EXPERIMENT: Using aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.0
  12. # instead of locally-built vllm-nf3-hybrid:probe. Pre-built on Docker Hub.
  13. # NOTE: production-hybrid-1.0 lacks NF3 hybrid overlay files
  14. # (hybrid_loader.py, nf3_kernel.py, nvfp4_kernel.py, mxfp8_tier.json).
  15. # If it fails, revert to vllm-nf3-hybrid:probe.
  16. #
  17. # DCP1 lane: each sequence's KV cache lives entirely on one node → zero
  18. # cross-node attention traffic per decode step. ~1/4 the KV pool of DCP4.
  19. # Best for interactive chat, agents, throughput-sensitive workloads.
  20. #
  21. # Performance (measured 2026-07-07, 512-tok gens, temp 0, MTP acceptance 3.3–4.0):
  22. # c1: 24–29 tok/s (content-dependent, peaks to 29.1 @ accept 4.02)
  23. # c2: 36.6 | c3: 45.7 | c4: 54.2 | c5: 59.2 | c6: 67.4
  24. # KV pool: 219,264 tokens | max-model-len: 200,000
  25. #
  26. # TUNING NOTES:
  27. # - gpu-memory-utilization 0.88 (GB10 unified memory; author's 0.96 is
  28. # dedicated-VRAM territory; 0.88 = safe for 200K + 12e9 KV allocation)
  29. # - kv-cache-memory-bytes 12e9 per node caps KV pool at 219K tokens
  30. # - max-num-batched-tokens ≥2048 or NF3 graph capture breaks
  31. # - max-cudagraph-capture-size must cover seqs×(1+k) = 6×5 = 30
  32. # - FAST lane uses MTP k=4, NO fuse_allreduce_rms (no benefit without
  33. # DCP network tax)
  34. # - k is lane-specific: FAST runs k=4, no fuse
  35. #
  36. # PREREQUISITES:
  37. # - Weights cached on every node:
  38. # huggingface-cli download madeby561/GLM-5.2-MXFP8-NVFP4-NF3-Hybrid
  39. # (327GB, 334GB on disk, 96 safetensors shards)
  40. engine = "vllm"
  41. name = "GLM-5.2 NF3-Hybrid FAST LANE (vLLM)"
  42. docker_image = "aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.0"
  43. model = "madeby561/GLM-5.2-MXFP8-NVFP4-NF3-Hybrid"
  44. required_nodes = 4
  45. tensor_parallel_size = 4
  46. pipeline_parallel_size = 1
  47. distributed_backend = "mp"
  48. shm_size = "64gb"
  49. # docker_image_dir = "glm52-nf3-hybrid" # removed for experiment
  50. entrypoint = ["vllm", "serve"]
  51. args = [
  52. # Quantization & KV cache
  53. "--quantization", "modelopt_fp4",
  54. "--kv-cache-dtype", "fp8",
  55. "--load-format", "fastsafetensors",
  56. # Context length (200K max-len, 219K KV pool)
  57. "--max-model-len", "200000",
  58. # Batch & memory — FAST lane: 6 concurrent, 12e9 KV bytes
  59. "--max-num-seqs", "6",
  60. "--max-num-batched-tokens", "4096",
  61. "--max-cudagraph-capture-size", "32",
  62. "--gpu-memory-utilization", "0.88",
  63. "--kv-cache-memory-bytes", "12000000000",
  64. # Engine backends
  65. "--attention-backend", "B12X_MLA_SPARSE",
  66. "--moe-backend", "b12x",
  67. # Scheduling
  68. "--async-scheduling",
  69. "--enable-chunked-prefill",
  70. "--enable-prefix-caching",
  71. # Speculative decode — FAST: MTP k=4 (accept 3.3–4.0, best aggregate)
  72. "--speculative-config", """
  73. '{"method":"mtp","num_speculative_tokens":4,"moe_backend":"b12x","draft_sample_method":"probabilistic"}'""",
  74. # Tool calling & reasoning (verified working from first boot)
  75. "--tool-call-parser", "glm47",
  76. "--reasoning-parser", "glm45",
  77. "--enable-auto-tool-choice",
  78. # General
  79. "--trust-remote-code",
  80. "--enable-flashinfer-autotune",
  81. "--served-model-name", "glm-5.2",
  82. ]
  83. [env]
  84. # ── DCP (Decode Context Parallelism) — FAST: DCP1 ────────────────────────
  85. # KV lives locally — zero cross-node attention traffic, ~1/4 pool of DCP4
  86. DECODE_CONTEXT_PARALLEL_SIZE = "1"
  87. DCP_COMM_BACKEND = "ag_rs"
  88. DCP_KV_CACHE_INTERLEAVE_SIZE = "1"
  89. # ── b12x suite (required) ─────────────────────────────────────────────────
  90. VLLM_USE_V2_MODEL_RUNNER = "1"
  91. VLLM_USE_B12X_FP8_GEMM = "1"
  92. VLLM_USE_B12X_MOE = "1"
  93. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  94. VLLM_DCP_GLOBAL_TOPK = "1"
  95. VLLM_DCP_SHARD_DRAFT = "1"
  96. B12X_W4A16_TC_DECODE = "1"
  97. B12X_MOE_FORCE_A16 = "1"
  98. B12X_DENSE_SPLITK_TURBO = "1"
  99. # ── Hybrid loader knobs (v2) ──────────────────────────────────────────────
  100. HYBRID_TIER = "both"
  101. HYBRID_KEPT = "b12x_nf3"
  102. HYBRID_NF3 = "b12x_nf3"
  103. HYBRID_B12X_MAX_TOKENS = "4096"
  104. HYBRID_MXFP8_NATIVE = "1"
  105. HYBRID_MXFP8_TIER_JSON = "/usr/local/lib/python3.12/dist-packages/mxfp8_tier.json"
  106. # ── Architecture (aarch64/sm_121a DGX Spark) ──────────────────────────────
  107. TORCH_CUDA_ARCH_LIST = "12.1a"
  108. CUTE_DSL_ARCH = "sm_121a"
  109. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  110. # ── Offline mode (weights must be cached on each node) ────────────────────
  111. HF_HOME = "/root/.cache/huggingface"
  112. HF_HUB_OFFLINE = "1"
  113. TRANSFORMERS_OFFLINE = "1"
  114. # ── Timeout safety net (cold boot: cudagraph + JIT) ───────────────────────
  115. VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS = "3600"
  116. # ── NCCL / RoCE (cluster config ib_hca/socket_ifname used for most) ──────
  117. NCCL_CROSS_NIC = "1"
  118. NCCL_CUMEM_ENABLE = "0"
  119. NCCL_IGNORE_CPU_AFFINITY = "1"
  120. NCCL_DEBUG = "WARN"
  121. # ── Compute ────────────────────────────────────────────────────────────────
  122. OMP_NUM_THREADS = "4"