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
Explore this link on the map →saved by
related reading
- Speculative Decoding - philkravphilkrav.com
- Speculative decodingaarnphm.xyz
- How to make LLMs go fastvgel.me
- Speculative Decoding - Deep Dive — ROCm Blogsrocm.blogs.amd.com
- Best practices to accelerate inference for large-scale production workloadstogether.ai
- Transformer inference tricks - by Finbarr Timbersartfintel.com
- Optimizing inference · Hugging Facehuggingface.co
- Composer2.pdfcursor.com
- Transformer Inference Arithmetic | kipply's blogkipp.ly
- The economics of speculative decoding | Doublewordblog.doubleword.ai
- DFlash: Block Diffusion for Flash Speculative Decoding - Z Labz-lab.ai
- Accelerating Generative AI with PyTorch II: GPT, Fast – PyTorchpytorch.org