What Is Speculative Decoding?
By Hans Kuepper · Founder of PromptQuorum · Discovery engine for open-weight & open-source AI
Speculative decoding speeds up inference by using a small, fast draft model to propose several tokens at once, which a larger target model then verifies in a single parallel pass instead of generating each token sequentially. When the draft model guesses correctly, generation is effectively faster with no quality loss.
Key Takeaways
- ✓A small draft model proposes tokens ahead; the larger target model verifies them in one parallel pass
- ✓Output quality is identical to running the target model alone — only speed changes
- ✓Speedup is largest on predictable text (code, repetitive structure) where the draft model guesses correctly more often
- ✓The draft model must share the same tokenizer and vocabulary as the target model
- ✓The acceptance rate decides the speedup; draft models from the same family usually get accepted more often

Quick Answer
Speculative decoding pairs a small draft model with a larger target model. The draft model proposes several tokens ahead, and the target model verifies them all in one parallel forward pass instead of one sequential pass per token, which speeds up generation when the draft guesses are accepted.
- ▸A small draft model proposes multiple tokens ahead of the main model.
- ▸The larger target model verifies the proposed tokens in a single parallel pass.
- ▸Output quality matches the target model exactly — speculative decoding does not change what gets generated, only how fast.
How It Works
A draft model, much smaller and faster than the target model, generates a short sequence of candidate tokens. The target model then evaluates that entire sequence in a single forward pass, accepting tokens that match what it would have generated on its own and discarding the rest, along with anything generated after the first mismatch.
Because verifying several tokens in parallel costs roughly the same as generating one token sequentially on the target model, accepted guesses translate directly into a speed gain with no change to the final output. The target model always has final say — a wrong draft guess only costs the (small) time spent generating it, it never gets accepted into the output.
Acceptance Rate Decides the Speedup
The acceptance rate — the share of draft tokens the target model keeps — decides how much faster generation gets. A high rate means each expensive target pass yields several tokens; a low rate means most draft work is thrown away and the gain shrinks or disappears.
Drafts from the same model family usually earn higher acceptance because they share training data and tokenization with the target. Size matters in both directions: a draft that is too small guesses poorly, while one that is too large is slow enough to cancel the gain. The [LM Studio documentation](https://lmstudio.ai/docs/app/advanced/speculative-decoding) suggests pairing a 7B-class main model with a draft of up to 1B, a 14B-class model with up to 3B, and a 32B-class model with up to 7B, and expects no speedup for a 3B-class main model. llama.cpp prints acceptance statistics, so you can measure the rate on your own prompts.
When Speculative Decoding Helps Most
Use speculative decoding when generating code, structured data, or other predictable text, where the draft model's guesses are accepted at a high rate and the speedup is largest. Use it when you are already inference-bound on generation speed rather than prompt-processing speed, since speculative decoding specifically accelerates the token-by-token generation step.
Skip speculative decoding when generating highly creative, unpredictable text (open-ended fiction, brainstorming), where the draft model's guesses are accepted less often and the speedup shrinks — the extra draft-model overhead can offset the gain in the worst case. Skip it if you don't have a compatible smaller model from the same family available to use as a draft model.
Setting Up a Draft Model
The draft model must share the same tokenizer and vocabulary as the target model — pairing models from different families (or even different sizes of a model where the vocabulary changed between versions) will not work. The most common setup uses a smaller model from the same family as the target (for example, a 1B-class model drafting for a 13B-class model from the same family).
Several local inference tools (including llama.cpp) support speculative decoding natively — the setup typically requires specifying both the target model and the draft model at launch, with no changes needed to how you prompt the model.
In LM Studio, the feature lives in the chat sidebar: switch to Power User mode or higher, load the main model, then pick a Draft Model under Speculative Decoding. Per the [LM Studio documentation](https://lmstudio.ai/docs/app/advanced/speculative-decoding), the draft must share the main model's vocabulary. In llama.cpp, pass the draft model next to the target with the -md option, for example llama-server -m target.gguf -md draft.gguf (see the [llama.cpp documentation](https://github.com/ggml-org/llama.cpp/blob/master/docs/speculative.md)).
Draftless Speculation: Prompt Lookup and N-gram Methods
Some methods skip the draft model entirely. Prompt lookup and n-gram speculation search the existing prompt and generated text for a repeating pattern and propose the tokens that followed it last time; the target model then verifies them exactly as it would with a draft model.
These methods add no extra VRAM and need no compatible second model, but they only pay off when the output repeats earlier text — editing a document, refactoring code, quoting from the context, or summarizing with copied phrases. llama.cpp supports several n-gram variants, and draftless methods take precedence if a draft model is also configured.