RASD: Retrieval-Augmented Speculative Decoding

Guofeng Quan, Wenfeng Feng, Chuzhan Hao, Guochao Jiang, Yuewei Zhang, Hao Henry WangACL 2025

RASD (Retrieval-Augmented Speculative Decoding) is a novel framework designed to accelerate Large Language Model (LLM) inference. By integrating the predictive capabilities of small draft models with external datastore retrieval, RASD overcomes the traditional limitations of speculative decoding, such as domain gaps and drafting overhead. The framework achieves state-of-the-art speedups of up to 3x, particularly excelling in out-of-domain and specialized tasks.

The Challenge of Autoregressive Decoding

Large Language Models typically generate text one token at a time, a process known as autoregressive decoding, which is computationally expensive and slow. Speculative Decoding was introduced to mitigate this by using a smaller, faster "draft model" to predict a sequence of future tokens, which a larger "target model" then verifies in parallel.

However, this approach faces two primary bottlenecks:

  1. The Domain Gap: Small draft models often struggle with specialized domains (e.g., medical or legal text) where their training data is sparse, leading to low acceptance rates by the target model.
  2. Drafting Efficiency: Generating long sequences with a draft model can become a time-consuming process itself, potentially negating the speed gains from parallel verification.

Methodology: Fusing Generation and Retrieval

RASD addresses these issues by moving beyond pure model-based "imagination" to incorporate factual retrieval. The process is divided into three distinct stages:

1. Generation & Retrieval via Suffix Matching

Instead of relying solely on a draft model, RASD performs a suffix match against a datastore (such as a document database or previous context). If a match is found, the system retrieves the subsequent tokens as high-probability candidates for the next sequence.

2. Tree Pruning and Fusion

To prevent overwhelming the target model with too many candidates, RASD employs Retrieval Tree Pruning. It uses the draft model’s probability distribution to score and prune unlikely retrieved paths. The remaining candidates are then merged with the draft model’s own predictions using a Tree Fusion algorithm based on longest prefix matching. This creates a unified "super-tree" of potential continuations.

3. Verification

The target model verifies the fused tree in a single forward pass using tree attention, allowing it to evaluate multiple potential paths simultaneously.

The three-step RASD pipeline: Generation & Retrieval, Tree Pruning and Fusion, and Verification.

Experimental Results

The researchers evaluated RASD using Qwen2.5-14B and LLaMA3-8B across diverse benchmarks, including HumanEval (Code), CNN/Daily Mail (Summarization), and specialized tasks like MedQA and NL2SQL. EAGLE-2 served as the primary baseline for comparison.

Key Performance Metrics

  • Superior Speedups: RASD consistently outperformed EAGLE-2 and standalone retrieval methods. On the Qwen2.5-14B model, RASD achieved speedup ratios between 2.5x and 3.0x compared to standard autoregressive decoding.
  • Increased Acceptance Length: The average number of tokens accepted per pass increased significantly. For instance, on HumanEval with LLaMA3-8B, the acceptance length rose from ~3.3 tokens (EAGLE-2) to 3.55 tokens.
  • Domain Robustness: The retrieval component acts as a safety net, providing high-quality candidates even when the draft model is outside its training domain.
Comparison of Speedup Rates between RASD and Eagle2 across various tasks and retrieval methods.

Discussion and Future Directions

RASD demonstrates that combining retrieval with speculative decoding is a powerful strategy for LLM acceleration. The system is particularly effective in tasks like Document QA, where it can "copy-paste" segments directly from the input context via retrieval.

Despite its success, the authors note several areas for future work:

  • Parallelization: Currently, drafting and retrieval occur serially; parallelizing these could further reduce latency.
  • Adaptive Pruning: Moving from fixed hyperparameters to an adaptive pruning threshold based on real-time model confidence could optimize efficiency.
  • Memory Management: The increased KV cache requirements for tree attention remain a consideration for deployment on hardware with limited memory.

Summary updated

BibTeX
@inproceedings{quan2025rasd,
  author = {Guofeng Quan and Wenfeng Feng and Chuzhan Hao and Guochao Jiang and Yuewei Zhang and Hao Henry Wang},
  title = {{RASD: Retrieval-Augmented Speculative Decoding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-acl.320},
}
Figure