Abstract
Large Language Model (LLM) inference is often bottlenecked by its auto-regressive nature, requiring a full forward pass for every token generated. While Speculative Decoding (SD) and Multi-Candidate Speculative Decoding (MCSD) offer potential speedups by using a small draft model to predict future tokens, they suffer from a "distribution gap" where predictions are frequently rejected by the larger target model. This paper introduces refinements to MCSD, including target-model initialization and dynamic masking, achieving up to a 27.5% speedup over existing speculative baselines.
Introduction
The sequential generation of tokens in LLMs is computationally expensive. Speculative Decoding mitigates this by employing a smaller, faster "draft" model to generate a sequence of candidate tokens, which are then verified in parallel by the larger "target" model. However, the effectiveness of this approach is limited by the draft model's accuracy. When the draft model's predictions diverge from the target model's distribution, candidates are rejected, leading to wasted computation and diminished speed gains.
Standard MCSD attempts to improve this by generating multiple candidate sequences in a tree structure, but it still relies on the draft model to initiate these sequences. Furthermore, managing the complex attention masks required for tree-based verification introduces significant overhead.
Methodology
To address these challenges, the authors propose three key innovations to make MCSD more flexible and accurate:
1. Target Model Initialized Generation
The core innovation involves shifting the starting point of candidate generation. Instead of the draft model initiating the guess tree from scratch, the target model provides several high-probability tokens during its own verification phase. These tokens serve as the roots for the draft model's subsequent predictions. By starting from a foundation already "approved" by the target model, the acceptance rate of the generated candidates increases significantly.
2. Dynamic Sliced Topology-Aware Causal Mask
Verifying multiple sequences simultaneously requires specialized "tree attention" masks. Traditional masks are often static and complex to compute. The authors developed a "sliced" mask that allows for dynamic adjustment of draft sequence lengths on the fly without recomputing the entire mathematical structure of the attention mechanism. This flexibility reduces the computational burden of reconfiguring the attention mechanism for different tree topologies.
3. Early Stop Decision Model
To further optimize the process, a lightweight Multi-Layer Perceptron (MLP) was developed to act as an "early stop" mechanism. This model analyzes the draft model's internal states and output entropy to estimate the likelihood of the target model accepting a given token. If the predicted acceptance probability falls below a certain threshold, the system triggers an early stop to save time.
Experimental Setup
The proposed methods were evaluated using Llama 2-7B and Vicuna-7B as target models. Two draft models were tested: JackFram 68M and TinyLlama-1.1B. Performance was measured across three diverse benchmarks: TriviaQA (factual knowledge), Alpaca (instruction following), and MT-Bench (multi-turn dialogue).
Results and Discussion
The refined MCSD approach demonstrated substantial performance gains:
- Speedup: The method achieved a maximum speedup of 27.5% over the standard MCSD baseline and was up to 1.90x faster than vanilla auto-regressive inference.
- Acceptance Rate Improvement: Target-model initialization led to a marked increase in the acceptance rate ($\alpha$). On MT-Bench, the rate improved from 0.29 to 0.47.
- Trade-offs: While target-model initialization improves speed, there is a minor trade-off with output quality if too many tokens are initialized. Additionally, the choice of draft model presents a classic trade-off: TinyLlama-1.1B offered higher accuracy but slower raw inference compared to the smaller JackFram 68M.
Interestingly, the Early Stop Decision Model did not consistently improve performance. The combined overhead of the MLP inference and the cost of the target model needing to "fill in" prematurely stopped sequences often neutralized the theoretical gains.
Conclusion
Refining Multi-Candidate Speculative Decoding through target-model initialization and dynamic masking provides a significant boost to LLM inference efficiency. While the early-stop mechanism requires further refinement to overcome its overhead, the core improvements in candidate initialization and mask management offer a robust path forward for faster LLM deployment. Future research will likely focus on finding "smarter" decision models with near-zero overhead or exploring alternative tree shapes.
Summary updated