Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Fast Inference from Transformers via Speculative Decoding

About

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• 2022

Related benchmarks

TaskDatasetResultRank
Video UnderstandingMVBench--
247
Mathematical ReasoningGSM8K
Speed Up (x)2.82
177
Video UnderstandingLongVideoBench--
79
Instruction FollowingAlpaca
Speedup (x)1.3
63
Code GenerationHumanEval
Tokens/s171.8
61
Code GenerationHumanEval
Accuracy79.9
51
Code GenerationHumanEval
Average Tau (τ)5.39
45
Code GenerationCodeAlpaca
Average Speed-up1.63
41
Multi-round conversationMT-Bench
Tokens Per Second164.1
40
Mathematical ReasoningGSM8K v1 (test)
Accuracy93
35
Showing 10 of 40 rows

Other info

Follow for update