EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty

Yuhui Li, Fangyun Wei, Chao Zhang, Hongyang Zhang

Introduction

Autoregressive decoding in Large Language Models (LLMs) is inherently slow due to its sequential nature, generating tokens one by one. Speculative sampling has emerged as a promising solution, utilizing a smaller "draft" model to propose sequences that a larger "target" model verifies in parallel. However, existing methods often face a "Goldilocks" problem: small draft models are often too inaccurate (low acceptance rates), while larger ones introduce excessive computational overhead. EAGLE (Extrapolation Algorithm for Greater Language-model Efficiency) addresses these challenges by shifting the drafting process from discrete tokens to continuous feature vectors.

The EAGLE Framework

EAGLE introduces a lightweight speculative sampling framework that achieves significant speedups while remaining mathematically lossless. Its design is centered on three core innovations:

Feature-Level Autoregression

Traditional draft models predict discrete token IDs. EAGLE instead predicts the second-to-top-layer features (hidden states). These continuous vectors exhibit greater regularity than discrete tokens, making them easier for a lightweight head to extrapolate accurately. By predicting in this feature space, the draft model can more effectively mimic the target model's internal state.

Resolving Uncertainty with Shifted Tokens

A primary bottleneck in speculative sampling is the uncertainty of the sampling process. The next feature $f_{i+1}$ depends heavily on the specific token $t_i$ sampled from the distribution at step $i$. EAGLE resolves this by feeding the sampled token from one time step ahead back into the draft model. This "shifted token" input synchronizes the draft model with the target model's specific sampling path, effectively telling the draft model which branch of the probability tree it is currently on.

The EAGLE architecture: Feature-level autoregression and tree-structured drafting.

Lightweight Architecture and Tree Drafting

The draft model is a simple "plug-in" consisting of the base LLM's own embedding layer and LM head, with just one additional Transformer decoder layer acting as the bridge. To further improve acceptance rates, EAGLE employs tree-structured drafting, exploring multiple potential paths simultaneously rather than a single linear chain. This increases the probability that the target model will find a valid path to accept during the verification phase.

Key Results

EAGLE demonstrates state-of-the-art performance across various benchmarks, including MT-bench, HumanEval, and GSM8K, using models like Vicuna and LLaMA2-Chat.

Speedup comparison of EAGLE against other speculative sampling methods across various LLaMA-based models.
  • Significant Acceleration: On LLaMA2-Chat 70B, EAGLE achieves a 2.7x to 3.5x latency speedup and doubles throughput.
  • Superior Efficiency: It outperforms existing methods like Lookahead and Medusa by significant margins (up to 2.1x and 1.6x respectively).
  • Lossless and Robust: EAGLE is provably lossless for both greedy (temperature=0) and non-greedy (temperature>0) settings, maintaining the exact output distribution of the target model.
  • Training Efficiency: A draft head for a 70B model can be trained in just 1-2 days on 4x A100 GPUs, demonstrating high zero-shot generalization as it was not trained on the evaluation datasets.

Discussion and Future Work

While EAGLE provides substantial gains, its performance on Mixture-of-Experts (MoE) models like Mixtral 8x7B is more constrained (1.5x) due to memory bandwidth bottlenecks when activating multiple experts during verification. Future research may focus on optimizing tree structures for specific hardware and further reducing the VRAM overhead associated with maintaining feature vectors and tree attention during the drafting process.

Summary updated

BibTeX
@inproceedings{li2024eagle,
  author = {Yuhui Li and Fangyun Wei and Chao Zhang and Hongyang Zhang},
  title = {{EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=1NdN7eXyb4},
}
Figure