about
Fast Inference from Transformers via Speculative Decoding (arxiv.org)
2 points by Jimmc414 on Sep 5, 2023 | hide | past | pdf | 2 comments on HN

In plain words: A small, fast model guesses several upcoming words at once, then the big model checks them in one pass and keeps only the ones it would have written. On a large text model this made generation 2 to 3 times faster with identical outputs.

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.

Yaniv Leviathan, Matan Kalman, Yossi Matias
arXiv:2211.17192 · cs.LG, cs.CL · submitted Nov 30, 2022 · updated May 18, 2023
abstract · pdf · html · ICML 2023 Oral

add comment on HN