Fast Inference from Transformers via Speculative Decoding
Abstract:Inference from large autoregressive models like Transformers is slow - decoding K tokens takes K 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.
# link_2b77dn3n1rq.pdf ## Metadata - PDFFormatVersion=1.5 - IsLinearized=false - IsAcroFormPresent=false - IsXFAPresent=false - IsCollectionPresent=false - IsSignaturesPresent=false - Author=Yaniv Leviathan, Matan Kalman, Yossi Matias - CreationDate=D:20230522002613Z - Creator=LaTeX with hyperref - ModDate=D:20230522002613Z - Custom.PTEX.Fullbanner=This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) kpathsea version 6.3.2 - Producer=pdfTeX-1.40.21 - Trapped=False ## Contents ### Page 1 Fast Inference from Transformers via Speculative DecodingYaniv Leviathan * 1 Matan Kalman * 1 Y
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
- 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
- Matryoshka Language Model Suitesarxiv.org