> For the complete documentation index, see [llms.txt](https://seekspeed.gitbook.io/seekspeed-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://seekspeed.gitbook.io/seekspeed-docs/spec-lab/primer.md).

# Speculative Decoding Primer

Speculative decoding speeds up autoregressive LLM inference by letting a small, fast **draft** model propose *k* tokens at a time, which the large **target** model verifies in a single forward pass. When the draft is right, you produce *k* tokens for the cost of one target forward pass. When it's wrong, you fall back to the target's own next token.

The theoretical ceiling on speedup is:

```
S_max = 1 + k × α
```

where `α` is the **acceptance rate** of the draft (the probability that a drafted token matches what the target would have sampled). With `k = 5` and `α = 0.7`, ceiling speedup is `4.5×`. Real-world speedup is always lower because:

* The draft model itself has non-zero latency (**draft overhead**).
* KV-cache and prefill setup dominate very short generations.
* Batched serving reduces the marginal benefit per request (**batch pressure**).
* Memory bandwidth, not compute, often bounds the target's verification step.

SeekSpeed's Spec Lab measures all four of these explicitly — see [Bottleneck Analysis](/seekspeed-docs/spec-lab/bottlenecks.md).

## DeepSpec and DSpark

DeepSpec is the open reference implementation for speculative decoding on the DeepSeek family of models. It ships draft model checkpoints aligned with DeepSeek-V3 and DeepSeek-V3-Pro, plus a vLLM-compatible serving path.

**DSpark** is DeepSeek's productionised speculative-decoding pipeline used in `DeepSeek-V4-Pro-DSpark` and downstream `*-fast` variants. It pairs a quantised draft with the full target and applies dynamic-*k* scheduling so the draft length adapts to per-token acceptance.

SeekSpeed Terminal does not re-implement either of these. It plugs into them via the standard vLLM `/metrics` and OpenAI-compatible APIs and exposes the same measurements DeepSpec authors use to validate their own claims, in your workload.

Continue to [DeepSpec Integration →](/seekspeed-docs/spec-lab/deepspec.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://seekspeed.gitbook.io/seekspeed-docs/spec-lab/primer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
