recipe.toml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # GLM-5.2 NF3-Hybrid โ€” ๐Ÿง  CONTEXT LANE (DCP4, 800K max-len)
  2. # 4ร— DGX Spark (GB10, aarch64/sm_121a), TP=4, DCP=4.
  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.6
  12. # instead of locally-built vllm-nf3-hybrid:probe. Pre-built on Docker Hub.
  13. # NOTE: production-hybrid-1.6 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. # DCP4 lane: KV sharded across all 4 nodes โ†’ 877K-token pool.
  18. # Every decode step pays ag_rs allreduce on all 78 layers.
  19. # MTP k=3 (needs fuse_allreduce_rms) โ€” near-perfect acceptance ~3.0
  20. # beat k=4/5 by ~8% on long network-taxed steps.
  21. #
  22. # Performance (measured 2026-07-07, 512-tok gens, temp 0, shallow ctx):
  23. # c1: 21.4โ€“21.6 tok/s | c2: 32.9 | c3: 38.9
  24. # c4: 45.4 | c5: 37.4 | c6: 40.1 aggregate
  25. # KV pool: 877,056 tokens | max-model-len: 800,000
  26. # Boot ~20 min, MTP k=3 acceptance ~3.0
  27. #
  28. # TUNING NOTES:
  29. # - gpu-memory-utilization 0.88 (GB10 unified memory; author's 0.96 is
  30. # dedicated-VRAM territory)
  31. # - max-num-batched-tokens โ‰ฅ2048 or NF3 graph capture breaks
  32. # - max-cudagraph-capture-size must cover seqsร—(1+k) = 4ร—4 = 16
  33. # - VLLM_DCP_SHARD_DRAFT=1 mandatory for MTP draft KV under DCP
  34. # - k is lane-specific: CONTEXT lane runs k=3 + fuse_allreduce_rms
  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 CONTEXT LANE (vLLM)"
  42. docker_image = "aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.6"
  43. model = "madeby561/GLM-5.2-MXFP8-NVFP4-NF3-Hybrid"
  44. parent_model = "zai-org/GLM-5.2"
  45. required_nodes = 4
  46. tensor_parallel_size = 4
  47. pipeline_parallel_size = 1
  48. distributed_backend = "mp"
  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", "auto",
  56. "--load-format", "fastsafetensors",
  57. # Context length (800K max-len, 877K KV pool)
  58. "--max-model-len", "200000",
  59. # Batch & memory
  60. "--max-num-seqs", "4",
  61. "--max-num-batched-tokens", "4096",
  62. "--max-cudagraph-capture-size", "32",
  63. "--gpu-memory-utilization", "0.84",
  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. # Compilation (CONTEXT: fuse_allreduce_rms for DCP network tax)
  72. "--compilation-config", """
  73. '{"pass_config":{"fuse_allreduce_rms":true}}'""",
  74. # Speculative decode โ€” CONTEXT: MTP k=3 (near-perfect acceptance ~3.0)
  75. "--speculative-config", """
  76. '{"method":"mtp","num_speculative_tokens":3,"moe_backend":"b12x","draft_sample_method":"probabilistic"}'""",
  77. # Tool calling & reasoning (verified working from first boot)
  78. "--tool-call-parser", "glm47",
  79. "--reasoning-parser", "glm45",
  80. "--enable-auto-tool-choice",
  81. # General
  82. "--trust-remote-code",
  83. "--enable-flashinfer-autotune",
  84. "--served-model-name", "glm-5.2",
  85. ]
  86. [env]
  87. # Memory stability
  88. #PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  89. #VLLM_ALLOW_LONG_MAX_MODEL_LEN = "1"
  90. # โ”€โ”€ DCP (Decode Context Parallelism) โ€” CONTEXT: DCP4 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  91. # KV sharded across all 4 nodes โ€” 4ร— pool, decode pays ag_rs gather
  92. DECODE_CONTEXT_PARALLEL_SIZE = "4"
  93. DCP_COMM_BACKEND = "ag_rs"
  94. DCP_KV_CACHE_INTERLEAVE_SIZE = "1"
  95. # โ”€โ”€ b12x suite (required) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  96. VLLM_USE_V2_MODEL_RUNNER = "1"
  97. VLLM_USE_B12X_FP8_GEMM = "1"
  98. VLLM_USE_B12X_MOE = "1"
  99. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  100. VLLM_DCP_GLOBAL_TOPK = "1"
  101. VLLM_DCP_SHARD_DRAFT = "1"
  102. B12X_W4A16_TC_DECODE = "1"
  103. B12X_MOE_FORCE_A16 = "1"
  104. B12X_DENSE_SPLITK_TURBO = "1"
  105. # โ”€โ”€ Hybrid loader knobs (v2) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  106. HYBRID_TIER = "both"
  107. HYBRID_KEPT = "b12x_nf3"
  108. HYBRID_NF3 = "b12x_nf3"
  109. HYBRID_B12X_MAX_TOKENS = "4096"
  110. HYBRID_MXFP8_NATIVE = "1"
  111. # Real path to tier json inside the image (loader hardcodes /opt/venv layout)
  112. HYBRID_MXFP8_TIER_JSON = "/usr/local/lib/python3.12/dist-packages/mxfp8_tier.json"
  113. # โ”€โ”€ Architecture (aarch64/sm_121a DGX Spark) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  114. TORCH_CUDA_ARCH_LIST = "12.1a"
  115. CUTE_DSL_ARCH = "sm_121a"
  116. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  117. # โ”€โ”€ Offline mode (weights must be cached on each node) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  118. HF_HOME = "/root/.cache/huggingface"
  119. HF_HUB_OFFLINE = "1"
  120. TRANSFORMERS_OFFLINE = "1"
  121. # โ”€โ”€ Timeout safety net (cold boot: cudagraph + JIT) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  122. VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS = "3600"
  123. # โ”€โ”€ NCCL / RoCE (cluster config ib_hca/socket_ifname used for most) โ”€โ”€โ”€โ”€โ”€โ”€
  124. NCCL_CROSS_NIC = "1"
  125. NCCL_CUMEM_ENABLE = "0"
  126. NCCL_IGNORE_CPU_AFFINITY = "1"
  127. NCCL_DEBUG = "WARN"
  128. # โ”€โ”€ Compute โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  129. OMP_NUM_THREADS = "4"