NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Sequoia: Scalable and Robust Speculative Decoding

Zhuoming Chen, Avner May, Ruslan Svirschevski, Yuhsun Huang, Max Ryabinin, Zhihao Jia, Beidi ChenNeurIPS 2024

TL;DR

Sequoia is a scalable speculative decoding algorithm that uses dynamic programming to find the mathematically optimal "token tree" for guessing future text. By combining this optimal structure with a novel sampling-without-replacement verification method, it achieves up to 4.04× speedups on standard GPUs and a massive 9.5× speedup in memory-constrained "offloading" scenarios.

The Bottleneck in LLM Inference

Large Language Model (LLM) inference is notoriously slow because it is heavily "I/O bound." To generate a single token, the hardware must load every single parameter of the model from memory. Consequently, the GPU spends most of its time waiting for data rather than performing calculations.

Speculative decoding mitigates this by using a tiny "draft" model to guess several tokens ahead. The large "target" model then verifies these guesses in a single parallel batch. If the guesses are correct, multiple tokens are generated for the price of one memory load. However, existing speculative decoding methods struggle with two main issues:

  1. Scalability: As the speculation budget (number of guesses) increases, the benefits of current tree structures (like simple sequences or full k-ary trees) quickly plateau.
  2. Robustness: At low "decoding temperatures" (when the model is more deterministic), current algorithms often get stuck repeatedly guessing the same incorrect tokens, severely degrading efficiency.
Comparison of tree topologies and their scaling performance. Sequoia's optimal tree avoids the plateau seen in standard methods.

The Sequoia Approach: Methods & Innovations

The authors introduce two primary innovations to solve these bottlenecks:

1. Optimal Tree Construction via Dynamic Programming

Instead of relying on handcrafted tree shapes, Sequoia formulates tree construction as a constrained optimization problem: Given a budget of $N$ tokens, what tree structure maximizes the expected number of accepted tokens?

Using a Dynamic Programming (DP) algorithm, Sequoia searches the exponentially large space of possible tree topologies to find the one that perfectly fits the "acceptance rates" of the specific model pair. This allows performance to scale nearly logarithmically with tree size, rather than hitting a hard ceiling.

Illustration of Sequoia's dynamic programming approach to constructing an optimal token tree.

2. Sampling Without Replacement

To ensure the system remains robust across different temperatures, Sequoia modifies the verification step. Standard algorithms sample from the draft model with replacement, which can lead to redundant, incorrect guesses. Sequoia samples without replacement. If a token is proposed and rejected, the algorithm ensures it is never proposed again in that same step. This "never make the same mistake twice" approach guarantees high acceptance rates even at low temperatures.

Key Insights and Hardware-Awareness

  • The Scaling Law of Trees: The authors prove that while standard structures (like $k$ independent sequences) have a strict upper bound on how many tokens they can accept regardless of size, Sequoia’s trees are "unbounded"—their performance continues to grow as the tree gets larger.
  • Hardware-Aware Optimization: A bigger tree isn't always better; verifying a massive tree eventually slows down the target model due to compute constraints. Sequoia includes a hardware-aware optimizer that selects the "sweet spot" tree size and depth to maximize actual wall-clock speedup.
  • Power-Law Acceptance: Sequoia’s rejection rate follows a power-law relative to the number of speculated tokens, which is the theoretical key to its superior scaling.

Experimental Results

The researchers evaluated Sequoia across diverse benchmarks including C4, OpenWebText, CNN/DailyMail, and MT Bench, using combinations of Llama-2, Llama-3, and Vicuna models.

  • Standard Inference: On an NVIDIA A100 GPU, Sequoia sped up Llama2-7B by 4.04× and Llama2-13B by 3.73×.
  • Offloading (The "Killer App"): When running a model too large for the GPU's VRAM (e.g., Llama3-70B on a single L40 GPU), Sequoia achieved a staggering 9.5× speedup over state-of-the-art systems like DeepSpeed-Zero-Inference, reducing latency from 5.7 seconds/token to just 0.6 seconds/token.
  • Tree Efficiency: Sequoia trees generated up to 33% more tokens per decoding step compared to standard tree structures given the exact same token budget.

Limitations and Future Work

  • The Positional Assumption: The DP algorithm assumes that the probability of a token being accepted depends only on its position in the tree (e.g., "is it the 3rd child of the 2nd child?"). In reality, acceptance also depends on the specific text context, which the current model simplifies for computational feasibility.
  • Static vs. Dynamic Trees: Currently, the optimal tree is calculated "offline" before inference begins. Future work could explore dynamic trees that change shape in real-time based on the draft model's confidence in its ongoing guesses.
  • Setup Overhead: To achieve optimal results, users must first measure the "acceptance rate vector" for their specific model and dataset pair, adding a minor preparatory step before deployment.

Summary updated

BibTeX
@inproceedings{chen2024sequoia,
  author = {Zhuoming Chen and Avner May and Ruslan Svirschevski and Yuhsun Huang and Max Ryabinin and Zhihao Jia and Beidi Chen},
  title = {{Sequoia: Scalable and Robust Speculative Decoding}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=T9QltwzsP7},
}
Figure