# Speculative Decoding [README](../README.md) Speculation proposes future tokens with a smaller draft block, then checks them with the main model. An accepted prefix advances generation by several tokens in one verification pass. It does not accelerate prefill. It is opt-in. Gains depend on the prompt, model, backend, and context length; poor acceptance can make it slower. Measure your workload rather than assuming that a draft model always helps. ## DeepSeek Flash: DSpark DSpark is a separate support GGUF, not a standalone language model. It proposes up to five future tokens. Match its checkpoint to the main model: | Main checkpoint | Download | Support file | | --- | --- | --- | | Flash 0731 | `ds4f-dspark` | `gguf/DeepSeek-V4-Flash-DSpark-support-0731.gguf` | | Flash Vision Experimental | `ds4f-vision-dspark` | `gguf/DeepSeek-V4-Flash-Vision-Exp-DSpark-support.gguf` | For the 0731 Q2 model: ```sh ./download_model.sh ds4f-q2 ./download_model.sh ds4f-dspark ./ds4 --dspark --mtp-model gguf/DeepSeek-V4-Flash-DSpark-support-0731.gguf ``` For Vision Experimental, substitute its matching main model and support file. Do not mix the two checkpoints. DSpark is not supported for PRO. The same flags work in `ds4-agent` and non-batched `ds4-server` requests. The support file adds about 5.6 GiB of weights plus runtime state. On Metal, the main model can be resident or SSD-streamed. DSpark replaces the legacy one-stage MTP drafter for that run; the two are not stacked. Resident M5 paths batch supported verifier expert rows, including two-Mac TP. On DGX Spark, resident Q2 also batches the seed with longer drafts and uses small-batch Q8 and expert kernels. No extra flags are needed. The scheduler can back off when drafting is unproductive. Defaults select the fast paths; diagnostic environment variables are not needed for normal use. Recorded comparisons are in [the QA guide](../QA_BEFORE_RELEASES.md). For the tested Strix Halo coding configuration, use `--dspark --dspark-confidence 0.7` with the default five-token draft cap and scheduler. Client sampling is temperature `1.0`, `top_p=0.95`, `min_p=0`, and `top_k=0`; high reasoning was also checked on coding and tool-use requests. This uses opportunistic sampling as described below; exact-mode throughput is not qualified by these measurements. `--mtp-draft` controls legacy autoregressive MTP, not the DSpark draft width. ## GLM: built-in MTP GLM's draft block is already in its main GGUF: ```sh ./ds4 -m gguf/GLM-5.3-Flash-Q2.gguf --mtp ``` `--mtp-timing` also enables it and prints acceptance and timing counters. The current GLM cycle commits up to two tokens. No external support file is needed, and ordinary decode remains the default. ## Sampling and reproducibility At temperature zero, accepted drafts must match the target's greedy continuation. At non-zero temperature, the default mode is opportunistic: ordinary tokens use the requested sampling settings, but matching greedy drafts are accepted directly. Sampling resumes when the proposed suffix does not match. This is deliberately more deterministic than ordinary sampling. Use `--mtp-exact-sampling` to preserve the ordinary target sampling distribution. Exact mode accepts greedy proposals with their target probability and samples from the remaining distribution on rejection. Accepted tokens keep the state produced by the batched verifier. Floating-point reduction order can differ from one-token decode, so long greedy continuations need not be byte-identical. For DeepSeek comparisons against the ordinary target-only path, use `--quality` or `--dspark-strict`; these disable the speculative acceptance path. They do not promise identical output across different hardware or execution configurations. Session-batched serving uses ordinary target decoding instead of combining DSpark/MTP with the session batch. See [serving](SERVER.md#multiple-sessions).