New Tool Radar

Local AI

How to Use Speculative Decoding with a Draft Model in llama.cpp

Give llama-server a small draft model with --model-draft so it proposes tokens the main model only has to check, speeding up generation.

Schematic diagram with three steps: pick a small draft model from the same family, start llama-server with --model-draft, and compare generation speed with and without it.

Generating text is slow because the big model produces one token at a time, each depending on the last. Speculative decoding breaks that: a small, fast draft model proposes several tokens at once, and the big model checks them all in one pass, keeping the ones it agrees with. When the draft is usually right, you get more tokens per pass and the reply arrives faster. The server README lists speculative decoding as a feature and documents --spec-draft-model, -md, --model-draft FNAME as the draft model for it.

Related guide: How to Measure Model Speed with llama-bench

Start the server with a draft model

llama-server -m main-model.gguf -md draft-model.gguf -c 8192

The draft model must be a small model from the same family and vocabulary as the main model — a draft that speaks a different tokenizer cannot propose tokens the main model can check. A common pairing is a 0.5B or 1B draft for a 7B or 8B main model. Both files must be GGUF, and both load into memory, so the draft costs some RAM or VRAM of its own.

Check whether it helped

Generate the same long reply with and without -md and compare the time. If the draft is too weak, the main model rejects most proposals and you gain nothing — or lose a little to the overhead. If the draft is too large, its own generation eats the savings. The win is biggest on long, predictable text; on short replies there is barely anything to speed up.

Expected result. We checked the llama.cpp server README for the speculative decoding feature and the –model-draft flag, and the server reference for the -md flag. We did not run this software ourselves for this guide, so no output here is a recorded result; steps marked UNTESTED were checked against the sources below, not run.

Limits

Speculative decoding changes speed, not quality: the main model still decides every token it keeps, so the reply should match what the main model would have written alone. It costs extra memory for the draft model and only helps when the draft is usually right. We did not run llama-server, so no speed here is a measured result.

Sources

Checked 2026-11-28.

See all