Introduction
Large Language Models (LLMs) have transformed natural language processing, yet their deployment in production remains constrained by the latency of auto-regressive generation. Speculative decoding has emerged as a promising solution, utilizing a lightweight "draft" model to predict multiple future tokens that are subsequently verified by a larger "base" model in a single parallel step. However, transitioning speculative decoding from research environments to high-traffic production systems introduces an "engineering wall." At scale, increasing batch sizes and communication overhead between hardware components often negate the theoretical speedups.
Meta’s GenAI and Infra teams have addressed these challenges by optimizing EAGLE-based speculative decoding for Llama 3 and Llama 4 models. By integrating architectural refinements with aggressive systems engineering, they achieved a 1.4× to 2.0× speedup at scale, setting a new latency record for Llama 4 Maverick at approximately 4 ms per token.
Architectural and Training Optimizations
The effectiveness of speculative decoding depends heavily on the draft model's accuracy and speed. The team implemented several training-side optimizations to maximize the "Tokens Per Call" (TPC) metric.
Online Distillation and Weight Tying
Rather than training a standalone draft model, the authors utilized online distillation. The draft model is trained to predict both the base model’s hidden states and its logits simultaneously. To further improve efficiency and reduce the parameter footprint, weight tying was implemented between the embedding and LM head layers of the base and draft models.
The Dense Draft Advantage
While many modern LLMs, including Llama 4 Maverick, utilize Mixture-of-Experts (MoE) architectures, the researchers discovered a "sweet spot" for draft models: a 3-layer dense Feed-Forward Network (FFN). Despite the base model's complexity, a dense draft model proved more efficient, utilizing 10× fewer parameters while maintaining high prediction accuracy. Furthermore, moving the draft model's FFN to INT4 quantization provided an optimal trade-off between execution speed and guess quality compared to higher-precision formats like FP8 or BF16.
Systems Engineering for Inference
To translate training gains into production performance, the team overhauled the inference stack to eliminate hardware bottlenecks.
- Optimized Tree Attention: Managing non-sequential tokens in a "draft tree" often incurs overhead. The team split attention into a mask-free "prefix" (the prompt) and a masked "suffix" (speculated tokens), allowing for more effective use of hardware-specific kernels like Flash Attention v3.
- Latency Hiding: A major bottleneck identified was unnecessary synchronization between the CPU and GPU. By restructuring the decoding cycle to overlap CPU bookkeeping and result transmission with GPU kernel execution, the team achieved a GPU utilization rate of 94%.
- Dynamic Tree Dispatching: Because different tree shapes (e.g., wide trees vs. deep chains) perform differently depending on traffic, a dynamic dispatcher was implemented to select the optimal tree structure based on current batch sizes.
- Disaggregated Inference: The system separates the "prefill" phase (initial prompt processing) from the "decode" phase (token generation) onto different hardware hosts, maximizing overall throughput.
Experimental Results
The optimized system was evaluated against both public benchmarks (MT-Bench) and internal Meta datasets designed to simulate real-world production stress.
As shown in the performance data, the optimized EAGLE implementation consistently outperforms standard engines. For Llama 4 Maverick, the system achieved a decoding speed of ~4 ms per token on 8 NVIDIA H100 GPUs, representing a 10% improvement over previous state-of-the-art methods. Notably, while speculative decoding speedups typically degrade as batch sizes increase, the use of the Tree Dispatcher allowed the system to maintain a 1.4× to 2.0× speedup even under heavy production loads. Compared to the widely used vLLM library, this implementation is 10–30% faster at a batch size of one.
Conclusion
By bridging the gap between theoretical speculative decoding and production-scale requirements, Meta has demonstrated that LLM latency can be significantly reduced without sacrificing model quality. The combination of dense draft models, online distillation, and meticulous CPU-GPU synchronization hiding provides a blueprint for deploying next-generation Llama models in high-demand environments. Future work will focus on integrating these optimizations into open-source frameworks to benefit the broader AI research community.
Summary updated