[Paper Review] SpecInfer: Accelerating Generative Large Language Model Serving with Tree-based Speculative Inference and Verification
This paper proposes Collie, a tree-based speculative inference framework that accelerates generative LLM serving by using multiple collectively fine-tuned small models (SSMs) to generate candidate tokens in parallel via tree-based decoding. It achieves up to 2.3x higher throughput and 2.1x lower latency than sequence-based baselines on LLaMA-30B, demonstrating significant speedup with minimal accuracy loss.
This paper introduces SpecInfer, a system that accelerates generative large language model (LLM) serving with tree-based speculative inference and verification. The key idea behind SpecInfer is leveraging small speculative models to predict the LLM's outputs; the predictions are organized as a token tree, whose nodes each represent a candidate token sequence. The correctness of all candidate token sequences represented by a token tree is verified against the LLM in parallel using a novel tree-based parallel decoding mechanism. SpecInfer uses an LLM as a token tree verifier instead of an incremental decoder, which significantly reduces the end-to-end latency and computational requirement for serving generative LLMs while provably preserving model quality. Our evaluation shows that SpecInfer outperforms existing LLM serving systems by 1.5-2.8x for distributed LLM inference and by 2.6-3.5x for offloading-based LLM inference, while preserving the same generative performance. SpecInfer is publicly available at https://github.com/flexflow/FlexFlow/
Motivation & Objective
- To address the latency and throughput bottlenecks in serving generative large language models (LLMs) at scale.
- To overcome the limitations of sequence-based speculative decoding, which suffers from high memory overhead and sequential dependency in candidate generation.
- To enable efficient, parallel speculative decoding using a tree-based structure that supports multiple candidate paths simultaneously.
- To improve serving efficiency without sacrificing generation quality through collective fine-tuning of small models (SSMs).
- To demonstrate scalability and performance gains across diverse sampling strategies (greedy, stochastic) and model sizes (LLaMA-7B, LLaMA-30B).
Proposed method
- Uses multiple small models (SSMs) collectively fine-tuned from a pre-trained LLaMA-160M model to generate speculative tokens in parallel.
- Employs a tree-based decoding structure that allows multiple candidate token sequences to be generated and verified simultaneously, reducing sequential dependency.
- Applies data parallelism across GPUs to serve multiple SSMs and tensor model parallelism to scale the LLM inference across four A10 GPUs.
- Implements a verification mechanism that checks the correctness of speculative tokens against the full LLM, rejecting incorrect paths and re-running only when necessary.
- Utilizes a cumulative distribution function (CDF) analysis to evaluate relative speedup and performance across different sampling strategies and model configurations.
- Employs batched inference with a batch size of 1 per GPU to evaluate end-to-end latency and throughput under real-world conditions.

Experimental results
Research questions
- RQ1Can tree-based speculative decoding outperform sequence-based approaches in terms of throughput and latency for LLM serving?
- RQ2How does the number of SSMs and their collective fine-tuning affect the speedup and accuracy of speculative inference?
- RQ3What is the impact of tree-based parallel decoding on memory overhead compared to sequence-based verification?
- RQ4How does the framework scale across different LLM sizes (e.g., LLaMA-7B vs. LLaMA-30B) and sampling strategies?
- RQ5To what extent can speculative decoding maintain generation quality while significantly accelerating inference?
Key findings
- Collie achieves up to 2.3x higher throughput and 2.1x lower latency than sequence-based speculative decoding on LLaMA-30B using four A10 GPUs.
- Tree-based decoding reduces memory overhead compared to sequence-based methods, enabling parallel serving of 8 requests, which sequence-based approaches cannot handle due to memory constraints.
- With greedy sampling, Collie’s throughput reaches 120 tokens per second, significantly outperforming the baseline.
- The framework maintains high generation quality, with minimal accuracy degradation despite speculative token generation.
- The use of multiple collectively boost-tuned SSMs leads to a 2.3x speedup in throughput and 2.1x reduction in latency compared to sequence-based baselines.
- CDF analysis confirms consistent performance gains across both greedy and stochastic sampling strategies on the Alpaca dataset.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.