The starting point, in one line
Inference with a large language model (LLM) is limited by memory bandwidth: at every token, all the weights have to be re-read from memory, and the chip waits. The full argument is in Quantization: the concepts; the Medusa authors restate it almost word for word in their opening paragraph. The whole "speculative" family of techniques amounts to getting several tokens out of a single re-read of the weights.
What Medusa changes relative to speculative decoding
Speculative decoding describes the two-model arrangement: a small draft model proposes, the large one verifies. You therefore have to obtain that small model, train it or find it ready-made, hold it in memory alongside the large one, and live with the fact that it "thinks" somewhat differently.
Medusa removes the second model. You graft extra outputs onto the large model itself: the original head predicts the next token, and new heads predict the one after that, and the one after that. The model becomes its own proposer.
| Classic speculative decoding | Medusa | |
|---|---|---|
| Number of models | two, loaded together | one |
| Where proposals come from | a complete small model, run several times in sequence | grafted heads, run once in parallel |
| What must be trained | nothing, if a small model of the same family already exists | the heads, for every model and every version |
| Do proposals condition each other? | yes, the small model sees what it just proposed | no, each head guesses blind |
That last row is what drives the difference in behaviour, and we come back to it below: it is Medusa's structural weakness.
Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads (Cai et al., 2024)Instead of producing one token per traversal of the model, you add K heads that guess the next K tokens in parallel; a tree-shaped verification mechanism then sorts through the candidate sequences in a single extra traversal.
How a Medusa head is built
A standard Transformer has one output: it takes the last internal representation computed for the current token (a vector of numbers, written , of dimension (for instance for 7-billion-parameter models of the Llama family)) and turns it into a probability for every word in the vocabulary.
Medusa attaches extra heads to that same vector :
- head 0 (the original one) → the token at position
- Medusa head 1 → the token at position
- Medusa head 2 → the token at position
- … and so on up to head K
Each Medusa head is deliberately simple: a single linear layer of size , followed by an activation function (the authors use SiLU, a smooth curve that squashes negative values), plus a residual connection, meaning is added back to the result, so the head can start from the original information rather than reconstruct it. Then comes a projection to the vocabulary, of size where is the vocabulary size.
The picture: several scouts stationed at the same spot, each assigned to look one step further down the road.

What the heads cost in memory
Let us do the arithmetic in the open, with the values used by the authors: and a vocabulary of words.
- the layer: million parameters;
- the projection to the vocabulary, : million;
- total per head: roughly 148 million parameters.
The authors use 5 heads. That adds roughly 740 million parameters, about 10 % of a 7-billion-parameter model. In FP16 (2 bytes per parameter) that is around 1.5 GB of extra memory.
You often read that Medusa "saves the memory of the draft model". That needs qualifying: 740 million parameters is the order of magnitude of a small draft model. The real benefit lies elsewhere, in not having to obtain or pre-train a second model. The paper cites a competing approach whose draft-model pre-training consumed 275 A100 GPU-hours; Medusa heads train in a few hours on a single card.
Tree verification
The combinatorial problem
Each head proposes not one token but its few best candidates. If each of the 5 heads proposes 5, the number of possible continuations is , that is 3,125 sequences. Checking them one by one is out of the question: you would have swapped one bottleneck for another.

The trick: a tree-shaped attention mask
You arrange the candidates as a tree rather than a list, and rig the attention mechanism to check every branch at once.
A reminder of the mechanism: in a Transformer, each token "looks at" preceding tokens, and an attention mask is the grid saying, for each token, which ones it is allowed to look at. Normally the mask is triangular: token 5 sees tokens 1 through 4.
Medusa replaces that triangular mask with a tree-shaped one: each candidate sees only its ancestors in the tree, never neighbouring branches. You can then lay all the candidates from all the branches end to end in a single input sequence: the mask keeps them from contaminating each other. One traversal of the model suffices to evaluate all 3,125 continuations.
You then keep the longest branch whose every token passes the acceptance test.

This is not free either: lengthening the input sequence with a hundred-odd candidates costs computation, and the authors measure that overhead. They find that a well-chosen sparse tree of 64 nodes beats a dense tree of 256 nodes: a few good candidates beat many bad ones.
Training the heads: two recipes
Medusa-1, the original model stays frozen
Only the heads learn; the main model's weights do not budge. The loss adds up each head's prediction error:
The symbols, one at a time. is the loss, the number training tries to make as small as possible. numbers the heads (0 for the original head, 1 for the first Medusa head, and so on). is cross-entropy, the usual error measure for a word prediction: it grows the lower the probability the model assigned to the word that actually appeared. is the internal representation all the heads hang off. is a weight that doses each head's importance.
In one sentence: ask every head to guess its token, and count the errors of the further-looking heads for less. Where does the come from? Exactly that dosing: head 1 counts for 0.8, head 2 for 0.64, head 5 for 0.33. It is the authors' choice, not a mathematical necessity: guessing five tokens ahead is very hard, and letting that head weigh as much as the others would drag the whole training down.
What it costs, per the authors: about 5 hours for Medusa-1 on Vicuna-7B, on a single NVIDIA A100 PCIe card, using 60,000 conversations from the public ShareGPT dataset. The main model can even be loaded in quantized form, since it is only used to produce the internal representations.
Medusa-2, train the model too
You tune the heads and the main model together, so the internal representation better suits all the heads. The speed gain is larger, but it takes a cautious recipe (a loss combined with the original task, adjustment via LoRA rather than a full retrain) or you damage the model's capabilities. The authors in fact start from a model already trained under Medusa-1 before moving to Medusa-2.
Acceptance: Medusa is not always exact
An important point, and one usually glossed over. Speculative decoding rests on a strong guarantee: the output is identical to what the large model alone would produce. Medusa can offer the same guarantee (just sort the candidates with the same acceptance-rejection test) and the authors present Medusa-1 as acceleration without loss of generation quality.
But they also propose, and recommend in practice, a different filter they call typical acceptance: instead of the exact statistical test, you accept any candidate whose probability the main model judges "reasonable" against an adjustable threshold. It is faster, especially when generation is highly random, but it no longer preserves the output distribution. The EAGLE authors say so explicitly: Medusa's non-greedy generation does not guarantee losslessness.
Faced with an implementation advertising "Medusa", the right question is not "how many times faster?" but "which acceptance scheme?". With the exact rejection test, the output is the original model's. With typical acceptance, it is no longer quite that, the gap is reputed to be small, but it exists, and a threshold controls it.
Measured results
The authors define three distinct quantities that must not be conflated:
- the acceleration rate: the average number of tokens produced per decoding step. It is 1.0 for an ordinary model;
- the overhead: the ratio between the duration of a step with Medusa and one without. It is necessarily above 1, since the input sequence is lengthened with candidates;
- the actual speedup, which is the quotient of the two: acceleration rate ÷ overhead.
On Vicuna-7B and Vicuna-13B, against the reference Hugging Face implementation, with 5 heads:
| Model | Medusa-1 | Medusa-2 |
|---|---|---|
| Vicuna-7B | 2.18× | 2.83× |
| Vicuna-13B | 2.33× | 2.83× |
And the breakdown for the Medusa-2 models, with quality measured on MT-Bench (a set of open-ended questions whose answers are scored 0 to 10 by a judge model; the gap against the original model is in parentheses):
| Model | Acceleration rate | Overhead | MT-Bench quality |
|---|---|---|---|
| Vicuna-7B | 3.47 | 1.22 | 6.18 (+0.01) |
| Zephyr-7B | 3.14 | 1.18 | 7.25 (−0.07) |
| Vicuna-13B | 3.51 | 1.23 | 6.43 (−0.14) |
| Vicuna-33B | 3.01 | 1.27 | 7.18 (+0.05) |
Source: Cai et al., 2024, figure 4 and table 1. Conditions not to lose sight of: one request at a time, 5 heads, an unoptimized Hugging Face baseline.
Two readings. First, the overhead column explains why the actual speedup is well below the acceleration rate: you gain 3.5 tokens per step, but each step costs 22 % more. Second, speed does not rise with model size: Vicuna-33B has the worst acceleration rate in the table (3.01) and the highest overhead (1.27). The authors attribute this to a mismatch between the data that trained that model and the data they used for its heads.
The gain also depends heavily on the task: across MT-Bench categories, Medusa-2 on Vicuna-7B reaches 3.29× on coding (highly predictable text, where the heads guess well) against considerably less on open-ended writing.
The limits, unvarnished
The heads guess blind
This is the structural weakness. Each head predicts its token without seeing what the other heads predicted. The head aiming at has no idea which token the head chose. It is like asking someone for the third word of a sentence without telling them the first two. The inevitable result: the further ahead a head aims, the less reliable it is. A real draft model, by contrast, re-reads itself as it goes.
The heads are welded to their model
The heads must be trained for each model, and retrained after every change to that model. This is not a universal add-on.
If you adjust the main model (via LoRA or otherwise), the distribution of internal representations shifts, and the Medusa heads no longer predict correctly from them. They have to be retrained. That is a dependency worth documenting in any deployment pipeline.
Slotting it into a server is not immediate
The authors note it themselves in a footnote: Medusa works in principle with batching, but integrating it into a serving engine such as vLLM takes additional engineering work. The reason makes sense: the tree mask and the variable length of candidates complicate attention-cache management, which is precisely what those engines optimize most carefully.
What came next: EAGLE
EAGLE (Extrapolation Algorithm for Greater Language-model Efficiency) fixes exactly Medusa's weakness.
- Instead of independent heads, EAGLE runs a small autoregressive module on the model's internal representations (those of the second-to-last layer, which carry more information than the output probabilities).
- Each prediction conditions the next: to guess , the module knows what was proposed for . The authors identify that missing information as what was capping accuracy.
- EAGLE-2 adjusts the candidate tree on the fly according to the model's confidence: it speculates more when sure, less when hesitant.
On LLaMA2-Chat 70B, the EAGLE authors report a 2.7× to 3.5× speedup while preserving the distribution of the generated text.
EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty (Li et al., 2024)And multi-token prediction?
Do not confuse Medusa with multi-token prediction, covered in Multi-token prediction. Both add heads, but not at the same moment and not for the same purpose:
- Medusa grafts heads after the fact, onto an already-trained model, purely to speed up inference;
- multi-token prediction asks the model to aim several tokens ahead from pre-training onwards, primarily so that it learns better, with faster inference only a side benefit.
What to take away
Medusa illustrates a clear direction: enrich the model rather than multiply models. You avoid having to obtain a draft model, you avoid the behavioural mismatch between two models, and head training is measured in hours on a single card. In exchange: about 10 % more parameters, heads to retrain for every model version, and an acceptance scheme that, in its recommended variant, no longer guarantees identical output. EAGLE takes up the idea while curing the heads' blindness, and is today the most effective variant of this family.
1. You often read that Medusa saves the memory of the draft model. Is that actually true?
2. Why is a Medusa head aiming three tokens ahead less reliable than a genuine draft model aiming at the same position?
3. Five heads each proposing five candidates yield 3,125 possible continuations. How does Medusa check them without swapping one bottleneck for another?
4. An implementation advertises Medusa acceleration with no quality loss. What question should you ask before believing it?
5. Your team fine-tunes a Medusa-equipped model with LoRA. What happens to the acceleration setup?