Deepseek 4 0731 Single Spark - 40t/s decode - 131k ctx - Dwarfstar CUDA custom engine

Recipe for running the new Deepseek v4 0731 variant on a single spark at 131k context, 2 lanes, Dspark speculative decode on the Dwarfstar custom cuda engine by bleysg (twitter) aka @entrpi here:

Sparkrun custom recipe yaml :

recipe_version: "2"
name: deepseek-v4-flash-0731-ds4
description: "DeepSeek-V4-Flash (0731 weights) on the ds4 CUDA engine v0.5.4 β€” IQ2XXS quant, DSpark MTP k=2, 131K context, native (no Docker)"
model: ~/gguf/DeepSeek-V4-Flash-IQ2XXS-w2Q2K-AProjQ8-SExpQ8-OutQ8-chat-v2-imatrix-0731.gguf
runtime: ds4-cuda
container: native
executor: local
maintainer: styles01

metadata:
author: styles01
created: "2026-08-02"
updated: "2026-08-04"
tags:
- deepseek
- v4-flash
- 0731
- ds4
- cuda
- iq2xxs
- dspark
- mtp
- native
- gguf
category: agent
model_params: 280B
model_dtype: iq2xxs
quantization: iq2xxs
kv_dtype: q2k
runbook: runbooks/deepseek-v4-flash-ds4.md

solo_only: true
cluster_only: false

min_nodes: 1
max_nodes: 1

defaults:
context: 131072
port: 8000
host: 0.0.0.0

env:
DS4_BATCH_FIT_HEADROOM_MB: "8192"
DS4_SERVER_COALESCE_MAX: "32"
DS4_CONT_DSPARK: "1"
DS4_CONT_MTP_MODE: "2"
DS4_DSPARK_MODEL: "~/gguf/DSpark-drafter-Q2K-Q8-0731.gguf"
DS4_METAL_GRAPH_RAW_CAP: "131072"

benchmark:
framework: llama-benchy
pp: [2048, 4096]
depth: [0, 4096]
concurrency: [1, 2]

post_exec:

curl -s localhost:8000/v1/models | head -20

post_commands:

echo "DS4 engine ready at {head_host}:{port} β€” OpenAI API at /v1/chat/completions, metrics at /metrics"

You should easily be able to fit 1M context with this model on this runtime. On my machine, it takes up only about 107GB of memory.

Share your recipe? I’m trying to get max context for at least 2 lanes..

There are some long context settings that help. I don’t remember which ones were most impactful.

This is roughly the command I am using:

DS4_CUDA_NO_HBM_CACHE=1
DS4_BATCH_FIT_HEADROOM_MB=6272
DS4_BATCH_VMM_BUDGET_MB=6144
DS4_SERVER_COALESCE_MAX=8
DS4_CONT_PREFILL_CHUNK=2048
DS4_CONT_CAPTURE=1
DS4_SERVER_DEFAULT_TEMP=0
./ds4-server --cuda \
  -m ~/models/DeepSeek-V4-Flash-IQ2XXS-w2Q2K-AProjQ8-SExpQ8-OutQ8-chat-v2-imatrix-0731.gguf \
  --dspark ~/models/DSpark-drafter-Q2K-Q8-0731.gguf \
  -c 1048576 \
  --kv-disk-dir ~/.cache/ds4-kv \
  --kv-disk-space-mb 32768 \
  --host 0.0.0.0 --port 8000