Self-speculative decoding is an inference optimization where a single model drafts and verifies tokens internally, using auxiliary structures like Medusa heads to propose multiple future tokens in one forward pass. The model's main trunk then verifies these drafts in parallel via a tree attention mechanism. This internalizes the speculative process, removing the overhead of managing a separate draft model while maintaining the core speedup from parallel token verification.
Glossary
Self-Speculative Decoding

What is Self-Speculative Decoding?
Self-speculative decoding is an inference acceleration technique where a single large language model acts as both its own draft and target, eliminating the need for a separate draft model.
The technique hinges on adding lightweight, parallel prediction layers (Medusa heads) atop the model's final hidden states. These heads generate a candidate sequence of future tokens. The base model then performs a single verification forward pass on this tree of candidates. Accepted tokens are committed; a rollback mechanism handles rejections. This achieves a latency-accuracy tradeoff similar to standard speculative decoding but with simplified deployment and no external model dependency.
Key Components of Self-Speculative Decoding
Self-speculative decoding is an inference optimization technique where a single model acts as both draft and target, using auxiliary structures to generate and verify multiple future tokens in parallel. This eliminates the need for a separate draft model.
Medusa Heads
Medusa heads are lightweight, parallel prediction heads attached to the intermediate layers of a transformer model. They enable self-speculative decoding by proposing multiple future tokens in a single forward pass. Each head predicts a token at a different future position (e.g., head 1 predicts the next token, head 2 predicts the token two steps ahead).
- Architecture: Typically implemented as simple linear layers added after a chosen transformer block.
- Training: The heads are fine-tuned on the target model's outputs using a standard next-token prediction loss, ensuring they learn to mimic the model's own future distributions.
- Purpose: To generate a candidate sequence (or tree) of tokens for parallel verification without requiring a separate draft model's forward pass.
Tree Attention
Tree attention is a modified attention mechanism that allows a transformer to process a tree of candidate token sequences in a single, batched forward pass. This is the core mechanism for efficient parallel verification in self-speculative decoding.
- Mechanism: Instead of a single causal attention mask for a linear sequence, it uses a mask that allows candidate tokens to attend to all preceding tokens in their branch of the tree.
- Efficiency: It enables the target model (the model itself) to score all speculative candidates simultaneously, calculating their true probabilities.
- Contrast with Standard Verification: In classic speculative decoding with a separate draft model, verification uses a simple batch. Tree attention handles a more complex, branching candidate structure generated by multiple Medusa heads.
Candidate Sequence & Verification
The candidate sequence is the set of future tokens proposed by the Medusa heads. The model's own forward pass, using tree attention, then verifies these tokens in parallel.
- Generation: For a given context, all Medusa heads fire simultaneously, producing a set of candidate next tokens. This often forms a tree where the first head's output influences the candidates for later positions.
- Verification Forward Pass: The model runs one forward pass on this tree of candidates. It computes the true probability for each candidate token given the actual previous tokens (not the draft predictions).
- Acceptance Rule: A candidate token is accepted if its probability from the verified model is greater than the probability of the draft token proposed by the Medusa head. This is a form of token-level acceptance.
Acceptance & Rollback Mechanism
This component manages the outcome of verification, deciding which tokens to commit to the output sequence.
- Acceptance Rate: The percentage of proposed tokens accepted. High acceptance is critical for speedup, as each rejection incurs a verification cost without adding a new token to the output.
- Early Stopping: Verification proceeds sequentially through the candidate tree. If a token is rejected, the process for that branch halts, avoiding wasted computation on subsequent candidates in that branch.
- Rollback Mechanism: When a token is rejected, generation reverts to the last accepted position. The model then generates the correct token autoregressively (using its standard next-token prediction) before resuming speculative drafting. This ensures output distribution matches the original model.
Speedup Factor & Latency-Accuracy Tradeoff
The primary goal is to increase the speedup factor—the ratio of generation time for standard autoregressive decoding versus self-speculative decoding—while preserving the model's original output distribution.
- Theoretical Speedup: Governed by the formula:
Speedup ≈ (1 + γ * acceptance_rate) / (1 + γ), where γ (speculative factor) is the number of candidate tokens proposed per step. - Latency-Accuracy Tradeoff: Increasing γ (proposing more tokens) raises the potential speedup but may lower the acceptance rate, as predicting further into the future is less accurate. The optimal γ balances verification cost with acceptance gains.
- Throughput Improvement: In batched serving scenarios, the parallel verification of candidate trees across multiple requests can lead to significant throughput improvement by better utilizing GPU parallel compute units.
Contrast with Classic Speculative Decoding
Self-speculative decoding differs fundamentally from the classic small-big model pair approach.
- Single Model vs. Two Models: Eliminates the need to host, load, and manage a separate draft model. This simplifies deployment and avoids draft model distillation overhead.
- Architectural Integration vs. External Drafting: Drafting is performed by integrated Medusa heads, not an external model. Verification uses tree attention instead of simple batch verification.
- Overhead: The computational overhead is the added cost of the Medusa heads and tree attention, which is typically far less than running a separate draft model's forward pass. This makes it particularly efficient for reducing inference latency in resource-constrained or high-throughput environments.
Self-Speculative vs. Standard Speculative Decoding
A comparison of the core architectural and operational differences between self-speculative decoding, which uses a single model, and standard speculative decoding, which uses a separate draft model.
| Feature | Self-Speculative Decoding | Standard Speculative Decoding |
|---|---|---|
Core Architecture | Single model with auxiliary drafting heads (e.g., Medusa) | Two distinct models: a small draft model and a large target model |
Model Count | 1 | 2 |
Drafting Mechanism | Lightweight parallel heads on the target model's backbone | Full forward pass of a separate, smaller neural network |
Parameter Overhead | Low (< 1% of target model parameters for heads) | High (100% of a separate draft model's parameters) |
Acceptance Rate Driver | Internal model consistency and head training | Distributional alignment between draft and target models |
Verification Forward Pass | Scores the tree of draft tokens from its own heads | Scores the linear sequence of tokens from the draft model |
Memory Footprint (Inference) | Primary model weights + small head weights + speculative KV cache | Target model weights + full draft model weights + speculative KV cache |
Deployment Complexity | Simplified (single model service) | Higher (orchestrating two model services, potential version skew) |
Training Requirement | Requires training of drafting heads on the target model | Requires training or distilling a separate draft model |
Optimal Speculative Factor (γ) | Typically higher (e.g., 5-10) | Typically lower (e.g., 3-5) due to draft-target divergence |
Hardware Utilization | Highly efficient; compute focused on one model's hardware | Can be less efficient; may require partitioning or two model loads |
Latency-Accuracy Tradeoff Control | Fine-grained via head confidence thresholds | Coarse-grained; depends on draft model selection and distillation quality |
Rollback Mechanism | Reverts to target model's backbone logits at rejection point | Reverts to target model's logits, discarding draft model's future path |
Frequently Asked Questions
Self-speculative decoding is a cutting-edge inference acceleration technique where a single model acts as both draft and target, eliminating the need for a separate draft model. These questions address its core mechanisms, trade-offs, and implementation.
Self-speculative decoding is an inference optimization technique where a single, large language model generates multiple candidate future tokens in parallel (drafts) and then verifies them against its own predictions in a single, subsequent forward pass. It works by attaching auxiliary, lightweight prediction heads—often called Medusa heads—to the model's final layers. During a drafting phase, these heads propose a tree of candidate token sequences. In the subsequent verification phase, the model's primary head scores all candidates in parallel using a modified tree attention mechanism, accepting a prefix of correct tokens before rolling back and continuing autoregressively from the first rejection.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Self-speculative decoding is a specialized inference acceleration technique. These related terms define the core components, alternative strategies, and performance metrics of this optimization family.
Speculative Decoding
The foundational technique where a smaller, faster draft model proposes a sequence of candidate tokens, which are then verified in parallel by a larger target model. This creates a latency-accuracy tradeoff, as speedup depends on the draft's acceptance rate. Self-speculative decoding is a variant that eliminates the need for a separate draft model.
Medusa Heads
Lightweight, parallel prediction heads attached to a base transformer model that enable self-speculative decoding. In a single forward pass, these heads propose multiple future token candidates (e.g., 4-8 tokens ahead). The model's own verification forward pass then scores these candidates against its primary head's predictions, enabling internal drafting and verification.
Lookahead Decoding
A broad category of speculative techniques that generate candidate tokens without a separate neural draft model. This includes:
- N-gram drafting: Using static tables of common token sequences.
- Self-drafting: Using the target model's own intermediate states. Self-speculative decoding with Medusa is a learned, adaptive form of lookahead decoding.
Tree Attention
A modified attention mechanism that allows a transformer to process a tree of candidate token sequences in parallel. This is critical for efficiently verifying multiple speculative branches proposed by techniques like Medusa. It expands the speculative KV cache to store key-value states for all candidate paths, enabling batched scoring in a single verification pass.
Acceptance Rate
The percentage of tokens proposed by a draft mechanism that are accepted by the verification step. This is the primary determinant of the speedup factor in any speculative method. A low acceptance rate triggers more frequent rollback mechanisms, incurring verification cost without net latency gain. Self-speculative methods aim for high acceptance by aligning the drafter with the target model's internal state.
Verification Forward Pass
The single, batched inference step where the target model scores all tokens in a candidate sequence. This pass uses parallel decoding to check draft tokens against the model's own predicted probability distributions. Its computational cost must be less than the cost of generating those tokens autoregressively. Efficiency is enhanced via batch verification and early stopping upon token rejection.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us