FlowSpec: Continuous Pipelined Speculative Decoding for Efficient Distributed LLM Inference

Xing Liu, Lizhuo Luo, Ming Tang, Chao HuangarXiv 2025 · DOI

FlowSpec is a novel framework designed to accelerate Large Language Model (LLM) inference on resource-constrained edge devices by distributing workloads across multiple machines. By integrating pipeline parallelism with a continuous speculative decoding strategy, FlowSpec effectively utilizes idle hardware time, achieving up to a 1.73x speedup over existing methods, even under limited network bandwidth.

The Challenge of Distributed Edge Inference

Deploying large-scale LLMs on edge devices, such as smart home hubs or industrial sensors, presents significant challenges due to limited memory and processing power. To accommodate models like LLaMA-13B, the workload must be distributed across multiple devices.

Two primary distribution strategies are commonly used: Tensor Parallelism (TP) and Pipeline Parallelism (PP). TP splits individual layers across devices but requires high-frequency, low-latency communication, making it unsuitable for typical edge networks like Wi-Fi. PP, conversely, is more network-efficient as it passes data linearly through the model's layers. However, standard PP suffers from "pipeline bubbles"—significant idle periods where downstream devices wait for the previous stage to complete a single token generation.

Comparison of LLM inference strategies: Tensor Parallelism vs. Pipeline Parallelism. Note the "wait" states in standard PP for single requests.

FlowSpec Methodology

FlowSpec addresses these inefficiencies by leveraging Speculative Decoding (SD). In SD, a small "draft" model predicts multiple future tokens, which a larger "base" model then verifies in parallel. FlowSpec introduces three key innovations to optimize this for pipelined environments:

  1. Score-Based Step-Wise Verification: Rather than verifying tokens layer-by-layer, FlowSpec segments draft tokens into micro-batches based on confidence scores. This allows the pipeline to process and accept tokens further in the future much earlier.
  2. Continuous Drafting: Unlike traditional SD, which pauses for verification, FlowSpec maintains the draft model's operation in parallel with the base model's verification stages. Accepted tokens are immediately fed back to the draft model to refine subsequent predictions.
  3. Efficient Tree Pruning & Expansion: Guesses are organized into a "tree" of possibilities. FlowSpec implements a low-overhead pruning mechanism to discard incorrect branches across the pipeline and uses base model feedback to expand the tree with high-quality candidates.
Overview of the FlowSpec framework, including continuous speculative decoding and tree-based operations.

Experimental Results and Key Insights

The framework was evaluated using LLaMA2-Chat (7B & 13B) and Vicuna-v1.3 (7B & 13B) across six diverse benchmarks, including MT-bench (dialogue), HumanEval (coding), and GSM8K (math).

  • Significant Speedups: FlowSpec achieved speedup ratios between 1.37x and 1.73x compared to standard pipeline baselines. It consistently outperformed PipeDec, a state-of-the-art asynchronous framework, by 20-40%.
  • Network Resilience: While TP performance drops significantly (up to 60%) as bandwidth decreases to 125 Mbps, FlowSpec maintains over 90% of its throughput, demonstrating robustness in real-world edge environments where high-speed networking is rare.
  • Parallel Efficiency: By treating the speculative draft tree as a source of micro-batches, FlowSpec transforms sequential autoregressive decoding into a parallel workload that fits the pipeline architecture.

Limitations and Future Work

While effective, FlowSpec's performance remains dependent on the quality of the draft model. Poor predictions can lead to "cold starts" and reduced efficiency. Additionally, as the number of pipeline stages increases, linear growth in transmission overhead may eventually offset gains. Future research may explore hybrid parallelism techniques to scale FlowSpec to even larger models requiring extensive distribution across dozens of devices.

Summary updated

BibTeX
@misc{liu2025flowspec,
  author = {Xing Liu and Lizhuo Luo and Ming Tang and Chao Huang},
  title = {{FlowSpec: Continuous Pipelined Speculative Decoding for Efficient Distributed LLM Inference}},
  year = {2025},
  eprint = {2507.02620},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.02620},
}
Figure