Fast Inference from Transformers via Speculative Decoding
Inference from large autoregressive models like Transformers is slow - decoding 𝐾 tokens takes 𝐾 serial runs of the model. In this work we introduce speculative decoding - an algorithm to sample from autoregressive models faster without any changes to the outputs, by computing several tokens in parallel. At the heart of our approach lie the observations that (1) hard language-modeling tasks often include easier subtasks that can be approximated well by more efficient models, and (2) using speculative execution and a novel sampling method, we can make exact decoding from the large models faster, by running them in parallel on the outputs of the approximation models, potentially generating several tokens concurrently, and without changing the distribution. Our method can accelerate existing off-the-shelf models without retraining or architecture changes. We demonstrate it on T5-XXL and show a 2X-3X acceleration compared to the standard T5X implementation, with identical outputs. La
Yaniv Leviathan Matan Kalman Affiliation: Google Research, Mountain View, CA, USA Yossi Matias Affiliation: Google Research, Mountain View, CA, USA Abstract Inference from large autoregressive models like Transformers is slow - decoding KK tokens takes KK serial runs of the model. In this work we introduce speculative decoding - an algorithm to sample from autoregressive models faster without any changes to the outputs, by computing several tokens in parallel. At the heart of our approach lie the observations that (1) hard language-modeling tasks often include easier subtasks that can…
saved by
related reading
- Fast Inference from Transformers via Speculative Decodingarxiv.org
- Fast Inference from Transformers via Speculative Decodingarxiv.org
- Looking back at speculative decodingresearch.google
- Matryoshka Language Model Suitesarxiv.org
- Speculative Decoding - philkravphilkrav.com
- Speculative Speculative Decodingarxiv.org
- Speculative Decoding: How It Evolved, When It Stays Lossless, and What's Nextneurips2026-speculative-decoding.vercel.app
- How speculative decoding makes LLMs go brrr – Leonie Monigattileoniemonigatti.com
- [2402.12374] Sequoia: Scalable, Robust, and Hardware-aware Speculative Decodingarxiv.org
- 2302.01318arxiv.org
- Decoding Speculative Decoding from First Principlesjwlabs.vercel.app
- All About Transformer Inferencejax-ml.github.io