# DeepSeek-V4-Flash on 4× DGX Spark

Status: production. Measured: 2026-08-20. Web page: https://aidenle.com/recipes/deepseek-v4-flash-4x-dgx-spark-3761/
Image: `aidendle94/sparkrun-vllm-ds4-gb10:production-3.76.1`

This recipe serves DeepSeek-V4-Flash-0731 with vLLM on four DGX Spark GB10 nodes. With one request at a time it writes about 71 tokens per second, and each request can hold 393K tokens. Reasoning is on by default.

**Time:** About 45 min per node, plus 15 to 20 min for the first boot

**Result:** A 4-node fleet: about 71 tok/s decode for one request, 393K tokens of context, reasoning on

## What you need

- 4× DGX Spark GB10 nodes, linked by a 200G RoCE or InfiniBand network
- The image aidendle94/sparkrun-vllm-ds4-gb10:production-3.76.1 (Docker Hub)
- A Hugging Face token with access to the DeepSeek-V4-Flash-0731 weights
- About 120 GB of free disk space on every node
- Root access on every node

## Overview

This recipe serves DeepSeek-V4-Flash-0731 on four DGX Spark GB10 nodes with vLLM. The model is split across the four nodes (tensor parallel, TP4), and a small draft head proposes 5 tokens at a time (speculative decoding, DSpark). Reasoning is on by default.

## Build

### The container on each node

Look up `NCCL_IB_GID_INDEX` on each node at every boot. It is the index of the RoCE v2 entry for your fabric IP address under `/sys/class/infiniband/<dev>/ports/1/gids/`.

docker run · per node:

```bash
#   NCCL_IB_HCA: your RDMA device, e.g. rocep1s0f0
#   NCCL_SOCKET_IFNAME: your fabric interface, e.g. enp1s0f0np0
docker run -d --name ds4f \
  --network host --ipc host --shm-size 10gb --gpus all \
  --cap-add IPC_LOCK --ulimit memlock=-1:-1 \
  --device /dev/infiniband:/dev/infiniband \
  -v $HOME/.cache/huggingface:/cache/huggingface \
  -e HF_HOME=/cache/huggingface \
  -e NCCL_IB_HCA=<your-rdma-device> \
  -e NCCL_SOCKET_IFNAME=<your-fabric-iface> \
  -e GLOO_SOCKET_IFNAME=<your-fabric-iface> \
  -e NCCL_IB_GID_INDEX=<resolved-at-boot> \
  -e NCCL_MAX_NCHANNELS=4 -e NCCL_MIN_NCHANNELS=4 \
  -e VLLM_HOST_IP=<this-node-fabric-ip> \
  -e VLLM_DSPARK_FP8_LM_HEAD=0 \
  -e VLLM_DSPARK_MARKOV_W2_FP8=0 \
  -e VLLM_DSPARK_REPLICATE_MARKOV_W1=0 \
  -e VLLM_DSV4_INDEXER_SP=1 \
  -e VLLM_ALLOW_LONG_MAX_MODEL_LEN=1 \
  -e VLLM_ENGINE_READY_TIMEOUT_S=3600 \
  aidendle94/sparkrun-vllm-ds4-gb10:production-3.76.1 \
  <the vllm serve command below>
```

### The serve command

1. Start the worker ranks (1 to N-1) first, wait about 10 seconds, then start rank 0.
2. If another stack ran on the nodes before, empty the page cache on every node first: `sync && echo 3 > /proc/sys/vm/drop_caches`. Otherwise a rank can hang silently while loading.
3. The first boot compiles kernels and takes longer. Later boots take about 7 minutes.

vllm serve · rank 0:

```bash
vllm serve deepseek-ai/DeepSeek-V4-Flash-0731 \
  --served-model-name <your-alias> --host 0.0.0.0 --port 8210 \
  --trust-remote-code \
  --tensor-parallel-size 4 \
  --nnodes 4 --node-rank $RANK --master-addr $HEAD_IP --master-port 29512 \
  --distributed-executor-backend mp \
  --distributed-timeout-seconds 3600 --cpu-distributed-timeout-seconds 3600 \
  --attention-backend FLASHINFER_MLA_SPARSE_DSV4 --enable-flashinfer-autotune \
  --kv-cache-dtype fp8 --block-size 256 --load-format auto \
  --max-model-len 393216 --max-num-batched-tokens 4096 --max-num-seqs 128 \
  --max-cudagraph-capture-size 128 \
  --compilation-config '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}' \
  --no-scheduler-reserve-full-isl --enable-chunked-prefill \
  --long-prefill-token-threshold 3072 --enable-prefix-caching \
  --gpu-memory-utilization 0.8 \
  --tool-call-parser deepseek_v4 --enable-auto-tool-choice \
  --reasoning-parser deepseek_v4 \
  --reasoning-config '{"reasoning_parser":"deepseek_v4","reasoning_start_str":" thinking","reasoning_end_str":" response"}' \
  --default-chat-template-kwargs.thinking=true \
  --default-chat-template-kwargs.reasoning_effort=max \
  --speculative-config '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic"}'
```

## Performance

> **Use the mean of 8 repetitions for decode speed.**
>
> Greedy decoding (temperature 0) is not deterministic on this hardware.

Measured: 2026-08-20

The model runs on four nodes (TP4) with DSpark decoding and prefix caching on.

| Measurement | Value | Note |
|---|---|---|
| Decode | ~71 tok/s | One stream, mixed prompts, mean of 8 repetitions |
| Aggregate | ~250 tok/s | 16 streams at the same time |
| Prefill | ~2,200 tok/s | Cold, with a 334K-token prompt |
| Warm prefill | 5–8K tok/s | A repeated context, served from the prefix cache |
| Context | 393K tokens | Checked with a 380K-token prompt |
| Draft acceptance | 0.55 | DSpark with 5 speculative tokens |

## Notes

### Known problems

#### Operational caveats

- **Read the reasoning text from `message.reasoning`, not only `reasoning_content`.**
- **With prefix caching on, use new text in every benchmark run.**
- **Keep both strings of `--reasoning-config` as the command sets them.** Empty strings break the setup of the reasoning tokens on this fork of vLLM.
