MCPcopy Index your code
hub / github.com/SafeAILab/EAGLE

github.com/SafeAILab/EAGLE @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
729 symbols 2,066 edges 51 files 182 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EAGLE

 EAGLE

| Paper (EAGLE) | Paper (EAGLE-2) | Paper (EAGLE-3) | Blog |

Version License Maintenance Contributions welcome

benchmark

EAGLE (Extrapolation Algorithm for Greater Language-model Efficiency) is a new baseline for fast decoding of Large Language Models (LLMs) with provable performance maintenance. This approach involves extrapolating the second-top-layer contextual feature vectors of LLMs, enabling a significant boost in generation efficiency.

  • EAGLE is:
    • certified by the third-party evaluation as the fastest speculative method so far.
    • achieving 2x speedup on gpt-fast.
    • 3x faster than vanilla decoding (13B).
    • 2x faster than Lookahead (13B).
    • 1.6x faster than Medusa (13B).
    • provably maintaining the consistency with vanilla decoding in the distribution of generated texts.
    • trainable (within 1-2 days) and testable on 8x RTX 3090 GPUs. So even the GPU poor can afford it.
    • combinable with other parallelled techniques such as vLLM, DeepSpeed, Mamba, FlashAttention, quantization, and hardware optimization.

EAGLE-2 uses the confidence scores from the draft model to approximate acceptance rates, dynamically adjusting the draft tree structure, which further enhances performance.

  • EAGLE-2 is:
  • 4x faster than vanilla decoding (13B).
  • 1.4x faster than EAGLE-1 (13B).

EAGLE-3 removes the feature prediction constraint in EAGLE and simulates this process during training using training-time testing. Considering that top-layer features are limited to next-token prediction, EAGLE-3 replaces them with a fusion of low-, mid-, and high-level semantic features. EAGLE-3 further improves generation speed while ensuring lossless performance.

  • EAGLE-3 is:
  • 5.6 faster than vanilla decoding (13B).
  • 1.8x faster than EAGLE-1 (13B).

demogif

Inference is conducted on 2x RTX 3090 GPUs at fp16 precision using the Vicuna 13B model.

Support

EAGLE has been merged in the following mainstream LLM serving frameworks (listed in alphabetical order).

Update

2025.9.18: EAGLE-3 is accepted to NeurIPS'25.

2025.7.23: We strongly recommend using SpecForge for out-of-the-box training of EAGLE-3 with SGLang.

2025.3.19: EAGLE-3 is released.

2024.8.8: We now support Qwen-2.

2024.6.27: EAGLE-2 is released.

2024.2.25: EAGLE is certified by the third-party evaluation as the fastest speculative method.

2024.1.17: We now support Mixtral-8x7B-Instruct.

2023.12.8: EAGLE v1.0 is released.

Todo

  • [x] Support non-greedy inference (provably maintaining text distribution).
  • [x] Support more LLMs such as Mixtral 8x7B.
  • [x] Support LLaMA-3.
  • [x] Support Qwen-2.
  • [x] Support vLLM (please check vLLM's implementation).
  • [x] EAGLE-3.
  • [x] Training code of EAGLE-3.
  • [x] Support LLaMA-4.
  • [ ] Support official EAGLE-3 for Qwen-3.
  • [ ] EAGLE-4.

The default main branch is the implementation of EAGLE-3 and EAGLE-2. For using EAGLE-1, please switch to the v1 branch.

Contents

Setup & Installation

git clone https://github.com/SafeAILab/EAGLE.git
cd EAGLE
python -m venv ~/venvs/ea_env
source ~/venvs/ea_env/bin/activate
pip install -r requirements.txt

EAGLE-3 Weights

Note: This repository recognizes only official EAGLE-3 checkpoints. Performance of unofficial checkpoints may vary. If you want to compare with EAGLE-3, please compare with official checkpoints and official draft tree setups.

EAGLE-3 Models on Hugging Face

Base Model EAGLE-3 Model(s) Official
Vicuna-13B v1.3

lmsys/vicuna-13b-v1.3 | yuhuili/EAGLE3-Vicuna1.3-13B | Yes | | LLaMA-3.1-8B-Instruct

meta-llama/Llama-3.1-8B-Instruct | yuhuili/EAGLE3-LLaMA3.1-Instruct-8B | Yes | | LLaMA-3.3-70B-Instruct

meta-llama/Llama-3.3-70B-Instruct | yuhuili/EAGLE3-LLaMA3.3-Instruct-70B | Yes | | DeepSeek-R1-Distill-LLaMA-8B

deepseek-ai/DeepSeek-R1-Distill-Llama-8B | yuhuili/EAGLE3-DeepSeek-R1-Distill-LLaMA-8B | Yes | | LLaMA-4-Scout-17B-16E-Instruct

meta-llama/Llama-4-Scout-17B-16E-Instruct | lmsys/sglang-EAGLE3-Llama-4-Scout-17B-16E-Instruct-v1 | No | | LLaMA-4-Maverick-17B-128E-Instruct

meta-llama/Llama-4-Maverick-17B-128E-Instruct | lmsys/sglang-EAGLE3-Llama-4-Maverick-17B-128E-Instruct-v1

nvidia/Llama-4-Maverick-17B-128E-Eagle3 | No | | Qwen3-1.7B

Qwen/Qwen3-1.7B | AngelSlim/Qwen3-1.7B_eagle3 | No | | Qwen3-4B

Qwen/Qwen3-4B | AngelSlim/Qwen3-4B_eagle3 | No | | Qwen3-8B

Qwen/Qwen3-8B | Tengyunw/qwen3_8b_eagle3

AngelSlim/Qwen3-8B_eagle3

Zjcxy-SmartAI/Eagle3-Qwen3-8B-zh | No | | Qwen3-14B

Qwen/Qwen3-14B | AngelSlim/Qwen3-14B_eagle3 | No | | Qwen3-30B-A3B

Qwen/Qwen3-30B-A3B | Tengyunw/qwen3_30b_moe_eagle3

AngelSlim/Qwen3-a3B_eagle3 | No | | Qwen3-32B

Qwen/Qwen3-32B | AngelSlim/Qwen3-32B_eagle3

Zjcxy-SmartAI/Eagle3-Qwen3-32B-zh | No | | Qwen3-235B-A22B

Qwen/Qwen3-235B-A22B | nvidia/Qwen3-235B-A22B-Eagle3

lmsys/Qwen3-235B-A22B-EAGLE3 | No | | MiniCPM4-8B

openbmb/MiniCPM4-8B | linglingdan/Eagle3_for_MiniCPM4 | No | | OLMoE-1B-7B-Instruct

allenai/OLMoE-1B-7B-0125-Instruct | wantsleep/OLMoE_1B_7B_Eagle3 | No | | granite-3.1-1b-a400m-instruct

ibm-granite/granite-3.1-1b-a400m-instruct | wantsleep/granite-3.1-1b-a400m-EAGLE3 | No | | GPT-OSS-120B

openai/gpt-oss-120b | lmsys/EAGLE3-gpt-oss-120b-bf16

nvidia/gpt-oss-120b-Eagle3 | No | | GLM-4.7-Flash

zai-org/GLM-4.7-Flash | thoughtworks/GLM-4.7-Flash-Eagle3 | No |

EAGLE Weights

Note: The current code defaults to using EAGLE-3. If you want to use EAGLE weights, please specify use_eagle3=False in EaModel.from_pretrained.

Note: When Qwen2 is the target model, please use bf16 precision instead of fp16 to avoid numerical overflow. The training dataset for the draft model of Qwen2 is ShareGPT, which has removed non-English data. Therefore, if you want to use it on non-English data such as Chinese, please train with the corresponding data.

EAGLE Models on Hugging Face

Base Model EAGLE Model # EAGLE Parameters Official
Vicuna-7B v1.3 yuhuili/EAGLE-Vicuna-7B-v1.3 0.24B Yes
Vicuna-13B v1.3 yuhuili/EAGLE-Vicuna-13B-v1.3 0.37B Yes
Vicuna-33B v1.3 yuhuili/EAGLE-Vicuna-33B-v1.3 0.56B Yes
LLaMA2-Chat 7B yuhuili/EAGLE-llama2-chat-7B 0.24B Yes
LLaMA2-Chat 13B yuhuili/EAGLE-llama2-chat-13B 0.37B Yes
LLaMA2-Chat 70B yuhuili/EAGLE-llama2-chat-70B 0.99B Yes
Mixtral-8x7B-Instruct v0.1 yuhuili/EAGLE-mixtral-instruct-8x7B 0.28B Yes
LLaMA3-Instruct 8B yuhuili/EAGLE-LLaMA3-Instruct-8B 0.25B Yes
LLaMA3-Instruct 70B yuhuili/EAGLE-LLaMA3-Instruct-70B 0.99B Yes
Qwen2-7B-Instruct yuhuili/EAGLE-Qwen2-7B-Instruct 0.26B Yes
Qwen2-72B-Instruct yuhuili/EAGLE-Qwen2-72B-Instruct 1.05B Yes
LLaMA3.1-Instruct 8B [yuhuili/EAGLE-LLaMA3.1-Instruct-8B](https://huggingface.co/yuhuili/EAGLE-LLaMA3.1-Instru

Core symbols most depended-on inside this repo

cat
called by 115
eagle/model/kv_cache.py
cat
called by 79
eagle/testbug/model/kv_cache.py
from_pretrained
called by 19
eagle/model/ea_model.py
prepare_logits_processor
called by 17
eagle/model/utils.py
get_tokenizer
called by 12
eagle/model/ea_model.py
eagenerate
called by 12
eagle/model/ea_model.py
from_pretrained
called by 9
eagle/testbug/model/ea_model.py
reset_kv
called by 9
eagle/model/cnets.py

Shape

Method 427
Function 169
Class 129
Route 4

Languages

Python100%

Modules by API surface

eagle/modeling_eagle.py69 symbols
eagle/traineagle3/modeling_llama_kv.py62 symbols
eagle/model/modeling_llama_kv.py62 symbols
eagle/model/modeling_qwen3_kv.py55 symbols
eagle/model/modeling_qwen2_kv.py55 symbols
eagle/testbug/model/cnets.py50 symbols
eagle/model/modeling_mixtral_kv.py50 symbols
eagle/model/cnets1.py45 symbols
eagle/traineagle3/cnets.py41 symbols
eagle/model/cnets.py41 symbols
eagle/train/main.py19 symbols
eagle/train/main_deepspeed.py17 symbols

For agents

$ claude mcp add EAGLE \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact