Abstract
AdaSD (Adaptive Speculative Decoding) is a hyperparameter-free framework designed to accelerate Large Language Model (LLM) inference. By dynamically adjusting the number of tokens generated by a draft model and the strictness of the target model's verification process, AdaSD overcomes the limitations of fixed-length speculative decoding. Utilizing real-time feedback from token entropy and Jensen–Shannon distance, the framework achieves up to a 49% speedup over standard speculative decoding with minimal accuracy degradation (<2%), requiring no additional training or manual tuning.
Introduction
Large Language Models (LLMs) are fundamentally memory-bound during inference. The process of generating a single token requires loading billions of parameters from memory, a task that significantly outweighs the actual computation time. Speculative Decoding (SD) was introduced to mitigate this bottleneck by using a smaller "draft" model to predict a sequence of tokens, which a larger "target" model then verifies in parallel.
However, standard SD faces two primary challenges: determining the optimal draft length and setting appropriate acceptance criteria. If the draft is too long, resources are wasted on rejected tokens; if too short, the target model's parallel processing capabilities are underutilized. Furthermore, fixed thresholds for token acceptance often fail to account for varying task complexities, such as the difference between creative writing and logical reasoning. AdaSD addresses these issues by making speculative decoding an adaptive, "plug-and-play" system.
Methodology
AdaSD introduces a heuristic feedback mechanism that updates two critical thresholds in real-time during inference: the Generation Threshold ($T_G$) and the Verification Threshold ($T_V$).
Adaptive Thresholding Mechanisms
- Generation Threshold ($T_G$): This threshold utilizes Entropy to quantify the draft model's uncertainty. High entropy suggests a higher likelihood of error. AdaSD monitors the entropy of previously rejected tokens and sets $T_G$ to their average. If a draft token's entropy exceeds this threshold, the draft model halts generation and passes control to the target model.
- Verification Threshold ($T_V$): This uses Jensen–Shannon (JS) Distance to measure the divergence between the probability distributions of the draft and target models. Unlike metrics like KL Divergence, JS distance is bounded (0 to 1), providing a stable basis for thresholding. AdaSD sets $T_V$ as the midpoint between the average JS distance of previously accepted and rejected tokens.
Experimental Setup
The authors evaluated AdaSD across three diverse benchmarks to capture various reasoning requirements:
- GSM8K: Grade school-level math problems requiring logical steps.
- HumanEval: Programming tasks requiring high precision.
- MMLU: A multitask benchmark covering 57 subjects to test general knowledge.
The framework was tested using state-of-the-art models, including Llama 3.1 (1B, 8B, and 70B) and Qwen 2.5 (7B and 72B).
Key Insights and Analysis
A critical finding of the research is the efficacy of JS Distance as a verification metric. Traditional metrics like Cross-Entropy can become unstable if the draft model predicts a token that the target model deems impossible. JS Distance provides a normalized separation that clearly distinguishes between high-quality and low-quality draft guesses.
By employing the "midpoint" heuristic for $T_V$, the system maintains a conservative yet efficient balance. This task-awareness allows the model to naturally become more cautious during difficult reasoning steps and more speculative during predictable text sequences, all without requiring task-specific fine-tuning.
Results
AdaSD demonstrated significant performance gains across the tested benchmarks:
- Throughput Gains: The framework achieved a 23% to 49% higher throughput compared to standard speculative decoding on Llama models.
- Accuracy Preservation: Despite the adaptive relaxation of verification criteria, accuracy loss remained under 2% across all tasks.
- Comparative Performance: AdaSD outperformed Hugging Face’s Assisted Generation by approximately 10% in speed on math and coding tasks while maintaining comparable accuracy levels.
- Task Sensitivity: While gains on MMLU were more modest (~8%) due to the short output nature of multiple-choice questions, the framework consistently improved efficiency where longer generation sequences were possible.
Conclusion and Future Work
AdaSD provides a robust, training-free method for accelerating LLM inference. Current limitations include the requirement for draft and target models to share an identical vocabulary, which can be a constraint for certain model pairings. Future research may explore incorporating additional indicators, such as hidden state activations, to further refine generation stopping and investigate more sophisticated threshold adjustments for safety-critical applications.
Summary updated