Dovetail: A CPU/GPU Heterogeneous Speculative Decoding for LLM inference

Libo Zhang, Zhaoning Zhang, Xubaizhou, Rui Li, Zhiliang Tian, Songzhu Mei, Dongsheng Li

Abstract

With the continuous advancement in the performance of large language models (LLMs), their demand for computational resources and memory has significantly increased, which poses major challenges for efficient inference on consumer-grade devices and legacy servers. These devices typically feature relatively weaker GPUs and stronger CPUs. Although techniques such as parameter offloading and partial offloading can alleviate GPU memory pressure to some extent, their effectiveness is limited due to communication latency and suboptimal hardware resource utilization. To address this issue, we propose Dovetail, a lossless inference acceleration method that leverages the complementary characteristics of heterogeneous devices and the advantages of speculative decoding. Dovetail deploys a draft model on the GPU to perform preliminary predictions, while a target model running on the CPU validates these outputs. By reducing the granularity of data transfer, Dovetail significantly minimizes communication overhead. Experimental results on 13B models demonstrate that Dovetail achieves inference speedups ranging from 1.79x to 10.1x across different devices, while maintaining consistency and stability in the distribution of generated texts.

Introduction: The VRAM Bottleneck

Running state-of-the-art Large Language Models (LLMs) usually requires high-end enterprise GPUs with massive amounts of Video RAM (VRAM). For example, a 7B parameter model needs about 14GB of VRAM just to load—far exceeding the capacity of common consumer cards like the NVIDIA RTX 2080 (8GB) or GTX 1050 (4GB).

Existing workarounds like offloading (storing weights in system RAM and swapping them into the GPU as needed) are painfully slow because the connection between the CPU and GPU (PCIe) is a massive bottleneck. Speculative decoding—where a small "draft" model guesses tokens and a large "target" model verifies them—is a proven accelerator, but it typically assumes both models live on the GPU. When the target model is forced onto the CPU, standard speculative decoding approaches collapse because CPU-based verification is significantly slower than GPU-based verification.

Methodology: The Dovetail Framework

The authors introduce Dovetail, named after the interlocking joint in carpentry, to seamlessly integrate CPU and GPU resources. Dovetail splits the workload: a "smart" draft model runs on the GPU while the heavy target model stays on the CPU.

Figure 1: High-level architecture of Dovetail, showing the Drafting Stage on GPU and Verification Stage on CPU.
  1. Heterogeneous Speculative Decoding: The draft model is deployed on the GPU (leveraging its speed for small-scale computation), while the target model runs on the CPU (leveraging large system RAM).
  2. Reduced Communication Granularity: Instead of transferring massive model weights or large feature blocks across the PCIe bus, Dovetail only transfers small sets of tokens and hidden states, drastically cutting latency.
  3. The "Smarter Draft" Strategy: Since CPU verification is slow, the authors realized it’s better to spend a little more time on the GPU to get better guesses rather than more guesses. They optimized the draft model by expanding it to 5–6 layers and introducing a Dynamic Gating Fusion (DGF) mechanism to intelligently weigh hidden states and token embeddings.

Key Insights: Quality Over Quantity

In traditional speculative decoding, the goal is to make the draft model as fast as possible. In a heterogeneous (CPU/GPU) setup, the bottleneck shifts to the CPU's parallel verification time. On a GPU, you might verify 60 tokens at once for "free." On a CPU, verifying 60 tokens is slow. Dovetail proves that using a deeper, "smarter" draft model to predict only 16 high-quality tokens is much faster than using a shallow model to predict 60 mediocre ones.

Experimental Results

The draft models were trained on the ShareGPT dataset. To prove Dovetail's versatility, the authors evaluated it across four major benchmarks: MT-bench, HumanEval, GSM8K, and Alpaca. Target models included LLaMA2-Chat (7B/13B) and Vicuna (13B).

Figure 2: Speedup comparison of Dovetail against various baselines across different hardware configurations.
  • Massive Speedups: On a GeForce RTX 3090, Dovetail achieved a 10.14x speedup for LLaMA2-13B compared to running the model on the CPU alone.
  • Low VRAM Requirement: The system can run a 7B model at ~5 tokens per second using only 3GB of VRAM, making LLMs viable on aging laptops and budget PCs.
  • Efficiency: Dovetail consistently outperformed other state-of-the-art methods like SpecExec and EAGLE-2 in heterogeneous environments, often by a margin of 1.5x to 2x.
  • Lossless: Because it uses speculative decoding, the output is mathematically identical to the original large model—there is no "quality loss" like you might see with aggressive quantization or pruning.

Conclusion and Future Work

Dovetail demonstrates that heterogeneous hardware can be effectively harnessed for LLM inference. While the generation of text is fast, the initial processing of a long prompt (the "pre-fill" stage) still happens on the CPU and remains a bottleneck for very long inputs. Future work will explore even more efficient ways to handle long-context scenarios and potentially using 4-bit or 8-bit quantization on the GPU draft model to save even more VRAM.

Summary updated

BibTeX
@misc{zhang2024dovetail,
  author = {Libo Zhang and Zhaoning Zhang and Xubaizhou and Rui Li and Zhiliang Tian and Songzhu Mei and Dongsheng Li},
  title = {{Dovetail: A CPU/GPU Heterogeneous Speculative Decoding for LLM inference}},
  year = {2024},
  eprint = {2412.18934},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.18934},
}
Figure