Medusa accelerates single-request LLM decoding by 2.18x to 2.33x with a frozen backbone (Medusa-1) and 2.35x to 2.83x with joint fine-tuning (Medusa-2), eliminating the separate draft model required by standard speculative decoding. Tianle Cai, Yuhong Li, Zhengyang Geng, Hongwu Peng, Jason D. Lee, Deming Chen, and Tri Dao (Princeton, Together AI, UIUC, CMU, and UConn, ICML 2024) append parallel lookahead heads directly onto the target model’s final hidden states and verify a pruned tree of continuations in one forward pass.
Acquiring, aligning, and serving a separate draft model complicates production deployments, especially under tensor parallelism, and pretraining small drafts from scratch can burn hundreds of GPU hours (SpecInfer reported 275 NVIDIA A100 GPU hours). By drafting inside the target model itself, Medusa removes cross-model orchestration and distribution shift at the cost of extra head parameters and, in its fastest mode, relaxed sampling guarantees.
- 2.83x speedup on Vicuna-7B and 13B: On MT-bench at batch size 1, Medusa-2 raises Vicuna-7B and 13B wall-time throughput by 2.83x (accepting 3.47 and 3.51 tokens per step at 1.22x and 1.23x per-step latency overhead), peaking at 3.62x on extraction and 3.29x on coding.
- Beats small external drafts: Across Vicuna-7B, 13B, and 33B, Medusa-2 reaches 2.83x, 2.83x, and 2.35x, outperforming open-source speculative decoding paired with
Llama-68MorTiny-Vicuna(1.47x, 1.56x, and 1.60x). - Single-GPU training for Medusa-1: Freezing a 4-bit quantized backbone lets Medusa-1 train 5 residual heads on 60k ShareGPT samples in roughly 5 hours on one A100 PCIe GPU with zero change to base model quality.
- Batch-size ceiling at 32: Analytical roofline modeling on Llama-7B (
seq_len = 1024) shows that once batch size exceeds 32, linear layers become compute-bound and Medusa’s net speedup turns negative.
How It Works
Given the target LLM’s last hidden state h_t at step t, Medusa attaches K independent decoding heads (up to K = 5), each consisting of one residual SiLU layer followed by a vocabulary projection initialized to the original LM head. While the original head predicts token t + 1, head k predicts token t + k + 1 in parallel.
Because each head predicts its offset independently without conditioning on earlier drafted tokens (unlike EAGLE-2), combining only their top-1 choices limits throughput to roughly 1.5x (Table 3). To raise acceptance length, Medusa takes multiple top candidates per head and verifies them simultaneously using tree attention, an attention mask and position-index remap where each candidate node attends only to its ancestors. Rather than verifying a dense Cartesian product, Medusa greedily constructs an optimized sparse tree (such as 64 nodes across 4 heads for Vicuna-7B) using empirical head accuracies calibrated on Alpaca-eval, lifting speedup from 1.9x (dense tree) to 2.2x (sparse tree).
Two design extensions expand where Medusa applies:
- Typical acceptance: Instead of speculative sampling’s rejection rule, which accepts fewer drafts at high sampling temperatures, Medusa accepts any suffix token whose target probability exceeds
min(epsilon, delta * exp(-H(p))), selecting the longest valid prefix. - Self-distillation: For closed-data or RLHF models like Zephyr-7B and Vicuna-33B, Medusa generates ~100k synthetic conversations from seed prompts and trains a LoRA adapter with KL divergence against the original model (adapter toggled off) so backbone weights stay aligned without holding two models in memory.
Key Findings
Each component adds measurable throughput on Vicuna-7B MT-bench: parallel heads alone yield ~1.5x, adding tree attention brings ~1.9x, sparse tree pruning reaches ~2.2x, and Medusa-2 joint training hits ~2.8x (2.83x exact, Table 3). On AlpacaEval, speedups hold across all four tested checkpoints: 2.88x on Vicuna-7B (106.76 vs. 37.07 tok/s), 3.16x on Vicuna-13B (91.54 vs. 29.01 tok/s), 2.91x on Zephyr-7B, and 2.26x on Vicuna-33B.
Sparse tree pruning also prevents compute saturation. On Vicuna-7B writing and roleplay prompts, a 64-node sparse tree matches or exceeds the acceptance rate of a 256-node dense tree while keeping verification fast; beyond 64 candidate tokens, matrix-multiplication overhead in linear and attention layers degrades wall-time tokens per second.
Caveats and Builder Takeaway
- Typical acceptance is not distribution-preserving: Unlike exact rejection sampling, typical acceptance alters the output distribution (trading quality vs. speed via
epsilon) and accepts the first token greedily, which can change creative sampling behavior. - Independent heads cap acceptance length: Because head
kdoes not see tokent + 1when predictingt + k + 1, Medusa requires wider trees to compensate, and later sequential-head designs like Hydra and EAGLE-2 outperform it on lossless MT-bench (2.88x and 4.26x vs. Medusa’s 2.07x under strict rejection sampling). - Single-user regime only: Analytical roofline profiling (Appendix G) shows that as batch size passes 32 or context length grows long, verifying 64 candidate tokens per sequence turns linear and attention layers compute-bound and erases the speedup.
Builder takeaway: Medusa shines when operational simplicity matters most, such as single-user local serving or monolithic deployments where maintaining a second draft checkpoint is unacceptable. Use Medusa-1 if you must guarantee untouched base-model weights, and switch to sequential feature drafters like EAGLE-2 if you need strict distribution-preserving speedups above 3x.


