# DeepSeek-V4.1-Flash on 4× DGX Spark with SGLang

Status: production. Measured: 2026-09-17. Web page: https://aidenle.com/recipes/deepseek-v4-1-flash-sglang-4x-dgx-spark/
Image: `aidendle94/sparkrun-sglang-dsv41-gb10:production-1.8`

DeepSeek-V4.1-Flash on four DGX Spark GB10 nodes with the SGLang team's unmodified image and a small MIT-licensed overlay. Against the vLLM recipe it reads prompts 30–45 % faster, writes answers at the same speed and holds a 23 % larger KV pool. It served the test fleet from 2026-09-17 until 2026-11-12.

**Time:** About 15 min per node to pull the image and copy the Engram rows, then about 10 min per boot

**Result:** DeepSeek-V4.1-Flash on four nodes: a 128K-token prompt in 34 s to the first token, about 114 / 97 / 35 tok/s for one stream on counting / code / prose, 524K tokens of context

## What you need

- Four DGX Spark GB10 nodes linked by a 200G RoCE fabric
- The image aidendle94/sparkrun-sglang-dsv41-gb10:production-1.8 (arm64), or a build from the repository's Dockerfile
- The overlay repository (MIT licence), github.com/aidendle94/DeepSeek-V4.1-Flash-SGLang-4x-DGX-Spark
- The deepseek-ai/DeepSeek-V4.1-Flash-1017 weights (510 GB) on one node, shared read-only over NFS with the other three
- About 50 GB of local NVMe disk per node for its share of the Engram tables, plus about 34 GB for the image
- Root on every node, and the out-of-memory guard earlyoom

## Overview

This recipe serves DeepSeek-V4.1-Flash on four DGX Spark GB10 nodes with SGLang. The model is split across the four nodes (tensor parallel, TP4). It is a mixture of experts (MoE), and its experts are divided four ways (expert parallel, EP4). Tool calls, image input and reasoning are on.

The engine is the SGLang team's unmodified image with a small MIT-licensed overlay of import hooks that makes the model fit on a Spark. It served the test fleet from 2026-09-17 to 2026-11-12. The fleet now runs [Inkling-2-Small](https://aidenle.com/recipes/inkling-2-small-sglang-4x-dgx-spark.md).

> **Code and image.**
>
> The overlay, the launcher, the watchdog and the benchmarks are in [github.com/aidendle94/DeepSeek-V4.1-Flash-SGLang-4x-DGX-Spark](https://github.com/aidendle94/DeepSeek-V4.1-Flash-SGLang-4x-DGX-Spark) (MIT licence), and in [github.com/aidendle94/sparkrun-recipes](https://github.com/aidendle94/sparkrun-recipes) as `recipes/deepseek-v4.1-flash/sglang`. The image is [aidendle94/sparkrun-sglang-dsv41-gb10](https://hub.docker.com/r/aidendle94/sparkrun-sglang-dsv41-gb10/tags), tag `production-1.8`, for arm64. Use the launcher from the same release as the image.

> **Prior work.**
>
> Engram-on-disk comes from tonyd2wild and Kai via the vLLM recipe on this site, V4.1 support from the SGLang team, and the RoCEnante runtime and SM12x GEMM kernels from b12x, all under Apache-2.0. The NOTICE file lists every third-party piece, including tonyd2wild's MIT-licensed row-copy tool and bench loop.

## Build

### One container per node

Start the three workers first and the head node (rank 0) last. The repository's launcher does this, and with `--dry-run` it prints the four commands. The command below is for rank 0. The workers differ in `--node-rank`, in `HOST_IP` and in the source of their Engram rows.

docker run · one rank (rank 0 shown):

```bash
# On the node that holds the checkpoint, use these instead of -e SPARK_ENGRAM_DIR=/engram-local:
#   -e SPARK_ENGRAM_DIR=/models/repo/snapshots/<snapshot> -e SPARK_ENGRAM_ROWS=1:<lo>:<hi>,14:<lo>:<hi>
docker run -d --name sgldsv41 --restart no --network host --ipc host --cap-add IPC_LOCK --gpus all \
  --shm-size 32g --memory 112g --memory-swap 112g --ulimit memlock=-1:-1 --ulimit stack=67108864 \
  --device /dev/infiniband:/dev/infiniband --oom-score-adj 500 \
  -v <hf-repo-dir>:/models/repo:ro -v <writable-cache-dir>:/root/.cache \
  -v <engram-local-dir>:/engram-local:ro -e SPARK_ENGRAM_DIR=/engram-local \
  -e SPARK_ENGRAM_MODE=hostnode -e SPARK_ENGRAM_EARLY=1 -e SPARK_ENGRAM_PREFETCH=1 -e SPARK_PAGE_CACHE_RELEASE=1 \
  -e SPARK_LATE_TAIL_SKIP=1 -e SPARK_LATE_TAIL_SKIP_ALL=0 -e SPARK_ENGRAM_THREADS=64 -e SPARK_ENGRAM_MAX_IDS=131072 -e SPARK_MXFP8_BACKEND=b12x \
  -e SPARK_SERVED_ALIASES=<other-model-ids,comma-separated> \
  -e SPARK_ROCE_AR=1 -e SPARK_ROCE_AR_MAX=1MB -e SPARK_ROCE_AG_MAX=16MB \
  -e B12X_ROCE_HCA=<rdma-devices> -e B12X_ROCE_GID_INDEX=<this-node-roce-v2-gid-index> -e B12X_ROCE_SPIN_LIMIT=300000000 \
  -e SGLANG_ENABLE_DSV41_ENGRAM_HOST_TABLE=0 -e SGLANG_FLASHINFER_MOE_FUSED_FINALIZE=0 -e SGLANG_DSV41_REASONING_EFFORT=100 \
  -e PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False -e CUDA_DEVICE_ORDER=PCI_BUS_ID -e HOST_IP=<this-node-fabric-ip> \
  -e NCCL_NET=IB -e NCCL_IB_DISABLE=0 -e NCCL_IB_HCA=<rdma-devices> -e NCCL_SOCKET_IFNAME=<fabric-iface> -e GLOO_SOCKET_IFNAME=<fabric-iface> \
  -e NCCL_IB_ROCE_VERSION_NUM=2 -e NCCL_IB_ADDR_FAMILY=AF_INET -e NCCL_IB_ADDR_RANGE=<fabric-subnet>/24 -e NCCL_IB_SUBNET_PREFIX_LEN=24 -e NCCL_IB_GID_INDEX=<gid-index> \
  -e NCCL_CROSS_NIC=1 -e NCCL_IB_MERGE_NICS=0 -e NCCL_IB_SUBNET_AWARE_ROUTING=1 -e NCCL_CUMEM_ENABLE=0 -e NCCL_P2P_DISABLE=1 -e NCCL_SHM_DISABLE=1 \
  -e NCCL_BUFFSIZE=1048576 -e NCCL_LL128_BUFFSIZE=262144 -e NCCL_PROTO=^LL128 -e NCCL_MAX_NCHANNELS=8 \
  --entrypoint python3 aidendle94/sparkrun-sglang-dsv41-gb10:production-1.8 -m sglang.launch_server \
    --model-path /models/repo/snapshots/<snapshot> --served-model-name deepseek-v4.1-flash --trust-remote-code --load-format safetensors \
    --tp 4 --ep-size 4 --nnodes 4 --node-rank 0 --dist-init-addr <head-fabric-ip>:20100 --host 0.0.0.0 --port 8210 \
    --attention-backend dsv4 --moe-runner-backend flashinfer_mxfp4 --fp8-gemm-backend flashinfer_cutlass \
    --mem-fraction-static 0.80 --chunked-prefill-size 4096 --context-length 524288 --max-running-requests 16 --cuda-graph-max-bs-decode 16 \
    --random-seed 0 --enable-decoder-swa-bounded-replay --speculative-algorithm DSPARK --speculative-dspark-block-size 5 \
    --tool-call-parser deepseekv41 --reasoning-parser deepseek-v41 --watchdog-timeout 1800 --min-free-slots-delay 1 \
    --default-chat-template-kwargs '{"thinking":true}' --enable-metrics
```

1. Pull the image on every node, or build it from the repository's Dockerfile. Share the checkpoint's directory over NFS from the node that holds it. The repository's `launch/relaunch.sh` runs the steps below from rank 0, with a site file, `launch/fleet.env`.
2. Copy each rank's Engram rows to its node with `engram_local.py` from the vLLM recipe. The node that holds the checkpoint skips the copy and sets `SPARK_ENGRAM_ROWS`.
3. Keep `--fp8-gemm-backend flashinfer_cutlass` in the command.
4. Wait about 10 minutes. Check that the log shows `RoCE collectives on: world=4`, and run `free -g` on every node.
5. Send a few test requests: a count to 20, a long prompt with one fact to find, an image, a tool call. Then start `launch/watchdog.sh`, which relaunches the fleet when it stops answering.

thinking is on by default at max; per request:

```bash
curl -s http://<head>:8210/v1/chat/completions -H 'Content-Type: application/json' -d '{
  "model": "deepseek-v4.1-flash", "max_tokens": 300, "temperature": 0,
  "messages": [{"role": "user", "content": "Is 91 a prime number? Answer briefly."}],
  "chat_template_kwargs": {"thinking": true, "reasoning_effort": 25}}'
# "thinking": false turns reasoning off.
# reasoning_effort takes low (50), high (75), max (100) or any integer from 1 to 100.
```

## Performance

### How fast it runs

| Same fleet, V4.1-Flash-1017 | production-1.7.1 | production-1.8 |
|---|---|---|
| 32K-token needle of unique words, time to first token | 8.0 s | **6.6–6.7 s** |
| 128K-token needle of unique words, time to first token | 45.0 s | **34.1–39 s** |
| decode with one stream, counting / code / prose | ~108 / 93 / 37 tok/s | 114 / 96–100 / 35–36 tok/s |
| coding conversation of 10 turns over ~62K tokens, decode speed over the whole conversation | 65.9 tok/s | 65.5 tok/s |

Release 1.7.1 against 1.8: time to first token on a long prompt with one fact to find, and decode speed.

| Same nodes, same prompts, same day | SGLang + overlay (production-1.0) | vLLM production-1.2 (DCP4, RoCE) |
|---|---|---|
| prefill of 32K tokens of unique random words | **3,068 tok/s · 10.7 s** | 2,094–2,362 tok/s · 14.2–15.5 s |
| prefill of 128K tokens of unique random words | **2,580 tok/s · 51.1 s** | 2,152 tok/s · 60.5 s |
| decode with one stream (counting / code / prose, greedy, reasoning off) | 94.4 / 67.8 / 32.4 tok/s | 93.0 / 66.6 / 31.3 tok/s (best boot 94.5 / 74.5 / 35.9) |
| KV pool | **4,219,904 tokens** (4.2–5.8M tokens across boots) | 3,418,145 tokens (6 GiB pinned per rank, DCP4) |
| context length | 524,288 tokens | 500,000 tokens |

First SGLang release against the vLLM recipe, on prompts unique to each run.

Measured: 2026-09-17 to 2026-10-18, releases 1.0 to 1.8

The model runs on four nodes (TP4, EP4) with an MIT-licensed overlay on SGLang, and decode is one stream, greedy, thinking off.

| Measurement | Value | Note |
|---|---|---|
| Prefill · 32K / 128K, 1.8 | 4,892 / 3,848 tok/s | Unique random words: 6.7 s / 34.1 s to first token |
| Decode · counting / code / prose, 1.8 | 114 / 97 / 35 tok/s | One stream, greedy, thinking off |
| Coding conversation, 1.8 | 65.5 tok/s | 10 turns over about 62K tokens of source code |
| KV pool, 1.8 | 6.30M tokens | Sized automatically at memory fraction 0.80 |
| Context | 524K tokens | A planted fact was found at 32K and at 128K tokens |
| Boot to healthy | 583 s | With warm compile caches |
| Overlay | 18 hook modules | MIT-licensed, release 1.8 |
| Concurrency, 1.4 / 1.5 | 56 / 220 / 331 tok/s | All streams together at 1 / 8 / 16 streams |
| Claude Code follow-up turn, 1.7.1 | 1,536 / 165,888 tokens | Tokens read / reused from the prefix cache, in a session of about 168K tokens |

**From 1.7.1 to 1.8 on SGLang main** (seconds to first token and for the stress run · lower is better)

|  | 1.7.1, on the dev-dsv41 image | 1.8, on SGLang main |
|---|---|---|
| 32K needle, unique words | 8 | 6.7 |
| 128K needle, unique words | 45 | 34.1 |
| 12 long prefills with decode streams | 167 | 140 |

Same fleet, same weights.

**Total throughput by concurrent streams, production-1.5** (tok/s · higher is better)

|  | tok/s · higher is better |
|---|---|
| 1 stream | 55.8 |
| 8 streams | 220.3 |
| 16 streams | 331.3 |

tonyd2wild's fixed prompt set of eight categories

**Changelog: vLLM production-1.2 (DCP4, RoCE) → SGLang + overlay production-1.0**

|  | vLLM production-1.2 (DCP4, RoCE) | SGLang + overlay production-1.0 |
|---|---|---|
| Engine | vLLM branch, 28 patch files in the image | lmsysorg/sglang:dev-dsv41, unmodified, 8 import hooks (MIT) |
| Prefill, 32K / 128K | 2,094–2,362 / 2,152 tok/s | **3,068 / 2,580 tok/s** |
| Decode, counting / code / prose | 93 / 67 / 31 tok/s | 94 / 68 / 32 tok/s |
| KV pool | 3,418,145 tokens | **4,219,904** tokens |
| Context | 500,000 tokens | 524,288 tokens |

## Notes

#### Limits and operating notes

- **The hooks fit only their nightly base image and raise an error at start if their target has moved.**
- **Free memory is thin during long prompts, and one stopped rank stops the whole fleet, so watch MemFree on every node, not MemAvailable.**
- **Set the RoCE-v2 GID index for each node, because a wrong index moves the exchanges back to NCCL.**
- **Never start a rank while the previous engine still holds the GPU, or the other three ranks hang until the watchdog timeout.**
