TL;DR
TurboSpec is a closed-loop control system that dynamically optimizes Large Language Model (LLM) serving by balancing batching (inter-request parallelism) with speculative decoding (intra-request parallelism). By introducing a new metric called goodput and using real-time feedback to adjust speculation length, it achieves up to a 3.16x speedup while remaining robust against varying traffic loads and dataset shifts.
What Problem Does This Paper Address?
Efficient LLM serving is notoriously difficult because token generation is inherently sequential—each token depends on the one before it. To maximize GPU utilization, serving systems typically use batching (inter-request parallelism). However, batching is often limited by low request rates or memory constraints.
Speculative decoding offers a solution by using a small "draft" model to guess multiple tokens ahead, which a larger "target" model then verifies in parallel (intra-request parallelism). While promising, speculative decoding is "fragile." If the draft model is inaccurate, or if the system is already heavily loaded, the overhead of speculation can actually degrade performance. Current systems rely on manually tuned, static speculation lengths that fail to adapt to changing workloads.
Methods
The authors present TurboSpec, which treats speculation as a dynamic control problem. The system's "North Star" is Goodput, defined as the number of successfully generated tokens per unit of time (excluding rejected speculations).
TurboSpec employs a two-part estimator to maximize goodput in real-time:
- Offline Profiler: It builds a performance model using linear regression to predict execution latency based on batch size and context length.
- Online Adaptor: It tracks the historical token acceptance rate as feedback. By combining this with the latency model, it searches for the optimal speculation length ($k$) that maximizes expected goodput for the current batch.
The system is implemented on top of vLLM and includes specific optimizations like an adaptive threshold to disable draft model prefilling during high-load scenarios and a specialized CUDAGraph split to accelerate the verification phase.
Datasets
The authors evaluated TurboSpec across diverse workloads using the following datasets:
- ShareGPT: Represents general multi-turn chat with medium-length inputs and high-variance outputs.
- Sonnet: Focused on writing completion tasks.
- CNN/Daily Mail: Used for text summarization, characterized by long inputs and shorter outputs.
Evaluations were performed on NVIDIA H100 and L40S GPUs using the LLaMA-2 (7B, 13B, 33B) and LLaMA-3 (8B, 70B) model families, with Vicuna-160M often serving as the draft model.
Key Insights and Ideas
- The Inverse Relationship: TurboSpec reveals that optimal speculation length is inversely related to batch size. When the system has few requests (small batch), it should speculate aggressively. When the system is near capacity (large batch), it should reduce or even disable speculation to avoid wasted compute.
- Goodput vs. Throughput: Standard throughput is a deceptive metric for speculative decoding because it doesn't account for rejected tokens. Goodput provides a mathematically sound way to evaluate if speculation is actually helping.
- Amortizing Overhead: Speculative decoding works by amortizing static execution overhead (like memory accesses) across multiple tokens. TurboSpec identifies the "sweet spot" where this amortization outweighs the cost of the draft model.
Key Results
- Latency Reduction: TurboSpec achieved up to 3.16x speedup compared to non-speculative baselines.
- Robustness: In high-load scenarios where static speculation would typically cause a performance collapse, TurboSpec automatically reverted to standard decoding, maintaining ~0.97x baseline efficiency.
- Adaptability: The system successfully navigated "dataset shifts" (e.g., moving from high-accuracy Sonnet requests to lower-accuracy ShareGPT requests) by dynamically reducing speculation length to minimize wasted work.
- Low Overhead: The memory footprint for the draft model and its KV cache remained consistently below 4% of total memory usage.
Limitations and Future Work
While TurboSpec is highly effective, it currently relies on the availability of a suitable draft model or specific techniques like Prompt Lookup Decoding (PLD). The authors also note that while their linear regression model for latency is accurate for current setups, more complex hardware configurations might require more sophisticated performance modeling.
Future work could involve integrating TurboSpec with other optimization techniques like quantization (e.g., AWQ or GPTQ) or prefix caching to further push the boundaries of LLM serving efficiency.
Summary updated