Blogs / How Speculative Decoding Splits the Work Into Two Stages

How Speculative Decoding Splits the Work Into Two Stages

What a Hugging Face post says speculative decoding accelerates and what the draft model and the target model each do.

  • Learning
  • 1 min read

For: Learners who know what a large language model is.

What speculative decoding does

Speculative decoding is a popular technique to accelerate the inference of large language models, while preserving their accuracy.[1]

The first stage

In the first stage, a fast, but less accurate draft model (AKA assistant) autoregressively generates a sequence of tokens.[1]

Speculative decodingaccelerates inference whilepreserving accuracyFirst stagea fast, less accurate draftmodel generates tokensSecond stagea larger target modelverifies the draft tokensin parallelbegins withthen
What does each stage do?

The second stage

In the second stage, a large, but more accurate target model conducts parallelized verification over the generated draft tokens.[1]

Sources

  1. Faster Assisted Generation with Dynamic Speculation (huggingface.co · checked )

More articles