recipe.toml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # GLM-5.2 Hybrid FP8+NVFP4+MXFP4 — 4× DGX Spark (GB10, sm_121a), TP=4, DCP=4.
  2. #
  3. # Model: aidendle94/GLM-5.2-Hybrid-FP8-MXFP4
  4. # → https://huggingface.co/aidendle94/GLM-5.2-Hybrid-FP8-MXFP4
  5. #
  6. # Mixed-precision GLM-5.2 checkpoint:
  7. # - Attention (MLA projections, indexer): block-FP8
  8. # - Dense MLPs & shared experts: NVFP4 (group-16)
  9. # - Routed experts, layers 3–77: MXFP4 (e2m1 + ue8m0 per-32)
  10. # - MTP draft experts (layer 78): MXFP4
  11. # - Norms, gates, lm_head, MTP dense: BF16
  12. #
  13. # Image: aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.2
  14. # vLLM + b12x GB10 kernels with hybrid_mxfp4_ct quant config,
  15. # index-authoritative loader, NVFP4 KV cache with per-token scaling,
  16. # sparse-MLA CKV gather, boot-time kernel prewarm.
  17. #
  18. # PREREQUISITES:
  19. # - Models cached on every node via HF_HOME:
  20. # huggingface-cli download aidendle94/GLM-5.2-Hybrid-FP8-MXFP4
  21. # (382 GiB, requires free disk on each node)
  22. #
  23. # REFERENCE:
  24. # https://forums.developer.nvidia.com/t/glm-5-2-hybrid-fp8-nvfp4-mxfp4-optimal-runtime-recipe/377598
  25. # https://huggingface.co/aidendle94/GLM-5.2-Hybrid-FP8-MXFP4
  26. engine = "vllm"
  27. name = "GLM-5.2 Hybrid FP8-MXFP4 (vLLM)"
  28. docker_image = "aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.2"
  29. model = "aidendle94/GLM-5.2-Hybrid-FP8-MXFP4"
  30. required_nodes = 4
  31. tensor_parallel_size = 4
  32. pipeline_parallel_size = 1
  33. distributed_backend = "mp"
  34. shm_size = "10gb"
  35. entrypoint = ["vllm", "serve"]
  36. args = [
  37. # Model name
  38. "--served-model-name", "glm-5.2",
  39. # General
  40. "--trust-remote-code",
  41. "--reasoning-parser", "glm45",
  42. "--tool-call-parser", "glm47",
  43. "--enable-auto-tool-choice",
  44. "--enable-prefix-caching",
  45. # DCP (Decode Context Parallelism)
  46. "--decode-context-parallel-size", "4",
  47. "--dcp-comm-backend", "ag_rs",
  48. # Engine backends
  49. "--attention-backend", "B12X_MLA_SPARSE",
  50. # HF overrides — 78-char index_topk_pattern (GLM-5.2 MLP/expert routing)
  51. "--hf-overrides", """
  52. '{"index_topk_pattern":"FFFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSSFSSS"}'""",
  53. # KV cache — NVFP4 with per-token scaling (nvfp4_ds_mla)
  54. "--kv-cache-dtype", "nvfp4_ds_mla",
  55. "--kv-cache-memory-bytes", "5500000000",
  56. # Context & batch config
  57. "--max-model-len", "262144",
  58. "--max-num-batched-tokens", "2048",
  59. "--max-num-seqs", "3",
  60. "--gpu-memory-utilization", "0.89",
  61. # Speculative decode — MTP k=4 with adaptive depths
  62. "--speculative-config", """
  63. '{"model":"aidendle94/GLM-5.2-Hybrid-FP8-MXFP4/mtp-draft","method":"mtp","num_speculative_tokens":4,"draft_attention_backend":"B12X_MLA_SPARSE","adaptive_speculative_tokens_window":32}'""",
  64. # Compilation — FULL_AND_PIECEWISE with all custom ops, 8 capture sizes
  65. "--compilation-config", """
  66. '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"],"cudagraph_capture_sizes":[1,2,3,4,5,6,8]}'""",
  67. # Timeout safety net (cold boot: ranks finish minutes apart)
  68. "--distributed-timeout-seconds", "3600",
  69. "--cpu-distributed-timeout-seconds", "3600",
  70. ]
  71. [env]
  72. # ── b12x suite ────────────────────────────────────────────────────────────
  73. VLLM_USE_V2_MODEL_RUNNER = "1"
  74. VLLM_USE_B12X_MOE = "1"
  75. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  76. VLLM_DCP_SHARD_DRAFT = "1"
  77. VLLM_DCP_GLOBAL_TOPK = "1"
  78. VLLM_DSV4_INDEXER_SP = "1"
  79. # ── MLA CKV gather (sparse gather for decode) ─────────────────────────────
  80. VLLM_B12X_MLA_CKV_GATHER = "1"
  81. VLLM_B12X_MLA_CKV_GATHER_MAX_TOKENS = "262144"
  82. VLLM_B12X_MLA_DECODE_SPARSE_GATHER = "1"
  83. VLLM_B12X_MLA_DECODE_GATHER_V2 = "1"
  84. # ── Speculative decode ────────────────────────────────────────────────────
  85. VLLM_ADAPTIVE_SPEC_DEPTHS = "2,4"
  86. # ── NVFP4 KV cache ────────────────────────────────────────────────────────
  87. VLLM_NVFP4_MLA_PER_TOKEN_SCALE = "1"
  88. # ── Timeout safety net ────────────────────────────────────────────────────
  89. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  90. VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS = "1800"
  91. VLLM_ALLOW_LONG_MAX_MODEL_LEN = "1"
  92. # ── MUST unset baked VLLM_PREFIX_CACHE_RETENTION_INTERVAL ─────────────────
  93. # The image bakes a value that GLM-5.2's KV coordinator rejects.
  94. # Empty string = unset at runtime.
  95. VLLM_PREFIX_CACHE_RETENTION_INTERVAL = ""
  96. # ── Architecture (aarch64/sm_121a DGX Spark) ──────────────────────────────
  97. CUTE_DSL_ARCH = "sm_121a"
  98. TORCH_CUDA_ARCH_LIST = "12.1a"
  99. # ── JIT cache ──────────────────────────────────────────────────────────────
  100. # Under ~/.cache so it persists inside the HF cache mount (-v ~/.cache/.../hf)
  101. # Avoids ~20 min recompilation on each cold boot.
  102. XDG_CACHE_HOME = "/root/.cache"
  103. # ── NCCL overrides ─────────────────────────────────────────────────────────
  104. # Cluster config provides NCCL_IB_HCA, NCCL_IB_GID_INDEX, NCCL_SOCKET_IFNAME
  105. # Launcher defaults: NCCL_IGNORE_CPU_AFFINITY=1, NCCL_NET=IB, NCCL_DEBUG=WARN
  106. NCCL_IB_DISABLE = "0" # enable IB (override launcher default)
  107. NCCL_MAX_NCHANNELS = "4"
  108. NCCL_MIN_NCHANNELS = "4"
  109. NCCL_CUMEM_ENABLE = "0"
  110. # ── Compute ────────────────────────────────────────────────────────────────
  111. OMP_NUM_THREADS = "4"
  112. # Volumes not needed — model is a Hugging Face Hub ID, downloaded via HF_HOME