Skip to main content
QUICK REVIEW

[Paper Review] DistillSpec: Improving Speculative Decoding via Knowledge Distillation

Yongchao Zhou, Kaifeng Lyu|arXiv (Cornell University)|Oct 12, 2023
Topic ModelingComputer Science4 citations
TL;DR

DistillSpec proposes knowledge distillation to improve speculative decoding by aligning a compact draft model with a larger target model, using on-policy generated data and task-specific divergence functions. This yields 10–45% speedups over standard speculative decoding and up to 6–10× latency reduction when combined with distillation of the target model first.

ABSTRACT

Speculative decoding (SD) accelerates large language model inference by employing a faster draft model for generating multiple tokens, which are then verified in parallel by the larger target model, resulting in the text generated according to the target model distribution. However, identifying a compact draft model that is well-aligned with the target model is challenging. To tackle this issue, we propose DistillSpec that uses knowledge distillation to better align the draft model with the target model, before applying SD. DistillSpec makes two key design choices, which we demonstrate via systematic study to be crucial to improving the draft and target alignment: utilizing on-policy data generation from the draft model, and tailoring the divergence function to the task and decoding strategy. Notably, DistillSpec yields impressive 10 - 45% speedups over standard SD on a range of standard benchmarks, using both greedy and non-greedy sampling. Furthermore, we combine DistillSpec with lossy SD to achieve fine-grained control over the latency vs. task performance trade-off. Finally, in practical scenarios with models of varying sizes, first using distillation to boost the performance of the target model and then applying DistillSpec to train a well-aligned draft model can reduce decoding latency by 6-10x with minimal performance drop, compared to standard decoding without distillation.

Motivation & Objective

  • Address the challenge of achieving high acceptance rates in speculative decoding by improving alignment between draft and target language models.
  • Overcome the limitation of standard knowledge distillation, which optimizes for downstream task performance rather than distributional alignment for speculative decoding.
  • Systematically investigate design choices—data generation strategy and divergence function selection—that impact draft model quality and compatibility with the target model.
  • Enable fine-grained control over the latency vs. performance trade-off by combining DistillSpec with lossy speculative decoding.
  • Develop a practical inference pipeline that first distills a large model into a smaller target model, then applies DistillSpec to train a highly compatible draft model.

Proposed method

  • Use on-policy data generation from the draft model to train the distillation objective, ensuring the student model learns from its own plausible completions.
  • Tailor the divergence function (e.g., KL divergence, cross-entropy) to the specific decoding strategy (greedy vs. non-greedy) and task, improving alignment with the target model’s output distribution.
  • Apply knowledge distillation to train a compact draft model that closely approximates the target model’s token and sequence-level distributions, even at the cost of reduced standalone task performance.
  • Integrate DistillSpec with lossy speculative decoding to allow controlled deviation from the target model distribution, enabling better latency-performance trade-offs.
  • Propose a two-stage pipeline: first distill a large model into a smaller, high-quality target model, then apply DistillSpec to train a well-aligned draft model for speculative decoding.

Experimental results

Research questions

  • RQ1How does on-policy data generation from the draft model affect the alignment between draft and target models in speculative decoding?
  • RQ2What is the optimal divergence function for knowledge distillation in speculative decoding, and how does it vary with decoding strategy (greedy vs. non-greedy)?
  • RQ3Can DistillSpec improve the acceptance rate and block efficiency of speculative decoding across diverse NLP tasks and model sizes?
  • RQ4How does combining DistillSpec with lossy speculative decoding affect the latency-performance trade-off compared to standard speculative decoding?
  • RQ5What is the most effective inference pipeline when multiple models of varying sizes are available—should distillation be applied before or after speculative decoding?

Key findings

  • DistillSpec achieves 10–45% speedup over standard speculative decoding across multiple benchmarks, including GSM8K, XSum, and CNNDM, using both greedy and non-greedy decoding.
  • Using on-policy generated data during distillation significantly improves draft-target alignment, leading to higher acceptance rates and block efficiency.
  • The optimal divergence function for distillation is highly dependent on the decoding strategy: KL divergence performs best under greedy decoding, while cross-entropy is more effective under non-greedy sampling.
  • Combining DistillSpec with lossy speculative decoding enables a flatter, higher-quality latency-performance trade-off curve, allowing for greater latency gains with minimal performance drop.
  • When applied in sequence—first distilling the target model, then applying DistillSpec to train the draft model—the method reduces decoding latency by 6–10× compared to standard decoding, with minimal performance degradation.
  • On GSM8K, DistillSpec achieves a 15% improvement in Rouge2 score and a 25% increase in block efficiency over standard speculative decoding when using non-greedy sampling and optimal hyperparameters.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.