# EAGLE-4

> A speculative-decoding plugin for SGLang, vLLM and TokenSpeed that sizes its EAGLE-4 draft tree from measured costs on your hardware

- Category: Models & Inference / Serving & Deployment
- Language: Python
- Licence: Eagle 4 Source-Available License (not OSI-approved; commercial use permitted within its conditions, including a US $20 million revenue threshold, and a separate licence for competing offerings)
- Repository: https://github.com/eagle-hq/EAGLE-4
- Website: https://eagle.ai
- Canonical page: https://ai-tldr.dev/tools/eagle-4/
- Updated: 2026-10-23

## In short

EAGLE-4 (Extrapolation Algorithm for Greater Language-model Efficiency) is a speculative-decoding method for serving large language models faster, and this repository holds `eagle-harness`, the package that brings it to the SGLang, vLLM and TokenSpeed serving engines. It sits in the Serving & Deployment category of the Models & Inference tools and is open-source, written in Python and licensed Eagle 4 Source-Available License (not OSI-approved; commercial use permitted within its conditions, including a US $20 million revenue threshold, and a separate licence for competing offerings).

## Overview

EAGLE-4 (Extrapolation Algorithm for Greater Language-model Efficiency) is a speculative-decoding method for serving large language models faster, and this repository holds `eagle-harness`, the package that brings it to the SGLang, vLLM and TokenSpeed serving engines. A small EAGLE-4 draft model guesses a tree of upcoming tokens, the full target model checks the whole tree in one forward pass, and the longest accepted path is committed. The project's tagline is "one flexible drafter for all batch sizes and hardware": instead of verifying a draft tree of fixed shape every step, eagle-harness decides how far to speculate from costs it measures on your setup, so the tree fits the batch size, the GPUs and the workload.

eagle-harness never patches the engine. It registers through each engine's plugin entry point — the speculative algorithm `EAGLE_HARNESS` in SGLang, the speculative method `eagle_harness` in vLLM, a drafter in TokenSpeed — and checks at startup that every hook it relies on exists in the installed engine version. If one is missing it registers nothing and logs which hook and how to fix it, and the engine keeps serving without the method. The engine keeps prefill, scheduling, the KV cache, sampling and the HTTP server; eagle-harness supplies the draft tree, the cost model that sizes it, the EAGLE-4 draft model and the kernels of the tree round.

Each decode round drafts a token tree one level at a time from the last accepted token, ranks the nodes, and lets a cost model choose the round's shape. On SGLang it picks both the draft depth and the verify width per round from calibrated cost tables for the batch size and context length at hand; on vLLM the scheduler fixes the verify width per batch size and the draft depth stops as soon as another step cannot pay for itself. Since 0.1.2, SGLang decodes a batch without speculation wherever plain decoding would be faster. The draft model reads three hidden states of the target and scores the vocabulary with a low-rank candidate head, and the harness ships tree versions of the gated-delta-net kernels so hybrid targets can verify trees too.

At release the published pair is Qwen3.8-27B with its EAGLE-4 draft on Hugging Face (`EAGLE-Corp/Qwen3.8-27B-EAGLE4`). The README reports, on four NVIDIA B300 GPUs at temperature 0, single-request speedups over the same engine without speculation of 3.42× on SGLang, 2.83× on vLLM and 3.09× on TokenSpeed, shrinking to 1.14–1.41× at 64 concurrent requests, plus 2.07× at 8 concurrent requests on one AMD MI355X. The FAQ is explicit that different verification shapes can change target arithmetic, so it points to the support matrix's correctness checks rather than promising bit-identical output. EAGLE-4 builds on the earlier EAGLE, EAGLE-2 and EAGLE-3 methods but is published by Eagle AI Corp under its own source-available licence, not an OSI licence.

## What it does

- Plugs into SGLang, vLLM (Model Runner V2) and TokenSpeed through their plugin entry points — no engine patches, and a startup check that disables the method cleanly on an incompatible engine version
- A cost model that sizes every draft tree from measured costs: per-round depth and verify width on SGLang, per-round draft depth on vLLM, and plain decoding for batches where speculation would be slower
- The EAGLE-4 draft model: a sliding-window draft layer reading three target hidden states and a low-rank candidate head that re-scores only a few vocabulary candidates exactly
- Tree verification for hybrid targets, with tree versions of the gated delta net and causal conv1d kernels
- Published Docker images and pinned wheels for SGLang, vLLM and TokenSpeed on CUDA, plus a ROCm path for AMD Instinct MI355X
- `eagle-harness calibrate` to measure cost tables once on your GPUs, and a support matrix documenting speed and correctness checks per engine

## Getting started

The quick start serves Qwen3.8-27B with its EAGLE-4 draft on one GPU (tested by the maintainers on one NVIDIA B300 with Linux and a CUDA 13 driver). The model and draft download from Hugging Face on first start, about 62 GB. Add `--tp-size 4` to serve on four GPUs, as the measured recipes do.

1. Start an SGLang server with Docker

   The published image has SGLang and eagle-harness installed. `--speculative-algorithm EAGLE_HARNESS` selects the plugin and `--speculative-draft-model-path` points at the EAGLE-4 draft.

```bash
docker run --gpus all --ipc host -p 127.0.0.1:30000:30000 \
  -e HF_HOME=/hf -v ~/.cache/huggingface:/hf \
  ghcr.io/eagle-hq/eagle-4-sglang:0.1.2 \
  sglang serve --model-path Qwen/Qwen3.8-27B --host 0.0.0.0 \
  --disable-overlap-schedule --speculative-algorithm EAGLE_HARNESS \
  --speculative-draft-model-path EAGLE-Corp/Qwen3.8-27B-EAGLE4 \
  --speculative-num-steps 12 --speculative-eagle-topk 4 --speculative-num-draft-tokens 16 \
  --speculative-algorithm-config '{}'
```

2. Or install with pip

   Pip installs use Python 3.12 and also need the CUDA toolkit and a C++ compiler. The engine is a pinned build served from the project's wheel index.

```bash
python3.12 -m venv .venv && source .venv/bin/activate
pip install "eagle-harness[sglang]" "sglang==0.5.23.dev252+eagle.5" \
  --extra-index-url https://eagle-hq.github.io/EAGLE-4/whl/cu130/ \
  --extra-index-url https://download.pytorch.org/whl/cu130 \
  --extra-index-url https://pypi.nvidia.com

sglang serve --model-path Qwen/Qwen3.8-27B \
  --speculative-algorithm EAGLE_HARNESS \
  --speculative-draft-model-path EAGLE-Corp/Qwen3.8-27B-EAGLE4
```

3. Send a request

   When the server logs `The server is fired up and ready to roll!`, call its OpenAI-compatible endpoint from another terminal.

```bash
curl http://localhost:30000/v1/chat/completions -H 'Content-Type: application/json' \
  -d '{"model": "Qwen/Qwen3.8-27B", "messages": [{"role": "user", "content": "Explain how a hash table works."}], "max_tokens": 256}'
```

4. Serve with vLLM instead

   vLLM runs EAGLE-4 on its Model Runner V2 with the `CUSTOM` attention backend and an unquantized KV cache. This static tree drafts 14 steps with 4 candidates per step and verifies 16 tokens, and needs no calibration; the vLLM guide's measured recipe adds calibrated cost tables.

```bash
VLLM_USE_V2_MODEL_RUNNER=1 vllm serve Qwen/Qwen3.8-27B \
  --attention-backend CUSTOM --linear-backend flashinfer_cutedsl \
  --speculative-config '{"method": "eagle_harness", "model": "EAGLE-Corp/Qwen3.8-27B-EAGLE4", "method_config": {"mode": "static", "node_top_k": 4, "tree_depth": 14, "max_verify_width": 16}}'
```

## When to use it

- Reach for it when you serve Qwen3.8-27B on SGLang, vLLM or TokenSpeed and want lower per-request latency without swapping engines
- Reach for it when fixed-shape speculative decoding helps at low load but slows you down at high concurrency, and you want the tree sized per batch from measured costs
- Reach for it to benchmark adaptive speculative decoding on NVIDIA B300 or AMD MI355X hardware against the same engine without speculation
- Reach for it as the successor to the EAGLE-3 line when your licence terms allow source-available software

## Version history

- 2026-10-23 v0.1.2: On SGLang, batches are decoded without speculation wherever that is faster, so the high-load recipe keeps pace with plain decoding up to 512 concurrent requests on four B300 GPUs; vLLM calibration completes on hybrid targets.
- 2026-10-20 v0.1.0: First tagged release of eagle-harness: an out-of-tree SGLang and vLLM plugin serving EAGLE-4 drafts, with cost tables that set the draft depth and verify width.
