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

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

This recipe serves DeepSeek-V4.1-Flash with vLLM on four DGX Spark GB10 nodes. It keeps the model's 203 GB of Engram tables on disk with patches from tonyd2wild and Kai, and splits the conversation memory between the nodes (DCP2/DCP4).

**Time:** About 45 min per node, plus about 11 min for each boot

**Result:** A 4-node fleet (TP4): 75–95 tok/s decode, 185 tok/s in aggregate, 500K tokens of context, a 3.42M-token KV pool, images and tool calls

## What you need

- Four DGX Spark GB10 nodes linked by a 200G RoCE network
- The image aidendle94/sparkrun-vllm-dsv41-gb10:production-1.2 from Docker Hub, with the patch set and the b12x RoCEnante runtime built in
- Or production-1.0 with the seven patch files from tonyd2wild/DeepSeek-V4.1-Flash-vLLM-DGX-Spark (MIT licence) bind-mounted over it
- The deepseek-ai/DeepSeek-V4.1-Flash weights (510 GB) on one node, shared over NFS with the other three. Or the 418 GB variant aidendle94/DeepSeek-V4.1-Flash-NVFP4-Engram
- About 50 GB of local NVMe disk per node for its Engram rows, plus about 25 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 vLLM. One request at a time, it writes 94.5 tok/s on a counting prompt and 74.5 tok/s on code. A request may hold up to 500K tokens, and the model accepts images and tool calls. Thinking is on: the model reasons before it answers.

Stock vLLM keeps the model's 203 GB of Engram tables in memory, so the model does not fit on four DGX Sparks. This recipe keeps the tables on disk and reads only the rows it needs.

> **Replaced in production on 2026-09-17.**
>
> From 2026-09-17 to 2026-11-12, the test fleet served this model with SGLang instead: [DeepSeek-V4.1-Flash on 4× DGX Spark with SGLang](https://aidenle.com/recipes/deepseek-v4-1-flash-sglang-4x-dgx-spark.md). Since then it runs [Inkling-2-Small](https://aidenle.com/recipes/inkling-2-small-sglang-4x-dgx-spark.md).

> **Prior work.**
>
> The Engram-on-disk patch, the page-size fixes for GB10 and the top-k workaround come from tonyd2wild and Kai (MIT licence): github.com/tonyd2wild/DeepSeek-V4.1-Flash-vLLM-DGX-Spark. The b12x RoCEnante runtime comes from local-inference-lab (Jason @original-el8 and Luke Alonso), and its vLLM adapter from local-inference-lab/vllm#597, as carried by tonyd2wild's speed run. The full technical notes and tools are in the recipe repository.

## Build

### Deploy one container per node

Run one container per node. Share the checkpoint from one node over NFS (network file system). Start the three workers first and the head, which runs rank 0 and serves the API, last. Thinking runs at `reasoning_effort: max` by default. A request sets its own level with any integer from 1 to 100, or turns thinking off with `"thinking": false`.

Pick the checkpoint in the selector below: the original with fp8 Engram tables, or the NVFP4-Engram variant.

Engram tables: the page offers 2 options. Pick one; each changes the blocks that follow.

#### Option: fp8 Engram — deepseek-ai/DeepSeek-V4.1-Flash (original, what production ran)

Use the original 510 GB checkpoint. Keep about 50 GB of local disk per node for the Engram row copies.

docker run · one rank (rank 0 shown; workers add --headless and their own VLLM_HOST_IP):

```bash
# production-1.2 has the patch set built in. On production-1.0, add one -v per patch file after the /cache mount:
#   -v <patches>/engram.py:/usr/local/lib/python3.12/dist-packages/vllm/models/deepseek_v4_1/common/engram.py:ro  (etc., from mounts.txt)
# Set B12X_ROCE_GID_INDEX to this node's RoCE-v2 IPv4 entry, which is not always 3.
docker run -d --name dsv41vllm --restart no --network host --ipc host --shm-size 32g \
  --memory 112g --memory-swap 112g --ulimit memlock=-1:-1 --cap-add IPC_LOCK \
  --device /dev/infiniband:/dev/infiniband --oom-score-adj 500 --gpus all \
  -v <hf-repo-dir>:/models/repo:ro -v <writable-cache-dir>:/cache \
  -v <engram-local-dir>:/engram-local:ro -e DSV41_ENGRAM_DIR=/engram-local \
  -e DSV41_ENGRAM_DISK=1 -e DSV41_ENGRAM_DISK_THREADS=32 -e DSV41_ENGRAM_DISK_CHUNK=16 \
  -e DSV41_DCP_STAGE=3 -e DSV41_DCP_COMBINE=a2a -e DSV41_ENGRAM_MMAP=1 -e DSV41_ENGRAM_PREFETCH=1 -e DSV41_DCP_PREFILL_GATHER=1 \
  -e VLLM_HOST_IP=<this-node-fabric-ip> -e HF_HUB_OFFLINE=1 -e VLLM_CACHE_ROOT=/cache/vllm \
  -e TILELANG_CACHE_DIR=/cache/tilelang -e TRITON_CACHE_DIR=/cache/triton -e B12X_CACHE_DIR=/cache/b12x \
  -e VLLM_USE_BREAKABLE_CUDAGRAPH=1 -e VLLM_USE_FLASHINFER_SAMPLER=0 -e VLLM_HAS_FLASHINFER_CUBIN=1 \
  -e MAX_JOBS=2 -e FLASHINFER_NVCC_THREADS=1 -e PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
  -e TORCH_CUDA_ARCH_LIST=12.1a -e FLASHINFER_CUDA_ARCH_LIST=12.1a -e FLASHINFER_DISABLE_VERSION_CHECK=1 \
  -e NCCL_NET=IB -e NCCL_IB_HCA=<rdma-devices> -e NCCL_SOCKET_IFNAME=<fabric-iface> -e NCCL_IB_GID_INDEX=3 \
  -e NCCL_IB_ROCE_VERSION_NUM=2 -e NCCL_ALGO=Ring -e NCCL_PROTO=LL,LL128,Simple -e NCCL_CUMEM_ENABLE=0 \
  -e VLLM_ENABLE_ROCE_ALLREDUCE=1 -e VLLM_ROCE_ALLREDUCE_MAX_SIZE=1MB -e VLLM_ROCE_ALLGATHER_MAX_SIZE=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 B12X_ROCE_CACHE_DIR=/opt/b12x-roce/cache \
  aidendle94/sparkrun-vllm-dsv41-gb10:production-1.2 /models/repo/snapshots/<snapshot> \
    --served-model-name deepseek-v4.1-flash --host 0.0.0.0 --port 8410 \
    --tensor-parallel-size 4 --decode-context-parallel-size 2 --dcp-comm-backend ag_rs \
    --gpu-memory-utilization 0.80 --kv-cache-memory-bytes 6442450944 \
    --max-model-len 500000 --max-num-seqs 8 --max-num-batched-tokens 8192 --block-size 128 \
    --moe-backend b12x --engram-config '{"cpu_offload":false}' \
    --default-chat-template-kwargs '{"thinking":true,"reasoning_effort":"max"}' \
    --limit-mm-per-prompt '{"image":4}' --mm-processor-cache-gb 1 \
    --tool-call-parser deepseek_v41 --enable-auto-tool-choice --reasoning-parser deepseek_v41 \
    --speculative-config '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"block","enable_adaptive_verification":false}' \
    --compilation-config '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[5,6,10,12,15,18,20,24,25,30,35,36,40,42,48]}' \
    --distributed-executor-backend mp --nnodes 4 --node-rank 0 --master-addr <head-fabric-ip> --master-port 29551
```

#### Option: NVFP4 Engram — aidendle94/DeepSeek-V4.1-Flash-NVFP4-Engram (variant, −92 GB)

Change two things below: the repository directory and the node-local row copies. Make the row copies from this checkpoint, because the loader refuses fp8 copies.

docker run · one rank, NVFP4-Engram variant (rank 0 shown; workers add --headless and their own VLLM_HOST_IP):

```bash
# Download once, on the node that exports the model directory:  huggingface-cli download aidendle94/DeepSeek-V4.1-Flash-NVFP4-Engram
# -v <engram-local-dir> and DSV41_ENGRAM_DIR: row copies made FROM THIS checkpoint. Leave out both until the copies exist.
# Set B12X_ROCE_GID_INDEX to this node's RoCE-v2 IPv4 entry, which is not always 3.
docker run -d --name dsv41vllm --restart no --network host --ipc host --shm-size 32g \
  --memory 112g --memory-swap 112g --ulimit memlock=-1:-1 --cap-add IPC_LOCK \
  --device /dev/infiniband:/dev/infiniband --oom-score-adj 500 --gpus all \
  -v <hf-repo-dir of the NVFP4-Engram variant>:/models/repo:ro -v <writable-cache-dir>:/cache \
  -v <engram-local-dir>:/engram-local:ro -e DSV41_ENGRAM_DIR=/engram-local \
  -e DSV41_ENGRAM_DISK=1 -e DSV41_ENGRAM_DISK_THREADS=32 -e DSV41_ENGRAM_DISK_CHUNK=16 \
  -e DSV41_DCP_STAGE=3 -e DSV41_DCP_COMBINE=a2a -e DSV41_ENGRAM_MMAP=1 -e DSV41_ENGRAM_PREFETCH=1 -e DSV41_DCP_PREFILL_GATHER=1 \
  -e VLLM_HOST_IP=<this-node-fabric-ip> -e HF_HUB_OFFLINE=1 -e VLLM_CACHE_ROOT=/cache/vllm \
  -e TILELANG_CACHE_DIR=/cache/tilelang -e TRITON_CACHE_DIR=/cache/triton -e B12X_CACHE_DIR=/cache/b12x \
  -e VLLM_USE_BREAKABLE_CUDAGRAPH=1 -e VLLM_USE_FLASHINFER_SAMPLER=0 -e VLLM_HAS_FLASHINFER_CUBIN=1 \
  -e MAX_JOBS=2 -e FLASHINFER_NVCC_THREADS=1 -e PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
  -e TORCH_CUDA_ARCH_LIST=12.1a -e FLASHINFER_CUDA_ARCH_LIST=12.1a -e FLASHINFER_DISABLE_VERSION_CHECK=1 \
  -e NCCL_NET=IB -e NCCL_IB_HCA=<rdma-devices> -e NCCL_SOCKET_IFNAME=<fabric-iface> -e NCCL_IB_GID_INDEX=3 \
  -e NCCL_IB_ROCE_VERSION_NUM=2 -e NCCL_ALGO=Ring -e NCCL_PROTO=LL,LL128,Simple -e NCCL_CUMEM_ENABLE=0 \
  -e VLLM_ENABLE_ROCE_ALLREDUCE=1 -e VLLM_ROCE_ALLREDUCE_MAX_SIZE=1MB -e VLLM_ROCE_ALLGATHER_MAX_SIZE=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 B12X_ROCE_CACHE_DIR=/opt/b12x-roce/cache \
  aidendle94/sparkrun-vllm-dsv41-gb10:production-1.2 /models/repo/snapshots/<snapshot> \
    --served-model-name deepseek-v4.1-flash --host 0.0.0.0 --port 8410 \
    --tensor-parallel-size 4 --decode-context-parallel-size 2 --dcp-comm-backend ag_rs \
    --gpu-memory-utilization 0.80 --kv-cache-memory-bytes 6442450944 \
    --max-model-len 500000 --max-num-seqs 8 --max-num-batched-tokens 8192 --block-size 128 \
    --moe-backend b12x --engram-config '{"cpu_offload":false}' \
    --default-chat-template-kwargs '{"thinking":true,"reasoning_effort":"max"}' \
    --limit-mm-per-prompt '{"image":4}' --mm-processor-cache-gb 1 \
    --tool-call-parser deepseek_v41 --enable-auto-tool-choice --reasoning-parser deepseek_v41 \
    --speculative-config '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"block","enable_adaptive_verification":false}' \
    --compilation-config '{"cudagraph_mode":"FULL_AND_PIECEWISE","cudagraph_capture_sizes":[5,6,10,12,15,18,20,24,25,30,35,36,40,42,48]}' \
    --distributed-executor-backend mp --nnodes 4 --node-rank 0 --master-addr <head-fabric-ip> --master-port 29551
```

The image needs the code that reads NVFP4 rows, and production-1.1 includes it.

1. Share the checkpoint's HuggingFace repository directory, not the snapshot, over NFS from the node that holds it (`ro,no_subtree_check`). Mount it on the other nodes through fstab with `_netdev,nofail`.
2. Pull production-1.2 on every node. Set `B12X_ROCE_GID_INDEX` for each node: with a wrong value, the RoCE exchanges fall back to NCCL without an error. To turn them off, set `ROCE_AR=0` in the launcher.
3. Boot once, and read the `Engram DISK mode: layer L rows [start, end)` lines of each rank. Run `engram_local.py` on each node with those ranges (about 6 minutes). Relaunch with `DSV41_ENGRAM_DIR` set, and every rank should log `read from node-local`.
4. Wait about 11 minutes for the fleet. Check that `GPU KV cache size` reads 1,888,800 tokens on DCP2 with 6 GiB, that `MemAvailable` on the head is at least 5 GB, and that the log shows `Using 'B12X_MXFP4_MXFP8' Mxfp4 MoE backend`.
5. Test the answers: count to 100, find a fact hidden in a 32K-token prompt, describe an image and make a tool call. Then send many unique requests at once.

thinking on, per request:

```bash
curl -s http://<head>:8410/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}}'
# reasoning_content: "We need answer briefly. 91 = 7*13, not prime."   (19 reasoning tokens)
# content:           "No. 91 = 7 × 13, so it is not prime."
```

## Performance

### Headline numbers

|  | DCP2 (production-1.2) | DCP4 (production since 2026-09-11) |
|---|---|---|
| KV pool at a 300K context limit | 1,888,800 tokens | **2,477,126 tokens** |
| decode, one stream (counting / code / prose) | 90.7 / 63.6 / 34.4 tok/s | 90.7 / 63.5 / 31.3 tok/s |
| prefill 32K / 128K | 15.3 s / 61.0 s | 17.2 s / 67.6 s |
| 12-min soak test, 8 streams | 0 errors | 0 errors |

Four-node test fleet, prompts of unique content, decode one stream at a time.

### NCCL against RoCE exchanges

|  | NCCL (same day) | RoCE (production since 2026-09-16) |
|---|---|---|
| decode, one stream (counting / code / prose) | 85.6 / 49.9 / 25.8 tok/s | **94.5 / 74.5 / 35.9 tok/s** |
| draft acceptance (tokens kept per step) | 3.10 | 3.56 |
| KV pool (tokens) | 3,418,145 | 3,418,145 |

One stream at a time, same fleet, same day.

Measured: 2026-09-10 for 1.0, 2026-09-11 for 1.1 and 1.2

The model runs on four nodes (TP4) with DSpark decoding, and decode uses tonyd2wild's fixed prompt set: one stream, temperature 0, thinking off.

| Measurement | Value | Note |
|---|---|---|
| Decode · code / math | 77 / 81 tok/s | One stream |
| Aggregate | 185 tok/s | Six streams, mean of eight prompt categories |
| Prefill | 1,891–2,362 tok/s | Unique text, prompts of 9K–132K tokens, after warm-up |
| KV pool | 1.26M → 1.89M tokens | Release 1.0, then 1.1 with the KV cache split two ways (DCP2) |
| Context | 500K tokens | Since 2026-09-14 |
| Stability | 540 / 0 req / err | 8 workers for 20 min, plus two bursts of 8 requests, every output correct |
| DCP4 (production) | 2.48M tokens KV | The KV cache split four ways: room for 8.3 contexts of 300K tokens |

**Decode for one stream, by prompt category** (tok/s · higher is better)

|  | tok/s · higher is better |
|---|---|
| counting (ceiling) | 94.5 |
| formatted output | 87.9 |
| math | 81.1 |
| coding | 77.5 |
| JSON | 62.8 |
| reasoning | 60.4 |
| prose | 34.5 |
| narrative | 33.2 |
| summary | 31.5 |

**Throughput by number of streams** (tok/s, mean of eight prompt categories · higher is better)

|  | per stream | aggregate |
|---|---|---|
| C1 | 58.6 | 52.8 |
| C2 | 46.6 | 82.8 |
| C3 | 41.1 | 107.4 |
| C4 | 43.1 | 146.5 |
| C5 | 38.7 | 163 |
| C6 | 35.7 | 185.2 |

C is the number of streams started together.

## Notes

#### Operating notes and limits

- **Watch MemAvailable, not the KV number.** A KV size that leaves too little memory gives no error, so keep MemAvailable on the head above 5 GB.
- **Weights over NFS need an fstab entry.** Use fstab with `_netdev,nofail`, because a mount made by hand is gone after a node reset.
- **A 1M-token context is untested.** 500K is tested, and a prefill that long starves any health check that expects an answer within seconds.
- **Copy Engram rows while serving only with a rate limit.** At 150 MB/s under live traffic, free memory did not move.
- **Kill by process ID (PID), never by pattern.** A `pkill -f` whose pattern matches the shell that runs it kills that shell too.
