Yggdrasil: Bridging Dynamic Speculation and Static Runtime for Latency-Optimal Tree-Based LLM Decoding

Yue Guan, Changming Yu, Shihan Fang, Weiming Hu, Zaifeng Pan, Zheng Wang, Zihan Liu, Yangjie Zhou, Yufei Ding, Minyi Guo, Jingwen Leng

Abstract

Generative Large Language Models (LLMs) often suffer from high inference latency due to their auto-regressive nature. Speculative decoding (SD) mitigates this by using a smaller drafter model to predict future tokens, which are then verified in parallel by a larger model. However, a significant performance gap exists between dynamic drafting algorithms and static compiler runtimes. This paper introduces Yggdrasil, a system that bridges this gap through a hardware-aware optimization objective, a novel "Equal-Growth Tree" (EGT) structure, and stage-based scheduling. Yggdrasil achieves up to a $3.98\times$ speedup on standard benchmarks without model modification.

Introduction: The Mismatch in Speculative Decoding

Generative LLMs are typically slow because they generate tokens one by one. Speculative Decoding (SD) addresses this by employing a fast "drafter" model to guess several future tokens, which a large "verifier" model then checks in parallel. Despite its potential, current SD implementations face a fundamental mismatch between algorithmic needs and system runtimes.

Comparison of (a) Algorithm-Centric, (b) Runtime-Centric, and (c) Yggdrasil approaches.

As shown in the figure above, drafting algorithms favor dynamic structures—adjusting the guess tree's shape based on context confidence. Conversely, modern deep learning compilers (e.g., TorchInductor) perform best with static graphs, requiring fixed tensor shapes to enable optimizations like CUDA Graphs and kernel fusion. Using dynamic algorithms on static runtimes sacrifices compiler speed, while forcing static algorithms on compilers reduces drafting accuracy. Yggdrasil is designed to provide the best of both worlds.

Methods: Harmonizing Algorithm and System

Yggdrasil introduces three primary innovations to resolve the dynamic-static conflict:

1. Latency-Aware Optimization Objective

Traditional SD research often focuses on "Average Accepted Length" (AAL), the average number of correctly predicted tokens. However, Yggdrasil argues that AAL is a poor proxy for actual speed. Instead, it employs a hardware-profiled objective that directly minimizes wall-clock latency. This accounts for the diminishing returns of verifying excessively wide token trees on GPUs.

2. Equal-Growth Tree (EGT)

The Equal-Growth Tree is the core structural innovation. To maintain compatibility with static graph compilation, EGT keeps operator shapes fixed. It uses a lightweight multi-head MLP to predict optimal drafting depth per context.

Comparison of various drafting structures, highlighting the Equal-Growth Tree.

As illustrated in the comparison of drafting structures, EGT provides a "skeleton" compatible with static graphs while allowing the algorithm to dynamically prune and select promising paths within that framework.

3. Stage-Based Scheduling

SD often suffers from "bubbles"—idle GPU time while the CPU manages tree logic. Yggdrasil rearranges decoding into discrete stages and utilizes "Ahead-of-Time" execution to overlap CPU management with GPU computation, effectively hiding coordination overhead.

Evaluation and Results

The system was evaluated using standard datasets (C4, Wikipedia, CNNDaily, Wikitest) with Llama-2-7B/13B as target models and Llama-68M/160M as drafters.

Key Insights

  • Hardware-Awareness is Essential: Maximizing accepted tokens can slow down inference if verification costs exceed time savings.
  • Static Structure with Dynamic Content: EGT proves that context-awareness does not require fully dynamic data structures.
  • CPU Bottlenecks: As GPU kernels accelerate, CPU logic becomes a major bottleneck, necessitating scheduling optimizations.

Performance Gains

Yggdrasil achieved up to a $3.98\times$ speedup over SpecInfer and consistently outperformed baselines like Sequoia and vLLM-Spec. Performance gains were notably higher on NVIDIA A100 GPUs ($3.37\times$ average) than on A40s ($2.76\times$), demonstrating superior utilization of high-end hardware capacity. Ablation studies showed that graph compilation alone, enabled by the EGT structure, contributed a $2.77\times$ speedup.

Limitations and Future Work

Yggdrasil currently focuses on single-request latency-optimal scenarios. It does not yet address high-throughput scenarios involving massive batching. Future research will explore extending Yggdrasil to handle joint optimization of latency and throughput in production-scale batched environments.

Summary updated

BibTeX
@inproceedings{guan2025yggdrasil,
  author = {Yue Guan and Changming Yu and Shihan Fang and Weiming Hu and Zaifeng Pan and Zheng Wang and Zihan Liu and Yangjie Zhou and Yufei Ding and Minyi Guo and Jingwen Leng},
  title = {{Yggdrasil: Bridging Dynamic Speculation and Static Runtime for Latency-Optimal Tree-Based LLM Decoding}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=4E3I17pNEl},
}
Figure