TLDR: AdaSPEC is a novel method that enhances Speculative Decoding (SD) for Large Language Models (LLMs) by employing selective Knowledge Distillation (KD). Instead of attempting to distill all knowledge, AdaSPEC uses a reference model to identify and filter out ‘difficult-to-fit’ tokens, allowing the draft model to focus its limited capacity on ‘easier’ tokens. This targeted approach significantly improves the token acceptance rate (up to 15% higher than state-of-the-art DistillSpec) and overall inference speed (10-20% speed-up) across diverse tasks and model configurations, without compromising generation quality.
Large Language Models (LLMs) have transformed natural language processing, achieving remarkable performance across a wide array of tasks, from complex reasoning to creative generation. However, their increasing size and complexity lead to significant computational challenges, particularly slow inference speeds and high latency during generation. This has spurred a critical need for methods that can maintain the high performance of LLMs while drastically improving their efficiency.
One promising solution is Speculative Decoding (SD), a technique that accelerates LLM inference without compromising quality. SD works by employing a smaller, lightweight ‘draft’ model to quickly generate a sequence of candidate tokens. These predictions are then efficiently verified by the larger, more powerful ‘target’ model. The core idea is to reduce the number of expensive forward passes required by the large model, thereby speeding up the overall generation process.
The effectiveness of Speculative Decoding heavily relies on how well the draft model’s predictions align with the target model’s output. Traditionally, this alignment is enhanced through Knowledge Distillation (KD), where the smaller draft model learns from the larger target model. However, conventional KD methods often try to make the draft model mimic the target model’s behavior across all tokens, which isn’t always the most efficient approach for SD. Draft models have limited capacity, and trying to learn every nuance from a much larger model can lead to suboptimal performance, especially on tokens that are inherently difficult to predict accurately.
Introducing AdaSPEC: Selective Knowledge Distillation
To address these limitations, researchers have proposed AdaSPEC, a novel method that incorporates selective token filtering into the Knowledge Distillation process. AdaSPEC’s primary goal is to train a draft model that better aligns with the target model on tokens that are easier to learn and more likely to be accepted, thereby maximizing the token acceptance rate without sacrificing the quality of the generated text.
AdaSPEC operates in two key phases:
1. Reference Model Distillation and Token Filtering: First, a ‘reference model’ (initialized as a copy of the draft model) is trained using the target model as its teacher. This reference model then plays a crucial role as a ‘token filter.’ It identifies tokens that are particularly difficult for smaller models to predict accurately by comparing perplexity differences between itself and the draft model on the training data. These are the ‘hard’ tokens.
2. Selective Draft Model Distillation: In the second phase, the actual draft model undergoes distillation, but with a crucial difference: it uses a filtered dataset. The previously identified ‘hard’ tokens are removed, allowing the draft model to concentrate its limited learning capacity on mastering the remaining, more manageable ‘easy’ tokens. This strategic focus ensures that the draft model’s resources are utilized most effectively, leading to better alignment with the target model where it matters most for SD.
Performance and Results
The researchers evaluated AdaSPEC across a diverse range of tasks, including arithmetic reasoning (GSM8K), instruction-following (Alpaca), coding (MBPP), and summarization (CNN/Daily Mail, XSUM). They used two main model configurations: a smaller Pythia-31M draft model with a Pythia-1.4B target model, and a CodeGen-350M draft model with a Phi-2 target model. AdaSPEC was benchmarked against DistillSpec, a state-of-the-art method for SD.
The results consistently demonstrated AdaSPEC’s superior performance. It achieved significantly higher token acceptance rates across all tasks and model configurations, with improvements of up to 15% compared to DistillSpec. This indicates a much better alignment between the draft and target models. Further analysis showed that AdaSPEC led to more confident correct predictions (higher positive logit margins) and fewer severe prediction errors (lower negative logit margins). It also resulted in consistently lower Kullback-Leibler (KL) divergence values, signifying a tighter alignment between the draft and target model predictions.
Case studies revealed that AdaSPEC’s prediction errors were often a subset of DistillSpec’s errors, particularly on tasks like arithmetic reasoning where it selectively focused on mathematical tokens. Ablation studies confirmed that AdaSPEC’s token selection mechanism is indeed effective, with models trained on the top 40% of learnable tokens outperforming those trained on the bottom 40%.
Beyond acceptance rates, AdaSPEC also showed tangible real-world benefits. When integrated with the vLLM inference engine on an A100 GPU, AdaSPEC achieved an expected 10-20% speed-up in generation compared to DistillSpec. The method also proved scalable to larger models (e.g., Qwen2.5-0.5B/32B) and demonstrated orthogonality with advanced SD algorithms like EAGLE, further improving both accuracy and decoding efficiency within those frameworks.
Also Read:
- Optimizing LLM Fine-Tuning with Utility-Diversity Sampling
- Navigating the Performance Landscape of Reasoning Language Model Serving
Broader Impact
AdaSPEC represents a significant step forward in making LLM inference more efficient. By enabling the use of significantly smaller draft models while maintaining generation quality and boosting acceptance rates, it can lead to reduced computational costs and energy consumption for serving LLMs. The code for AdaSPEC is publicly available, fostering further research and development in this area. You can find more details about this research in the full paper: AdaSPEC: Selective Knowledge Distillation for Efficient Speculative Decoders.


