localairecipes launch configs for local inference

DeepSeek-V4.1-Flash on 4x DGX Spark — tuned TP4 SGLang/DSpark

00 upvotes — sign in to vote sign in to vote

community Community submission — verify on your own hardware.

recipe by knapcio (TP4 profile, v2.1-v2.3 production stack, release gates)↗, MiaAI-Lab (upstream: launcher, Engram store, b12x routing, memory model)↗, 0xSero (original 4x RTX PRO 6000 recipe skeleton boot.py derives from)↗, kpham-sgl (sglang#39187 bounded dense-indexer prefill transient, backported as adapter/indexer_chunked*.py)↗, BBuf + dsv4.1 branch contributors (#39370, #39646, #39648, #39653 decode kernel work in the canary images)↗, rhys101 (SG17 RoCEnante overlay + SG18 prefill TP split from DeepSeek-V4.1-Flash-vLLM-DGX-Spark-8)↗, local-inference-lab — Luke Alonso & Jason (b12x: RoCEnante one-shot RDMA all-reduce + fused MoE kernels)↗, FujitsuPolycom + sparkring contributors (switchless-ring opposite-node paths, path-aware RoCEnante)↗, Saolence (#1/#2/#4/#5/#6: ring as opt-in switch, NCCL/build fixes, first-deployer review)↗, rsync/rchmagos (#8: RoCEnante on the switchless ring, DSV41_ROCE_RING + scripts/ring_mesh/)↗ · listed by localai-recipes

revision r3 · commit ddf188add7 · updated 21 h ago · license CC-BY-4.0

chat code dspark long-context speculative tp4 spark-cluster rdma roce switched-fabric multi-node

Launch command

python3 -u /opt/dsv41/boot.py run --model-path /models/DeepSeek-V4.1-Flash --served-model-name deepseek-v4.1-flash --trust-remote-code --load-format safetensors --tp 4 --ep-size 1 --nnodes 4 --node-rank 0 --dist-init-addr 10.0.0.1:20000 --attention-backend dsv4 --moe-runner-backend flashinfer_mxfp4 --mem-fraction-static 0.80 --chunked-prefill-size 4096 --context-length 1048576 --max-running-requests 16 --cuda-graph-max-bs-decode 16 --max-total-tokens 8000000 --random-seed 0 --enable-decoder-swa-bounded-replay --speculative-algorithm DSPARK --speculative-dspark-block-size 5 --tool-call-parser deepseekv41 --reasoning-parser deepseek-v41 --host 0.0.0.0 --port 8888 --fp8-gemm-backend flashinfer_cutlass --watchdog-timeout 1800 --min-free-slots-delay 1 --enable-deepseek-v4-fp4-indexer --enable-cache-report --sleep-on-idle --model-loader-extra-config '{"num_threads":1}'

runtime

env: 'EXTRA_CONTAINER_ENV (production v2.3 line, mirrored to every rank): DSV41_INDEXER_CHUNKED=1 SGLANG_DSPARK_FOLDED_SAMPLING=2 SGLANG_ROCE_ALLREDUCE=1 SGLANG_ROCE_MAX_SIZE=2097152 B12X_ROCE_HCA=rocep1s0f0,roceP2p1s0f0 B12X_ROCE_CACHE_DIR=/state/b12x-roce B12X_COMPILE_CACHE_DIR=/state/b12x-compile SPARK_PREFILL_TP_SPLIT=1 SPARK_PREFILL_TP_MIN_CONTEXT=32768 SPARK_PREFILL_TP_MIN_ROWS=1024 SGLANG_RUST_BUILD_MODE=never DSV41_FAST_LOAD=1 DSV41_FAST_LOAD_EP_SIZE=1 DSV41_FAST_LOAD_TP_SLICE=auto DSV41_FAST_LOAD_N_EXPERTS=384 DSV41_FAST_LOAD_INFLIGHT_GB=6 DSV41_ENGRAM_PREFETCH=1 DSV41_SHARED_PAD_K=1 DSV41_WO_A_W8=1 DSV41_DRAFT_TAU=0.7 DSV41_DRAFT_HEAD_FP8=1 DSV41_BLOCK_VERIFY=1 DSV41_FOLDED_FENCE=1 DSV41_VERIFY_CAP=conf:0.1 DSV41_AUTOTUNE_KEEP=1 DSV41_WO_A_W8_MID=1 DSV41_WO_A_W8_DROP=1 DSV41_REPLICATED_SPLIT=wqkv_a,engram.wkv DSV41_DRAFT_MAIN_PROJ_SPLIT=1 DSV41_ROCE_GATHER=2097152 DSV41_ROUTER_LIVE=1 DSV41_MOE_B12X_NEXT=1 DSV41_MOE_B12X_NEXT_DETERMINISTIC=1 DSV41_HC_FUSED=1 DSV41_PREFILL_SP=1 DSV41_PREFILL_SP_FP8=1 DSV41_L2_PREFETCH=1 DSV41_L2_PREFETCH_WOA=1 DSV41_SPEC_SYNC_FREE=all DSV41_EAGER_GLUE=all DSV41_SPLIT_COMPACT_GATHER=1 DSV41_CERT_HEAD=1 DSV41_CERT_HEAD_M=6,12,18,24,30,36,42,48 | Also per .env.tp4.example: EP_SIZE=1 DSV41_MXFP8_BACKEND=b12x DSV41_SHARED_PAD_K=1 DSV41_CACHE_GIB=4 DSV41_CACHE_WAYS=16 DSV41_IO_THREADS=96 DSV41_ENGRAM_PREFETCH=1 DSV41_TP_PAD=0 DSV41_MAX_NEW_TOKENS=32768 DSV41_LOOP_ABORT=1 SGLANG_DSV41_REASONING_EFFORT=75 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False DSV41_PREFILL_EMPTY_CACHE_TOKENS=8192 SGLANG_FLASHINFER_MOE_FUSED_FINALIZE=0 NCCL_BUFFSIZE=1048576 NCCL_PROTO=^LL128 NCCL_MAX_NCHANNELS=8 B12X_ROCE_HCA=rocep1s0f0,roceP2p1s0f0 | Launch: IMAGE=dsv41-4x-spark:canary-roce, BUILD_DOCKERFILE=Dockerfile.canary-roce, EP_SIZE=1, port 8888 + dist port 20000 + NFS 2049/111 node-to-node.'
notes: 'Run ./start-tp4.sh (doctor|download|build|share|pack|serve): boot.py profile bootstrap, .env.tp4 from .env.tp4.example (HEAD_IP/WORKER_IPS/MODEL_DIR/fabric), dockerized 4-rank fleet --gpus all --privileged --ipc host, ranks 1-3 over ssh, head rank 0 on :8888; boot log must show the DSV41 arming lines (shared-expert padding, indexer chunked, DSpark gamma=5, max_running_requests=16, RoCEnante ready, moe_b12x_next armed EP1, hc_fused bit-identical). Weights deepseek-ai/DeepSeek-V4.1-Flash @ fb2764a5 (476 GiB, 48 shards) at the pinned revision, packed Engram rows ~48 GiB NVMe/node (./start-tp4.sh pack). Fabric: switched RoCE (both CX-7 rails rocep1s0f0,roceP2p1s0f0) for the production line; switchless ring is opt-in (docs/switchless-ring.md, DSV41_ROCE_RING + patched NCCL). Boot ~556 s cold / ~120 s with DSV41_FAST_LOAD; KV pool 6.8-7.3M tokens at 1M context; MEM_FRACTION_STATIC=0.80 keeps ~24 GiB/rank outside the static pool for the bounded prefill transient (indexer chunked 2 GiB rows, sglang#39187 backport). MEASURED FABRIC CAVEAT: headline numbers are on a switched RoCE fabric; a switchless ring without opposite-node hardware paths falls back to NCCL and decodes slower, and ring prefill is lower either way (one-link bisection). Known limits: prompt-token logprobs unavailable (--enable-decoder-swa-bounded-replay, requests 400, DSV41_REPLAY_GUARD), single-stream prose bounded by DSpark acceptance ~3 tok/step, fast loader leaves KV pool 3-13% smaller. Rollback: every layer is an env change (see README Rollback table); upstream MiaAI profile = MAX_RUNNING_REQUESTS=8, CHUNKED_PREFILL_SIZE=1024, EP_SIZE=4, EXTRA_CONTAINER_ENV unset.'

Use this recipe with your agent

Paste this into any agent chat — it fetches and applies the recipe:

Fetch https://localairecipes.com/api/v1/recipes/deepseek-v4-1-flash-on-4x-dgx-spark-tuned-tp4-sglang-dspark.json and apply the inference recipe it describes (engine flags, model, quant, context) to my setup. Ask before overwriting any existing config.

Or fetch it directly:

curl -fsSL https://localairecipes.com/api/v1/recipes/deepseek-v4-1-flash-on-4x-dgx-spark-tuned-tp4-sglang-dspark.json

Engine

Install note: NOT a stock sglang image: Dockerfile.canary-roce FROM lmsysorg/sglang:dev-dsv41, replaces the SGLang python tree with the upstream dsv4.1 branch at f80c91a4b (GitHub tarball via scripts/fetch-sglang-canary.sh), installs sglang-kernel==0.4.7 + sgl-deep-gemm==0.2.0 aarch64 wheels, applies rhys101's SG17 RoCEnante overlay + runtime/roce_tp4_adapt.py, bakes runtime/b12x (RoCEnante, frozen SG17) and runtime/b12x_next (b12x main at a7d7d29b + 64-row-tile patch) under /opt, and copies all adapters. Image tag dsv41-4x-spark:canary-roce, built per node via ./start-tp4.sh build. Requires aarch64 + nvidia-container-toolkit + NVIDIA driver 580.x.

Model

Context

  • max context: 1M tokens

KV pool

  • 3,670,000 tokens across concurrent requests

Performance

Speed by context

ContextConc.PrefillDecodeTTFT
4,096—4688 tok/s——reported
16,384—5583 tok/s——reported
32,768—5650 tok/s——reported
65,536—5664 tok/s——reported
131,072—5398 tok/s——reported
1,048,5761—89.7 tok/s—reported
1,048,5762—125.2 tok/s—reported
1,048,5764—165.9 tok/s—reported
1,048,5768—244.6 tok/s—reported
1,048,57616—357.2 tok/s—reported

prefill = prompt processing · decode = generation. All decode/prefill figures are shown as reported.

reported

notessparkDash 1.8.8 at the fleet's 2200 MHz SM clock cap (nvidia-smi -lgc 0,2200, timer re-applied), idle fleet, thinking off, temperature 0, 256 new tokens; production stack v2.3 (canary-roce image, EP_SIZE=1, all v2.3 switches on), fresh clone @ 5f11a97, 2026-09-29, docs/results/validation-20260929-v23.txt. c1 = median of three runs; c4 median of two; c2/c8/c16 single runs. Non-prose columns use different prompts per concurrency (per-stream not comparable across columns). sparkDash prefill filler is one repeated token so the Engram row cache inflates prefill (MiaAI-Lab#21): on real text v2.2 measured 3915/4743/4822/4946/4800 tok/s at ~4k/15k/30k/56k/123k, unchanged in v2.3. Decode gains almost nothing above the 2200 MHz cap (uncapped: -1.5% prose, -0.7% code).

Install requirements

NVIDIA driver floor: unknown - check the image tag

Source: NVIDIA CUDA Toolkit Release Notes - driver compatibility tables (https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/, fetched 2026-10-03).

Map the placeholders to your rig

Downloads

Revision notes

Submitted 2026-10-10 from lar-scout ingest card t_ad3aebd3. Repo @ fa1356384ed246f3040775210668f02a1bba3426 (HEAD verified via git ls-remote 2026-10-10; AGPL-3.0-or-later, upstream README preserved at docs/README-upstream.md with the credit chain kept verbatim). Launch argv transcribed from boot.py serve() + .env.tp4.example EXTRA_SGLANG_ARGS at that sha and flag-verified against boot.py's own env plumbing (spec/DSPARK/tables/nnodes/max-total-tokens/EXTRA_SGLANG_ARGS passthrough; EP_SIZE=1 pairs with DSV41_MOE_B12X_NEXT per .env.tp4.example comment; --min-free-slots-delay 1 matches README; DSPARK_SPS_TABLE=/state/dspark_sps.json only applied when the file exists). Performance rows transcribed from the repo's own bench docs (README 'Current results' + docs/results/validation-20260929-v23.txt sparkDash section) — measured, not claimed-by-anecdote; all at the 2200 MHz SM clock cap on a switched RoCE fabric (switchless ring slower, see notes). Engine pins from Dockerfile.canary-roce + scripts/fetch-sglang-canary.sh + runtime/b12x_next/b12x_next/SOURCE_COMMIT at the same sha; MiaAI upstream HEAD pinned via git ls-remote same day. HARDWARE NOTE: dgx-spark-x4 is a NEW device_count profile (site had 1x only) — hardware_profiles row seeded by a 0041-convention INSERT-only migration (family dgx-spark, generation blackwell, 128 GB unified memory each) submitted alongside this ingest, mirroring the 0053 cmp-170hx-x1 and 0047 rtx-3090-x4 precedents so the ingest resolves the seed slug instead of silent-creating a NULL card_family orphan bucket.

Revision history

Fork

Sign in to fork this recipe — a fork is your own copy; you own it and only you can update it.

Export

recipe.yaml (raw)