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:
# DeepSeek-V4-Flash 0731 on DS4 CUDA Engine
**Status:** β
Production β DSpark k=2, native execution
**Served name:** `deepseek-v4-flash`
**Engine:** ds4 CUDA (Entrpi/ds4 fork v0.5.4) β native C/CUDA binary
**Author:** [@bleysg](https://x.com/bleysg) (Bleys Goodson) / [@antirez](https://x.com/antirez) (Salvatore Sanfilippo)
**Updated:** August 2, 2026
> **Recipe contract:** [`recipes/deepseek-v4-flash-0731-ds4.yaml`](../recipes/deepseek-v4-flash-0731-ds4.yaml)
---
## β Featured Recipe
The smartest model available, now serving on a single DGX Spark via [Bleysg's ds4 CUDA engine](https://github.com/Entrpi/ds4-on-spark) β a ground-up C/CUDA inference engine with DSpark lossless speculative decoding.
| Metric | Value |
|---|---|
| **Model** | DeepSeek-V4-Flash 0731 (284B params, 12B active MoE) |
| **Engine** | ds4 CUDA (Entrpi/ds4 fork v0.5.4) |
This file has been truncated. show original
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