DGX Spark long context: how decode speed and prefill time change from 4k to 128k tokens
On a DGX Spark, long context costs some models almost nothing and others most of their speed. SparkBench reports Qwen3-Coder-Next decoding at 58.9 tok/s after a 4k fill and 55.0 tok/s after 100k, while Qwen3.8-27B with speculative decoding drops from 38.1 to 10.7 tok/s (vLLM and SGLang runs, July to October 2026). Prefill also slows with depth: llama.cpp processes gpt-oss-120b prompts at 2,444 tok/s on an empty context and 1,567 tok/s at 32k, so by my calculation a 100k-token prompt takes about 76 seconds before the first token. At 128k, the BF16 KV cache ranges from 1 GiB (Nemotron-3-Super-120B) to 40 GiB (Llama 3.3 70B).
| Model (attention layout) | Quant, engine | 4k | 50k | 100k | Source | Date |
|---|---|---|---|---|---|---|
| Qwen3-Coder-Next, 80B-A3B (12 of 48 layers full attention) | NVFP4, vLLM, FP8 KV | 58.9 | 56.3 | 55.0 | SparkBench | 2026-07-10 |
| Gemma 4 26B-A4B (5 of 30 layers global, rest 1,024-token window) | vLLM, FP8 KV | 23.0 | 22.0 | 21.4 | SparkBench | 2026-07-10 |
| Qwen3.6-35B-A3B (10 of 40 full attention) | NVFP4 + MTP n3, vLLM (eugr 1ea84d74b), FP8 KV | 86.3 | 78.8 | 31.5 | SparkBench | 2026-08-04 |
| Qwen3.8-Flash-Next FP4-Local | FP4 + MTP, TensorFold, FP8 KV | 45.4 | 22.6 | 13.8 | SparkBench | 2026-10-19 |
| Qwen3.8-27B dense (16 of 64 full attention) | NVFP4 + DFlash2 n8, SGLang, FP8 KV | 38.1 | 19.1 | 10.7 | SparkBench | 2026-09-10 |
| DeepSeek V4 Flash 0731 | EXL3 + DSpark draft, SparkInfer | 23.4 | 26.0 | 8.4 | SparkBench | 2026-08-23 |
Single-stream decode in tok/s after a fixed context fill, one GB10 node, read 7 November 2026. Layer counts are from each model's config.json (linked in the KV section). SparkBench does not explain why the DeepSeek row is faster at 50k than at 4k, and does not list engine versions for most rows. SparkBench lists no speculative draft for the Gemma row; other Gemma 4 reports on this site, with MTP, are higher.
How much does decode slow down at long context?
Between 7% and 72% from 4k to 100k in the SparkBench rows above. The pattern I see, which is my reading and not SparkBench's: the two rows without a speculative draft barely move, and every row with MTP, DFlash or DSpark loses half or more of its speed by 100k.
The mechanism behind the plain rows is bandwidth. Each new token reads the active weights once and then the entire KV cache, so the cache adds bytes to every step. llama.cpp's own DGX Spark llama-bench results (build 7941, February 2026) show it with full-attention and sliding-window models:
| Model (llama.cpp, build 7941) | tg32 at 0 | at 8k | at 16k | at 32k | Drop at 32k |
|---|---|---|---|---|---|
| gpt-oss-120b, MXFP4 | 58.72 | 52.87 | 49.45 | 42.76 | 27% |
| gpt-oss-20b, MXFP4 | 83.43 | 75.22 | 70.36 | 61.65 | 26% |
| Qwen3-Coder-30B-A3B, Q8_0 | 61.06 | 48.02 | 40.23 | 30.21 | 51% |
| GLM-4.7-Flash, Q8_0 | 48.68 | 42.59 | 38.72 | 32.65 | 33% |
Token generation in tok/s at each context depth, from the llama.cpp repository's DGX Spark page (system info dated 5 February 2026). Drop percentages are my arithmetic.
A worked check. gpt-oss-120b reads about 3 GB of weights per token (about 5B active parameters at MXFP4, per the decode arithmetic on the benchmarks page). Its KV cache costs 36 KiB per token (18 full-attention layers x 8 KV heads x 64 dims x 2 for K and V x 2 bytes), so at 32,768 tokens it is 1.2 GB. Reads per token rise from 3 GB to 4.2 GB, predicting 58.72 x 3 / 4.2 = 41.9 tok/s. llama.cpp measured 42.76. Qwen3-Coder-30B-A3B keeps 96 KiB per token in all 48 layers, so its F16 cache at 32k is 3.2 GB, about the same as its roughly 3 to 3.5 GB of Q8_0 active weights. The prediction is a near halving, 29 to 32 tok/s; measured, 30.21.
Speculative rows break this arithmetic because they verify several drafted tokens per weight read. My guess, untested, is that both the draft acceptance rate and the attention cost per verified token get worse deep in a long context, which removes most of the gain. If you run long contexts, benchmark with speculation on and off at your real fill.
How long does prefill take for a 100k-token prompt?
About 45 seconds to 4 minutes on one Spark for the models llama.cpp benchmarked, by my calculation below. Long prompts hurt more than long answers here, because prefill rate falls as the context grows.
llama.cpp's results give prefill (pp2048) at five depths. Per-token time rises almost linearly with depth, since each new token attends to all the tokens before it. Fitting t(d) = a + b x d through the 0 and 32k points (it predicts the 16k point within 3%) and summing over the prompt gives total time T(N) = a x N + b x N² / 2.
| Model | pp2048 at 0 | at 32k | 100k prompt (calc) | 131,072 prompt (calc) |
|---|---|---|---|---|
| gpt-oss-20b, MXFP4 | 4,506 | 2,689 | 45 s | 68 s |
| gpt-oss-120b, MXFP4 | 2,444 | 1,567 | 76 s | 114 s |
| Qwen3-Coder-30B-A3B, Q8_0 | 2,987 | 1,348 | 96 s | 151 s |
| GLM-4.7-Flash, Q8_0 | 2,364 | 567 | 247 s | 407 s |
Measured columns in tok/s from llama.cpp's DGX Spark page, build 7941. Calculated columns are my extrapolation beyond the measured 32k, single request, no prefix cache. For gpt-oss-120b, a = 1/2,444 s and b = 7.0 x 10^-9 s per token per token.
The extrapolation holds up against a longer measured run. On the same model family in vLLM 0.27.1, the GPUwerk benchmarks page records Qwen3-Coder-30B-A3B (AWQ) filling its full 262,144-token context in 447 seconds, an average of 586 tok/s. The llama.cpp fit predicts 514 seconds for that length at Q8_0. Same order, and vLLM a little faster.
Two multi-node reports for scale. DeepSeek-V4-Flash on two Sparks with vLLM 0.21.1 and FP8 KV took 2.4 minutes to the first token at a 240K fill and 16.6 minutes at 980K, while decode held 39.4 and 30.4 tok/s (NVIDIA forum, 4 June 2026; more on that model in the DeepSeek-V4-Flash notes). On an eight-Spark DeepSeek V4.1 Flash cluster, jameslacroix reports that with 100K coding contexts, going from 4 to 8 concurrent requests raised median time to first token from 64 to 114 seconds: long prefills block other users even when slots are free.
How much KV cache memory does each model need at 128k?
From 1 GiB to 40 GiB at BF16 for one 131,072-token sequence, depending on how many layers keep a full-length cache. The formula is bytes per token = 2 (K and V) x full-attention layers x KV heads x head dimension x bytes per value. Hybrid models keep a cache only on their attention layers; their linear-attention layers hold a fixed-size state instead.
| Model | Cached layers x KV heads x head dim | Per token, BF16 | 128k, BF16 | 128k, FP8 | config.json |
|---|---|---|---|---|---|
| Llama 3.3 70B | 80 x 8 x 128 | 320 KiB | 40.0 GiB | 20.0 GiB | link |
| Qwen3-Coder-30B-A3B | 48 x 4 x 128 | 96 KiB | 12.0 GiB | 6.0 GiB | link |
| Qwen3.8-27B | 16 of 64 x 4 x 256 | 64 KiB | 8.0 GiB | 4.0 GiB | link |
| gpt-oss-120b | 18 of 36 x 8 x 64 (others: 128-token window) | 36 KiB | 4.5 GiB | 2.25 GiB | link |
| Qwen3-Coder-Next | 12 of 48 x 2 x 256 | 24 KiB | 3.0 GiB | 1.5 GiB | link |
| Qwen3.6-35B-A3B | 10 of 40 x 2 x 256 | 20 KiB | 2.5 GiB | 1.25 GiB | link |
| Gemma 4 26B-A4B | 5 of 30 x 2 x 512 (others: 1,024-token window) | 20 KiB | 2.5 GiB + 200 MiB window | 1.25 GiB + window | link |
| Nemotron-3-Super-120B-A12B | 8 of 88 x 2 x 128 (rest Mamba-2 and MoE) | 8 KiB | 1.0 GiB | 0.5 GiB | link |
My calculation from the config.json values, per sequence; 128k = 131,072 tokens. Gemma 4's config sets attention_k_eq_v, which may let an engine store one tensor instead of two on global layers; I counted both, so treat its row as an upper bound. The sliding-window caches are fixed in size: about 4.5 MiB for gpt-oss-120b and 200 MiB for Gemma at BF16. Qwen3.6-35B-A3B's 30 linear-attention layers hold about 31 MB of BF16 state per sequence regardless of length (30 x 32 value heads x 128 x 128 x 2 bytes, my estimate). gpt-oss-120b's native maximum is 131,072 tokens.
Against 128 GB of unified memory, none of these is a capacity problem for one user; Llama 3.3 70B at 40 GiB plus about 40 GB of 4-bit weights is the only one that takes a large share. The cache matters for concurrency (multiply by users) and, as shown above, for decode speed. The memory calculator does the same sum for other models and context lengths, and the KV cache size guide covers MLA models and the quality effect of 8-bit and 4-bit caches.
Which settings help with long context?
An FP8 KV cache, chunked prefill, prefix caching and a context limit sized to the job. None changes the attention arithmetic; each removes waste around it.
- FP8 KV cache. It halves both the cache's memory and the bytes each decode step reads. In vLLM it is
--kv-cache-dtype fp8; the vLLM quantized KV cache page notes that without calibration all scales are 1.0, recommends calibrating with llm-compressor, and offers--kv-cache-dtype-skip-layersto keep sensitive layers such as sliding-window attention at native precision. Five of the six SparkBench rows above use it; the DeepSeek row lists its KV type as auto. llama.cpp takes-ctk q8_0 -ctv q8_0; the server README lists f16 as the default for both. - Chunked prefill. vLLM's tuning guide says it is on by default in V1.
--max-num-batched-tokenssets the trade: above 8,192 for throughput and time to first token, about 2,048 for smoother inter-token latency when other users are decoding. - Prefix caching. If many questions hit the same long document, the second one skips the prefill. Prompt layout and the vLLM and llama.cpp switches are in the prompt caching guide.
- A realistic context limit. Set
--max-model-len(vLLM) or-c(llama.cpp) to what you will send. In llama.cpp,-npsets the number of slots sharing that context, and--swa-full(off by default) would allocate a full-length cache for sliding-window layers, which you rarely want.
# vLLM: one long-context user, FP8 KV, prefix cache on
vllm serve /workspace/models/qwen3-coder-next-nvfp4 \
--max-model-len 131072 \
--kv-cache-dtype fp8 \
--enable-prefix-caching \
--max-num-batched-tokens 8192 \
--gpu-memory-utilization 0.85
# llama.cpp: one slot with the full 128k, 8-bit KV
llama-server -m model.gguf -c 131072 -np 1 -fa on -ctk q8_0 -ctv q8_0
Container and build steps are in the vLLM guide and the llama.cpp guide.
Which model should you pick for long documents?
A hybrid-attention mixture-of-experts model, without speculative decoding if the context is very long. On one Spark I would start with Qwen3-Coder-Next for code and long technical documents (55 tok/s at 100k in SparkBench, 3 GiB of BF16 cache at 128k) and with Nemotron-3-Super-120B for contract review and extraction, where its 1 GiB cache leaves room for several long sequences at once. I would avoid dense full-attention models for this job: Llama 3.3 70B needs 40 GiB of cache at 128k and, being dense, decodes slowly before the cache adds anything.
Budget the wait honestly. Even a favorable model spends one to two minutes on a fresh 100k prompt on one Spark, so long-context work suits batch review and repeated questions over a cached document better than interactive chat with new documents each time. If one Spark's 128 GB is too small for the model itself, the guide to large MoE models on several Sparks covers the memory math.
FAQ
How fast is a DGX Spark at 100k context?
It depends on the model's attention design. SparkBench reports Qwen3-Coder-Next (NVFP4, vLLM) at 55.0 tok/s decode after a 100k fill, down from 58.9 at 4k, and Gemma 4 26B-A4B at 21.4 against 23.0. Qwen3.8-27B with speculative decoding falls from 38.1 to 10.7 tok/s, and Qwen3.6-35B-A3B from 86.3 to 31.5 (runs from July to October 2026).
How long does a DGX Spark take to process a 100k-token prompt?
Roughly 45 seconds to 4 minutes on one Spark, by my calculation from llama.cpp's published depth benchmarks: about 45 s for gpt-oss-20b, 76 s for gpt-oss-120b, 96 s for Qwen3-Coder-30B-A3B at Q8_0 and 247 s for GLM-4.7-Flash. Prefill slows as the context grows because attention work per token rises with every token already in the cache.
How much memory does a 128k context need on a DGX Spark?
At BF16, the KV cache for one 131,072-token sequence ranges from 1 GiB for Nemotron-3-Super-120B (8 attention layers) to 40 GiB for Llama 3.3 70B (80 layers with 8 KV heads), by calculation from each model's config.json. FP8 KV halves those numbers. Hybrid models such as Qwen3.6-35B-A3B need about 2.5 GiB because only 10 of their 40 layers keep a KV cache.
Does FP8 KV cache help long-context speed on a Spark?
Yes, for decode. Each generated token reads the whole KV cache, so halving its bytes cuts the per-token read. For Qwen3-Coder-30B-A3B at 32k, the BF16 cache is about 3.2 GB against about 3.5 GB of Q8_0 weights, and llama.cpp's benchmark shows decode falling from 61.1 to 30.2 tok/s between empty and 32k context. vLLM enables it with --kv-cache-dtype fp8.
Which model is best for long documents on one DGX Spark?
A hybrid-attention mixture-of-experts model. Qwen3-Coder-Next loses only 7% of its decode speed between 4k and 100k context on SparkBench, and Nemotron-3-Super-120B keeps a KV cache of about 1 GiB at 128k because only 8 of its 88 layers use attention. Dense full-attention models such as Llama 3.3 70B need 40 GiB of BF16 cache at 128k and decode slowly from the start.
Sources
Every figure above is attributed to its source in the sentence or table where it appears. Pages were read on 7 November 2026 unless a date says otherwise.
- SparkBench leaderboard, SparkBench, 2026-10-18
- Qwen3-Coder-Next on SparkBench, SparkBench, 2026-07-10
- Qwen3.6-35B-A3B on SparkBench, SparkBench, 2026-08-04
- Qwen3.8-27B on SparkBench, SparkBench, 2026-09-10
- Gemma-4-26B-A4B-IT on SparkBench, SparkBench, 2026-07-10
- Qwen3.8-Flash-Next FP4-Local on SparkBench, SparkBench, 2026-10-19
- DeepSeek V4 Flash 0731 (SparkInfer) on SparkBench, SparkBench, 2026-08-23
- DGX Spark benchmark results (llama-bench), ggml-org/llama.cpp on GitHub, 2026-02-05
- DeepSeek V4 Flash with 1M context on 2x DGX Spark, NVIDIA Developer Forums, 2026-06-04
- Quantized KV Cache, vLLM documentation, 2026-11-02
- Optimization and Tuning, vLLM documentation
- llama.cpp server README, ggml-org/llama.cpp on GitHub
- Qwen/Qwen3.6-35B-A3B config.json, Hugging Face
- Qwen/Qwen3.8-27B config.json, Hugging Face
- Qwen/Qwen3-Coder-Next config.json, Hugging Face
- Qwen/Qwen3-Coder-30B-A3B-Instruct config.json, Hugging Face
- openai/gpt-oss-120b config.json, Hugging Face
- unsloth/Llama-3.3-70B-Instruct config.json, Hugging Face
- nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4 config.json, Hugging Face
- google/gemma-4-26B-A4B config.json, Hugging Face
- DeepSeek V4.1 Flash on 8x DGX Spark: TP8/EP8 concurrency results, NVIDIA Developer Forums, 2026-10-31