Introduction
The inference phase of Large Language Models (LLMs) is notoriously bottlenecked by the autoregressive nature of token generation. Because each token must be predicted sequentially, the process is computationally inefficient, particularly for long-context tasks. Speculative Decoding (SD) has emerged as a promising solution, utilizing a smaller "draft" model to propose multiple tokens that a larger "target" model verifies in parallel.
However, traditional SD approaches face significant hurdles. Training-based methods like EAGLE or Medusa require specialized draft models that are costly to develop and maintain. Conversely, training-free retrieval-based methods often suffer from poor alignment between the draft candidates and the target model’s distribution, leading to low acceptance rates and minimal speed gains. This paper introduces Alignment-Augmented Speculative Decoding (AASD), a training-free, plug-and-play algorithm designed to bridge this alignment gap and accelerate inference by up to 2.23x.
The AASD Framework
AASD addresses the limitations of existing speculative decoding through two novel components: Alignment Sampling and Conditional Verification.
1. Alignment Sampling
In long-context scenarios such as Retrieval-Augmented Generation (RAG) or summarization, the input prompt often contains the very tokens the model needs to generate. AASD treats the prompt as a high-quality, zero-cost source for drafts. During the initial "prefilling" phase—when the model processes the prompt—AASD saves the output probability distributions.
When retrieving n-grams from the context to serve as drafts, AASD uses these saved distributions to sample additional likely tokens. This process expands a linear sequence into a "draft tree." By injecting the target model's intent into the drafting process without additional training, AASD significantly increases the likelihood that the draft tree contains the tokens the target model would have selected.
2. Conditional Verification
Standard speculative decoding typically employs a strict "exact-match" verification process, which can be overly rigid. AASD introduces an entropy-based adaptive probability threshold to verify tokens more flexibly.
- Low Entropy (High Confidence): When the target model is highly certain about the next token, the threshold remains strict.
- High Entropy (Uncertainty): When the model is uncertain, the threshold relaxes. This allows the system to accept high-quality draft tokens from the prompt context that are semantically valid, even if they aren't the absolute top-1 prediction. This "non-strict" approach improves context utilization and boosts both speed and accuracy.
Experimental Evaluation
The authors evaluated AASD across eight datasets covering three distinct long-context domains: Question Answering (NQ, TriviaQA, 2WikiMQA, HotpotQA), Summarization (Multi-News, GovReport), and Code Completion (RepoBench-P, LCC). General efficiency was further tested using the SpecBench benchmark.
Key Results
- Acceleration: AASD achieved a generation speedup of up to 2.23x on LLaMA3-8B and 1.74x on Qwen2.5-32B.
- Acceptance Rate: The Mean Acceptance Length (MAL) reached up to 2.39, indicating that the model generated nearly 2.4 tokens per forward pass on average.
- Accuracy Improvement: Uniquely, AASD does not just accelerate generation; it improves it. The average generation score increased by 3.3 points for LLaMA3, with the most significant gains observed in QA and code tasks where leveraging the input context is critical.
- Low Overhead: The retrieval and sampling overhead is negligible, representing less than 5% of the total time cost per step for an 8B parameter model.
Discussion and Insights
The success of AASD highlights that the input prompt is a "goldmine" for drafting in long-context tasks. By focusing on alignment rather than just model size, AASD demonstrates that even training-free methods can outperform complex trained draft models if they effectively capture the target model's distribution. Furthermore, using information entropy as a guide for verification allows the model to be flexible exactly when it needs to be, turning model uncertainty into an opportunity for acceleration.
Limitations and Future Work
While AASD provides significant gains, the authors note that relaxed verification could potentially lead a model to accept biased or harmful information if such content exists within the input context. Future work will need to address safety alignment for these non-strict verification methods. Additionally, while AASD excels in long-context scenarios, its benefits are less pronounced in short-form generation where the prompt provides fewer drafting opportunities. Expanding alignment sampling to external databases could further generalize the method's utility.
Conclusion
Alignment-Augmented Speculative Decoding (AASD) represents a significant step forward in efficient LLM inference. By combining alignment-aware sampling with adaptive verification, it provides a training-free path to both faster and more accurate model generation, particularly for the increasingly important domain of long-context applications.
Summary updated