Medusa logo

Medusa

FasterDecoding/Medusa

Framework for accelerating LLM generation using multiple decoding heads

GraphCanon updated today · GitHub synced today · 28 views this month

2.8k stars205 forksLast push 2y Jupyter Notebook Apache-2.0

Decision brief

Medusa enables quicker language model inference with parallel decoding strategies.

Good fit when

  • When you need to accelerate inference times for large language models without compromising on output quality.
  • For applications requiring real-time interaction where rapid response times are critical and multiple decoding paths can be utilized.

Avoid when

  • If your model does not benefit from parallelized decoding, such as when the model architecture inherently limits parallel execution efficiency.
  • In scenarios where the computational resources required for multiple decoding heads exceed what is available or cost-effective within your infrastructure.

Observed Jul 14, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (790d since push)
As of today
Provenance
Not a fork · Organization account
As of today
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

git clone https://github.com/FasterDecoding/Medusa

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

Medusa is designed to speed up the inference process of large language models through parallelized decoding strategies.

Capability facts

Languages
jupyter notebook, python

Source: github.language+pyproject.toml · Aug 24, 2026

Categories

Tags

README

 Medusa: Simple Framework for Accelerating LLM Generation with Multiple Decoding Heads

| Blog | Report | Roadmap |


News 🔥

  • [2024/1] Medusa technical report is now available on arXiv. We've added multiple new features, including Medusa-2 recipe for full-model training, self-distillation for adding Medusa to any fine-tuned LLM, etc. The new results show a 2.2-3.6x speedup over the original model on a range of LLMs.

Introduction

Medusa is a simple framework that democratizes the acceleration techniques for LLM generation with multiple decoding heads.


Medusa-1 on Vicuna-7b.

We aim to tackle the three pain points of popular acceleration techniques like speculative decoding:

  • Requirement of a good draft model.
  • System complexity.
  • Inefficiency when using sampling-based generation.

Medusa adds extra "heads" to LLMs to predict multiple future tokens simultaneously. When augmenting a model with Medusa, the original model stays untouched, and only the new heads are fine-tuned during training. During generation, these heads each produce multiple likely words for the corresponding position. These options are then combined and processed using a tree-based attention mechanism. Finally, a typical acceptance scheme is employed to pick the longest plausible prefix from the candidates for further decoding.

We aim to solve the challenges associated with speculative decoding by implementing the following ideas:

  • Instead of introducing a new model, we train multiple decoding heads on the same model.
  • The training is parameter-efficient so that even the "GPU-Poor" can do it. And since there is no additional model, there is no need to adjust the distributed computing setup.
  • Relaxing the requirement of matching the distribution of the original model makes the non-greedy generation even faster than greedy decoding.

In the initial release, our primary focus is on optimizing Medusa for a batch size of 1—a setting commonly utilized for local model hosting. In this configuration, Medusa delivers approximately a 2x speed increase across a range of Vicuna models. We are actively working to extend Medusa's capabilities by integrating it into additional inference frameworks, with the aim of achieving even greater performance gains and extending Medusa to broader settings.

In the updated version, we add support for full-model training, called Medusa-2 (compared to Medusa-1, which only trains the new heads), which requires a special recipe that adds the speculative prediction ability while keeping the original model's performance.

We also add support for self-distillation, which allows us to add Medusa to any fine-tuned LLM without requiring the availability of the original training data.

Contents

  • Introduction
  • Contents
  • Installation
    • Method 1: With pip (may not be the latest version)
    • Method 2: From the source (recommended)
    • Model Weights
    • Inference
    • Training
    • Training (legacy)
    • Push to Hugging Face Hub
  • [Citation

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.