prestonlogan/Qwen4-35B-Single-DGX-Spark
About
Qwen4-35B-A3B at 103 tok/s on agent turns on one NVIDIA DGX Spark (GB10), 3.15× the minimal 32.8 tok/s recipe. 109 tok/s on code, 92 on prose, 288 tok/s total with 8 requests, plus image input. vLLM, DFlash2 speculative decoding, 262K context, Docker Compose, OpenAI API.
Systems & InfrastructureMeasured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
Quickstart · Speed · Quality · Changelog
Qwen4-35B-A3B on a Single NVIDIA DGX Spark
Serve RadixArk/Qwen4-35B-A3B-NVFP4 (35B total, 3B active MoE, natively multimodal, 262K context) on one NVIDIA DGX Spark (GB10, Grace Blackwell, 128 GB unified memory) with vLLM, exposed as an OpenAI-compatible API.
Verified working: chat with thinking on/off, tool calls with round trip, SSE streaming, and image input. Release history is in the changelog.
Speed
Output tokens per second for the current release (v1.6.0), one request at a time unless noted. v1.0.0 is the minimal recipe that serves the original checkpoint with no speedups.
| Workload | Settings | This recipe | v1.0.0 | Speedup |
|---|---|---|---|---|
| Agent turns | Sampled, thinking on, tool calls | 103.3 | 32.8 | 3.15× |
| Prose | Temperature 0 | 91.6 | 33.5 | 2.73× |
| Code | Temperature 0 | 109.1 | 33.3 | 3.28× |
| Prose about an image | Temperature 0 | 101.8 | 33.2 | 3.07× |
| Prose | Sampled, temperature 1.0 | 84.7 | 32.7 | 2.59× |
| Code | Sampled, temperature 1.0 | 100.3 | 32.6 | 3.08× |
| Prose about an image | Sampled, temperature 1.0 | 98.8 | 32.0 | 3.09× |
| 4 requests at once | Sampled, total of all 4 | 212.5 | 110.9 | 1.92× |
| 8 requests at once | Sampled, total of all 8 | 288.4 | 172.2 | 1.67× |
| 4K-token prompt | Sampled | 140.1 | not measured | |
| 32K-token prompt | Sampled | 115.3 | not measured | |
| 100K-token prompt | Sampled | 101.2 | not measured |
Quality
Quality must never drop below v1.0.0, which serves the original checkpoint unchanged. This recipe matches or beats it on every fixed test.
How these were measured
Frozen, hash-checked bench in bench/ (FREEZE.sha256), same Spark,
2026-12-04, after a cold restart. Prose, code and image: bench_quick.py,
first turn, median of runs. Agent turns: bench_realistic.py, multi-turn with
tool calls (8 of 8 valid). Concurrency and long prompts: bench_matrix.py,
reporting the API's actual prompt length; every long-context needle was
found. Quality: graded gate v2 (gate_quality.py), 10 sampled runs for the
chain and list tests, compared against a fresh v1.0.0 run; 0 thinking loops in
38 runs for both. Chart sources: media/*.html.
Quickstart
cp .env.example .env # optional; defaults work without edits
./start.sh # fetch the drafter if needed, then start Compose
./tools/check.py # verify every capability, exits nonzero on failure
The server listens on http://127.0.0.1:8000/v1 (change PORT in .env).
The recipe serves the stock RadixArk snapshot directly; all weight
quantization happens online at load time, so no derived checkpoint is written
to disk. The first start downloads the pinned DFlash2 drafter
(RadixArk/Qwen4-35B-A3B-Dflash2, about 0.8 GB) into HF_CACHE unless it is
already cached. Set HF_HUB_OFFLINE=1 to run offline from a complete cached
snapshot.
Settings
All knobs live in .env.
Speculative decoding (SPECULATIVE_CONFIG). Empty by default, which uses
the pinned DFlash2 drafter proposing 3 tokens per round:
{"method":"dflash","model":"<DFLASH_MODEL>","num_speculative_tokens":3,"draft_sample_method":"probabilistic","rejection_sample_method":"block","draft_lm_head_quantization":"fp8","quantization_config":{"targets":{"re:.*\\.mlp\\.(gate_up_proj|down_proj)$":"nvfp4_weight_only","re:.*\\.fc$":"nvfp4_weight_only"}}}
To use the model's built-in MTP head instead (no drafter download):
{"method":"mtp","num_speculative_tokens":1,"index_share_for_mtp_iteration":true,"draft_lm_head_quantization":"fp8"}
Set SPECULATIVE_CONFIG=off to disable speculation, or pass your own JSON.
Online weight quantization (TARGET_QUANTIZATION_CONFIG). Empty by
default, which applies Marlin NVFP4 weight-only to the 60 GDN and 80 shared
expert projections and FP8 per-channel to the 20 attention projections (the
indexer stays BF16):
{"targets":{"re:.*\\.linear_attn\\.(in_proj_qkvz|out_proj)$":"nvfp4_weight_only","re:.*\\.mlp\\.shared_expert\\.(gate_up_proj|down_proj)$":"nvfp4_weight_only","re:.*\\.self_attn\\.(qkv_proj|o_proj)$":"fp8_per_channel"}}
Set it to off to load the checkpoint weights unchanged. GDN_FP8=1 builds
and serves the older offline block-FP8 GDN checkpoint (v1.5.0 and earlier)
instead.
MoE backend (MOE_BACKEND). marlin by default (W4A16 experts). Set
auto to let vLLM choose.
Prefix caching (ENABLE_PREFIX_CACHING). On by default; set 0 to turn
it off.
Setting SPECULATIVE_CONFIG=off, TARGET_QUANTIZATION_CONFIG=off,
MOE_BACKEND=auto and ENABLE_PREFIX_CACHING=0 gives the v1.0.0 settings.
The default KV cache holds 1,893,582 tokens, about 7.2 full 262K contexts.
Exact versions and pins
| Component | Pin |
|---|---|
| Image | vllm/vllm-openai:qwen4-arm64-cu132 |
| Image digest | sha256:d835af2c76ac370346ada7d8e8e61152fbf0a401b03f7732be3039fb49951d67 |
| Model | RadixArk/Qwen4-35B-A3B-NVFP4 @ 7d83fac3c8f038eebf69d6373e332853fb5001a7 |
| Drafter | RadixArk/Qwen4-35B-A3B-Dflash2 @ cb9d9b21871526620506c9a6fb4d3f5ffff1bdc7 |
| vLLM | 0.1.dev26393+gf247de72b |
| PyTorch | 2.14.0+cu132 |
| CUDA | 13.2 |
| FlashInfer | 0.7.6 |
| Triton | 3.8.0 |
| Transformers | 5.24.1 |
| fastsafetensors | 0.5.0 |
| GPU | NVIDIA GB10, compute capability 12.1 (SM121) |
| Host driver / kernel | NVIDIA 580.178.04 / Linux 7.0.0-1025-nvidia (aarch64) |
vllm/vllm-openai:qwen4 on arm64 resolves to the same digest; this recipe pins
the explicit -arm64-cu132 tag plus digest anyway.
API examples
Chat, thinking on (default)
curl http://127.0.0.1:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Qwen4-35B-A3B",
"messages": [{"role": "user", "content": "What is 17*23?"}],
"max_tokens": 256
}'
Reasoning returns in reasoning_content; the answer returns in content.
Thinking off
Either of these works:
{"chat_template_kwargs": {"enable_thinking": false}}
{"reasoning_effort": "none"}
Tool calling
{
"model": "Qwen4-35B-A3B",
"messages": [{"role": "user", "content": "Schedule a dentist appointment on 2026-12-10 at 3pm."}],
"tools": [{"type": "function", "function": {
"name": "create_event",
"description": "Create a calendar event",
"parameters": {"type": "object",
"properties": {"title": {"type": "string"}, "date": {"type": "string"}, "time": {"type": "string"}},
"required": ["title", "date"]}}}],
"tool_choice": "auto"
}
--enable-auto-tool-choice --tool-call-parser qwen4 is enabled by default.
Image input
{
"model": "Qwen4-35B-A3B",
"messages": [{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/png;base64,<BASE64>"}},
{"type": "text", "text": "Describe this image."}
]}]
}
Pass images as inline base64 data: URLs for offline and local use.
GB10 unified memory safety
The GB10 has 128 GB of memory shared between CPU and GPU. Loading a 44 GB
checkpoint fills the page cache and can drive MemFree low enough to hard
freeze the host even while MemAvailable still looks fine. This recipe
therefore:
- refuses
GPU_MEMORY_UTILIZATION > 0.68instart.sh(setALLOW_HIGH_UTIL=1to override at your own risk; the default is 0.60) - drops the Linux page cache before boot via
docker run --rm --privileged busybox:1(no sudo needed;docker pull busybox:1once enables it) - defaults
ENGRAM_DISK_OFFLOAD=trueso the PLE (engram) embedding table lives on host RAM and may spill to disk rather than GPU memory - uses a BF16 main KV cache:
nvfp4KV needs CAKE QSA kernels that are not built for sm_121a in this image, soKV_CACHE_DTYPE=auto(BF16) plus a bf16 sparse-indexer cache is the supported combination
Layout
compose.yaml,.env,.env.example: the recipe and every knobstart.sh: guarded one-command starttools/serve.sh: maps env vars tovllm serveflagstools/prepare-gdn-fp8.sh,tools/quantize_trunk_fp8.py: build the optional offline GDN FP8 checkpoint (GDN_FP8=1)tools/health.sh: container healthchecktools/check.py: stdlib-only functional verificationbench/: frozen, hash-checked benchmark and quality gatesmedia/: header image and speed and quality charts (chart HTML sources, PNG/JPEG outputs)CHANGELOG.md: release notes with measured numbers
Follow along
Star or watch this repo for updates. My earlier recipe for the same hardware: Qwen3.8-Flash-Next on a Single DGX Spark.
Keywords: Qwen4, Qwen4-35B, Qwen4-35B-A3B, Qwen 4, DGX Spark, NVIDIA DGX Spark, single DGX Spark, GB10, Grace Blackwell, local LLM, MoE, multimodal, NVFP4, Docker, OpenAI-compatible API, inference recipe.
Explore related projects
Loading…