Back to list
Lv.3

Speculative Decoding

Speculative Decoding

A technique that speeds up AI text generation: a small AI writes a draft and a large AI checks it all at once.

In Simple Terms

Speculative Decoding is a technique where, when a generative AI writes text, a small AI quickly makes a draft ahead of time and a big AI checks the whole draft at once to finish the text. Normally, an AI thinks through words one at a time, in order, but with this approach it can lock in several words in a single step. It cuts the time it takes to reply by a lot without making the AI any less smart or lowering the quality of its text, and it's used on servers and similar systems.

Behind the Name

The word "speculative" means based on a guess rather than on certainty, and "decoding" is the step where an AI turns its internal calculations into actual words. Put together, the name describes a system that makes educated guesses about upcoming words ahead of time. The small AI speculates, and the big AI confirms. That's where the name comes from!

Take a Closer Look!

Speculative Decoding is a technique that speeds up text-generating AI: a lightweight helper AI predicts words ahead of time, and the main, large AI checks those predicted words all at once.
It's widely known as a way to raise computing efficiency and cut generation time without changing the quality of the AI's output at all.

A regular generative AI takes the text so far and calculates the next word, one word at a time, in order. That means no matter how powerful the computer is, it has to do a huge amount of calculation for every single word, which takes time.
So Speculative Decoding has a very light small model quickly write a draft a few words ahead. Then the main large model reads the whole draft in one go and, using its own calculation of how likely each word is, decides at the same time whether to accept each part of the draft.

If the large model accepts the draft, all of those words are used as they are. If a word along the way is rejected, the accepted part is kept, and the large model picks a replacement for only the first rejected word. The rest of the draft after that is thrown away, and the draft-and-check process restarts, with the small model writing a new draft.
Thanks to this trick, the number of generation steps needed each time text is generated drops a lot, while the output keeps the same probability distribution (in plain terms, the same odds for each possible word) as when the main AI generates on its own. It's used widely in large-scale serving systems as a core technique for making chat AI respond faster.