← All 96 breakdowns
DRAFT

Speculative decoding, step by step: make your local model faster with a tiny draft

A short breakdown from Adam Rosler, AI engineer. The one you commented DRAFT for.

What's happening

When a language model writes, it makes one token (a word or a piece of a word) at a time. For every token, your GPU reads the whole model out of memory. A 7-billion-parameter model squeezed to 4.7 GB means reading 4.7 GB for each token. The GPU's maths units could do far more; they spend most of their time waiting for that memory.

Speculative decoding uses that waiting time. A much smaller "draft" model from the same family (ours was 15 times smaller) quickly guesses the next few tokens. The big model then checks all of those guesses in one pass, which costs about the same as making one token, because the expensive part (reading the model) happens once.

  • Every guess that matches what the big model would have written is kept.
  • At the first wrong guess, the rest are thrown away and the big model writes its own token there.

So the big model still picks every word. When the guesses are good, you get several tokens for the price of one.

What we measured

  • On one RTX 5070 Ti, Qwen2.5-Coder-7B (Q4, 4.7 GB) with Qwen2.5-Coder-0.5B as the draft, temperature 0: code went from 156 to 221 tokens a second (1.41x), with 76% of the draft's guesses kept.
  • A short story got slower: 156 to 133 tokens a second (0.85x), with only 32% kept. Stories are hard to guess.
  • The original paper (Leviathan, Kalman and Matias, 2022) measured 2 to 3 times faster on a bigger (11B) model.

Step by step (llama.cpp)

  1. Pick a draft from the same family as your model (they must share a vocabulary), about 10-20 times smaller: Qwen2.5-Coder 7B with Qwen2.5-Coder 0.5B, Qwen3-8B with Qwen3-0.6B, Llama 3.1 8B with Llama 3.2 1B.

  2. Download both as GGUF files (the draft can be Q8; it's small).

  3. Start the server with the draft loaded and switched on:

    llama-server -m coder-7b.gguf -md coder-0.5b.gguf --spec-type draft-simple
    

    -md (--model-draft) loads the draft. On recent builds --spec-type defaults to none, so without --spec-type draft-simple the draft is loaded and quietly does nothing.

  4. Check it's working: the server log should show a line like draft acceptance = 0.76 (... accepted / ... generated). No such line means no speculation.

  5. Measure on your own prompts: run the same prompt with and without -md and compare tokens a second. Code, boilerplate and structured output usually win; prose may lose.

  6. Tune if you like: --spec-draft-n-max sets how many tokens the draft guesses per step (default 3). More guesses help predictable text and hurt the rest.

vLLM instead

Add --speculative-config '{"model": "<draft>", "num_speculative_tokens": 5, "method": "draft_model"}' to vllm serve.

The details, if you want them

  • The text can differ slightly from a run without the draft, even at temperature 0: checking several tokens at once on a GPU rounds a tiny bit differently, so a near tie can go the other way. The quality is still the big model's.
  • Our settings sweep (3 guesses a step): code 153 → 230 tokens a second (1.5x); the story 0.92x. At 8 guesses the story fell to 0.61x.

Sources: Leviathan, Kalman, Matias, "Fast Inference from Transformers via Speculative Decoding" (arXiv 2211.17192); llama.cpp docs (docs/speculative.md, tools/server/README.md); vLLM docs (speculative decoding, draft models). Numbers: our own runs on 23 Nov 2026, llama.cpp build 12651.

FREE ONE-TIME UNLOCK

Unlock the full DRAFT breakdown

Drop your email once to read the complete step-by-step guide, grab the files, and unlock all 96 Reel breakdowns on this device forever.

✓ Instant reveal right here✓ No spam, unsubscribe any time