recipe.toml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # DeepSeek-V4.1-Flash (552B MoE, MXFP4 experts, Engram-on-disk) — 4x DGX Spark.
  2. #
  3. # Image: dsv41-flash:local (docker-images/dsv41-flash/ — tonyd2wild overlay
  4. # chain as clone-at-pin build: vllm dsv41-feat@e47aa780 + sm121
  5. # _C_stable_libtorch + FlashInfer 0.7.0rc1 + 7 boot-10 patches baked in,
  6. # MIT provenance).
  7. #
  8. # Model: deepseek-ai/DeepSeek-V4.1-Flash (476 GB on the NFS HF cache,
  9. # refs/main). The two 203 GB FP8 Engram n-gram tables are NEVER loaded into
  10. # HBM — the baked engram.py patch keeps them on disk (DSV41_ENGRAM_DISK=1)
  11. # and reads rows on demand. Node-local sparse copies of each rank's rows
  12. # (48 GB, engram-local.json) accelerate decode once created (DSV41_ENGRAM_DIR
  13. # below, added after the copies exist — first boot reads straight from NFS).
  14. #
  15. # Config mirrors their boot-10 serving setup (launch/dsv41-tp4.sh) with
  16. # local deviations:
  17. # CUDA graphs FULL_AND_PIECEWISE + exact DSpark capture sizes (no padded
  18. # rows — padded speculative batches hang SM120 sparse MLA, FlashInfer
  19. # #5015), DSpark k=5 with the checkpoint's own draft layers, tools +
  20. # vision on.
  21. # * GMU 0.85 (their 0.80): the indexer prefill buffer grows with max
  22. # context (~5.2 GiB at 1M, ~2.6 GiB at 512K); the extra budget keeps
  23. # the KV pool at ~11 GiB (≈1.6M tokens) with host headroom.
  24. # * 512K ctx (2026-09-11, operator): matches the GLM prod convention
  25. # (524288) and stays inside the row width their top-k fix was
  26. # validated for (300K measured, 1M-wide never re-run even by them).
  27. # The 1.6M-token pool gives 3× headroom at 512K.
  28. # * thinking ON + reasoning_effort=max by default (request can override
  29. # via chat_template_kwargs), served as "deepseek-v4-flash" (gateway
  30. # alias, no config churn).
  31. #
  32. # Reference: Aiden's write-up of the same stack + their deltas (B12X MoE
  33. # backend, explicit KV budget, DCP2 port) —
  34. # https://aidenle.com/recipes/deepseek-v4-1-flash-4x-dgx-spark/
  35. # (page says production-1.1 in places; the DCP2-baked image is
  36. # production-1.2 — the page was not updated to the end).
  37. engine = "vllm"
  38. name = "DeepSeek-V4.1-Flash MXFP4 (dsv41 img, 4x, DSpark k=5, Engram-on-disk)"
  39. docker_image = "dsv41-flash-b12x:local"
  40. docker_image_dir = "dsv41-flash-b12x"
  41. model = "deepseek-ai/DeepSeek-V4.1-Flash"
  42. required_nodes = 4
  43. tensor_parallel_size = 4
  44. pipeline_parallel_size = 1
  45. distributed_backend = "mp"
  46. shm_size = "32gb"
  47. # NO recipe entrypoint: the base image bakes ENTRYPOINT ["vllm","serve"]
  48. # (vllm/vllm-openai), so the launcher's CMD (model + flags) completes it.
  49. args = [
  50. # Stable gateway alias — clients/gateways keep the DeepSeek-V4-Flash
  51. # model name; no per-deployment config churn.
  52. "--served-model-name", "deepseek-v4-flash",
  53. "--trust-remote-code",
  54. "--distributed-executor-backend", "mp",
  55. "--gpu-memory-utilization", "0.85",
  56. "--max-model-len", "524288",
  57. "--max-num-seqs", "8",
  58. "--max-num-batched-tokens", "8192",
  59. # boot-4 fix: the V4 indexer backend refuses the smallest-listed block
  60. "--block-size", "128",
  61. # boot-10: exact capture sizes for DSpark k=5, SEQS=8 (multiples of 5
  62. # and 6 up to 48 — every decode batch gets an exact FULL graph, no padding)
  63. "--compilation-config", """
  64. '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[5,6,10,12,15,18,20,24,25,30,35,36,40,42,48]}'""",
  65. "--speculative-config", """
  66. '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"block","enable_adaptive_verification":false}'""",
  67. "--moe-backend", "b12x",
  68. "--tool-call-parser", "deepseek_v41",
  69. "--enable-auto-tool-choice",
  70. "--reasoning-parser", "deepseek_v41",
  71. "--default-chat-template-kwargs", """
  72. '{"thinking": true, "reasoning_effort": "max"}'""",
  73. ]
  74. [env]
  75. HF_HUB_OFFLINE = "1"
  76. # Engram tables stay on disk (the baked engram.py patch); 32 parallel row
  77. # reads, 16 MB chunks (their launch defaults)
  78. DSV41_ENGRAM_DISK = "1"
  79. DSV41_ENGRAM_DISK_THREADS = "32"
  80. DSV41_ENGRAM_DISK_CHUNK = "16"
  81. # Node-local sparse Engram copy (per-rank row ranges from the first boot's
  82. # "Engram DISK mode" log lines; built with tools/engram_local.py, verified
  83. # byte-for-byte). NVMe instead of NFS for the 23.6 GiB/rank tables.
  84. DSV41_ENGRAM_LOCAL = "1"
  85. DSV41_ENGRAM_DIR = "/engram-local"
  86. # CUDA graphs: the Engram rows are staged in prepare_inputs (baked
  87. # model_state.py prestage patch) so the whole decode step is capturable
  88. VLLM_USE_BREAKABLE_CUDAGRAPH = "1"
  89. VLLM_HAS_FLASHINFER_CUBIN = "1"
  90. VLLM_USE_RUST_FRONTEND = "0"
  91. # runtime JIT wedge countermeasure (their boot-3 lesson): kernels are
  92. # prebuilt in the image, but any residual JIT must not OOM the box
  93. MAX_JOBS = "2"
  94. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  95. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  96. TORCH_CUDA_ARCH_LIST = "12.1a"
  97. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  98. OMP_NUM_THREADS = "2"
  99. # Per-node sparse Engram copy (model-00047/00048 shards + engram-local.json)
  100. [[extra_mounts]]
  101. host = "/var/tmp/engram-local/DeepSeek-V4.1-Flash"
  102. container = "/engram-local"
  103. read_only = true
  104. # JIT caches persist per-node (self-namespace by engine version key; the
  105. # image prebakes the flashinfer 0.7.0rc1 SM120 kernels, first boots re-JIT
  106. # the rest)
  107. [[extra_mounts]]
  108. host = "~/sm121-cache/jit-121f/flashinfer"
  109. container = "/root/.cache/flashinfer"
  110. [[extra_mounts]]
  111. host = "~/sm121-cache/jit-121f/torchinductor"
  112. container = "/root/.cache/torchinductor"
  113. [[extra_mounts]]
  114. host = "~/sm121-cache/jit-121f/vllm"
  115. container = "/root/.cache/vllm"
  116. # B12X kernel JIT cache (B12X_CACHE_DIR; prebuilt into the image, persists
  117. # per node like the other JIT caches)
  118. [[extra_mounts]]
  119. host = "~/sm121-cache/jit-121f/b12x"
  120. container = "/root/.cache/b12x"