When speculative decoding helps (and when it does not)
Single-sequence LLM generation on a GPU is memory-bandwidth bound: reading 18.9 GB of weights for Qwen3 32B at Q4_K_M takes nearly the same time whether verifying 1 token or 8 candidate tokens in one forward pass. Speculative decoding uses either a built-in Multi-Token Prediction (MTP / NextN) head or a tiny 0.6B–1.7B draft model (-md) from the same tokenizer family to propose tokens cheaply, letting the target model verify several tokens per read. Speedups are highest (1.4×–1.9×) on code, JSON, and structured reasoning at batch size 1; under heavy multi-user concurrency (-np 8+), compute saturates and draft overhead reduces throughput.
Option 1: Built-in MTP head vs Option 2: Separate draft GGUF (-md)
Checkpoints that ship native MTP weights in GGUF need no second file — pass --spec-type draft-mtp --spec-draft-n-max 4 so llama-server activates the internal head for ~0.3–0.5 GB of extra buffer. Qwen3 32B at Q4_K_M with an 8K context needs about 22.9 GB. On a 32 GB+ card (or at Q3_K_M on 24 GB), pair it with a compatible small Q4_K_M draft GGUF (~1.1 GB) via -md and -ngld 99.
# Option 1: Built-in MTP head (for GGUF checkpoints that include MTP tensors)
./build/bin/llama-server \
-m ./models/model-with-mtp-Q4_K_M.gguf \
--spec-type draft-mtp --spec-draft-n-max 4 -ngl 99 -c 16384 --flash-attn on \
--host 127.0.0.1 --port 8080
# Option 2: Separate compatible draft GGUF (-md) with identical tokenizer
./build/bin/llama-server \
-m ./models/Qwen3-32B-Q4_K_M.gguf \
-md ./models/Qwen3-1.7B-Q4_K_M.gguf \
-ngl 99 -ngld 99 --spec-type draft-simple --spec-draft-n-max 16 --spec-draft-n-min 4 --spec-draft-p-min 0.75 \
-c 16384 --flash-attn on --host 127.0.0.1 --port 8080Sizing multi-slot (-np) continuous batching without OOM
In llama-server, -c sets the total KV cache pool shared across all -np parallel slots — NOT the context per user! Passing -np 4 -c 32768 gives each of the 4 concurrent requests an 8,192-token window while allocating 32,768 tokens of KV cache in VRAM. Pair --flash-attn on with -ctk q8_0 -ctv q8_0 to cut that multi-slot KV pool roughly in half with negligible quality impact, and enable -cb (continuous batching, on by default in recent llama-server) plus --cache-reuse 256 so shared system prompts are not re-prefilled.
# 4 concurrent slots × 8K per slot = 32768 total KV pool, Q8_0 KV cache
# Qwen3 8B Q4_K_M @ 8K × 1 slot is ~6.4 GB; 4 slots with Q8_0 KV stays ~8.8 GB
./build/bin/llama-server \
-m ./models/Qwen3-8B-Q4_K_M.gguf \
-ngl 99 -np 4 -c 32768 \
--flash-attn on -ctk q8_0 -ctv q8_0 --cache-reuse 256 \
--host 127.0.0.1 --port 8080Common questions
Can I mix any small GGUF as a speculative draft model (-md)?
No — the target and draft GGUFs must share a compatible vocabulary and tokenizer (for example, Qwen3 1.7B drafting for Qwen3 32B, or Llama 3.2 1B drafting for Llama 3.3 70B). Mismatched tokenizers fail at startup or reject almost every drafted token.
How can I preview speculative speedup and thinking-token wait time?
Open the Feel the Speed tool (/tools/feel/), select your two GPUs and model, and toggle the Reasoning Token Budget and Speculative Decoding presets to compare live streaming speed and Time-to-Final-Answer.
What this guide uses
- Format
- GGUF
- Picks for it
- Best local LLM for 24GB
Next steps
See everything that fits 🟢 RTX 4090Reverse lookup — 24GB at 16384 context, ranked by qualityModels covered in this guide
Did this actually run?
Copying a command is not the same as it working, so this is the only place the site asks. Nothing is collected beyond the answer itself.
Related guides
Tune llama.cpp on a CPU-Only Linux PC or VPS
Check physical cores on a Linux PC or CPU-only VPS. Run a GGUF with llama.cpp and use llama-bench to test thread counts and where OpenBLAS helps.
Nginx Reverse Proxy for Local LLM APIs
Put Ollama or llama.cpp behind Nginx with TLS, rate limiting, and a stable /v1 endpoint for your apps.
Run Llama 3.1 8B on a €20/month VPS
A complete guide to running a private LLM API on a budget Linux VPS using llama.cpp server mode.