Papers › Fast Inference from Transformers via Speculative Decoding

Fast Inference from Transformers via Speculative Decoding

30 Nov 2022arXiv:2211.17192archive 2025-07-28

Yaniv Leviathan, Matan Kalman, Yossi Matias

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2211.17192")

Code

Syntology Ran 12 of 21 code samples harvested from 4 repositories linked to this paper; 9 have no recorded run. Of those that ran: 7 ran · our draft was wrong; 2 ran · fixture could not drive it; 3 ran with no contract checked.

By repository: community (archive-listed): 21 samples from 4 repositories, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ericlbuehler/mistral.rs mentioned on GitHubMIT report
feifeibear/llmspeculativesampling mentioned on GitHubpytorch report
huggingface/distil-whisper mentioned on GitHubpytorch report
lucidrains/speculative-decoding mentioned on GitHubpytorch report
niyunsheng/ems-sd mentioned on GitHubpytorchApache-2.0 report
optimalscale/lmflow mentioned on GitHubpytorchApache-2.0 report
smart-lty/parallelspeculativedecoding mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

21 samples harvested; 12 ran; 0 honoured the contract we drafted; 9 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

7ran · our draft was wrong
2ran · fixture could not drive it
3ran
9unverified

Licence: 6 of the 21 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 4 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

KVCacheModel feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) ran Apache-2.0 (permissive) · b8211819644d71f6 · report
find_first_true_index lucidrains/speculative-decoding/speculative_decoding/speculative_decoding.py community (archive-listed) ran MIT (permissive) · ef39dd586a82a156 · report
max_fn feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · d5c48d2733f29ebb · report
norm_logits feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · c9dd1e87e985a33c · report
norm_logits smart-lty/parallelspeculativedecoding/src/engine.py community (archive-listed) ran · our draft was wrong fingerprinted no licence file found · pointer only · ea7422602cf8d39a · report
safe_div lucidrains/speculative-decoding/speculative_decoding/speculative_decoding.py community (archive-listed) ran fingerprinted MIT (permissive) · 806a4b61f4218c4b · report
sample feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · d433f14ebfd69413 · report
sample smart-lty/parallelspeculativedecoding/src/engine.py community (archive-listed) ran · our draft was wrong fingerprinted no licence file found · pointer only · ffa10e3a85932ece · report
speculative_decoding lucidrains/speculative-decoding/speculative_decoding/speculative_decoding.py community (archive-listed) ran · our draft was wrong MIT (permissive) · ce874c7fa5d31d78 · report
top_k lucidrains/speculative-decoding/speculative_decoding/speculative_decoding.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 3c61d89a5e42a3d3 · report
top_k_top_p_filter feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) ran · fixture could not drive it fingerprinted Apache-2.0 (permissive) · a391388e6c7e3baa · report
top_k_top_p_filter smart-lty/parallelspeculativedecoding/src/engine.py community (archive-listed) ran · fixture could not drive it fingerprinted no licence file found · pointer only · 025c3469ca2fb4c3 · report
Decoder feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) unverified Apache-2.0 (permissive) · 23abd23ad9a26aaf · report
Decoding smart-lty/parallelspeculativedecoding/src/engine.py community (archive-listed) unverified no licence file found · pointer only · 559f754be1db32cf · report
KVCacheModel smart-lty/parallelspeculativedecoding/src/engine.py community (archive-listed) unverified no licence file found · pointer only · c09397f1dfae4d19 · report
Singleton feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) unverified Apache-2.0 (permissive) · 49c7d0a8e1eaff77 · report
detect_dataframe ericlbuehler/mistral.rs/mistralrs-code-exec/python/executor.py community (archive-listed) unverified MIT (permissive) · 4fa98a77cb95f018 · report
detect_pil_image ericlbuehler/mistral.rs/mistralrs-code-exec/python/executor.py community (archive-listed) unverified MIT (permissive) · 905226f05e395d5f · report
extract_outputs ericlbuehler/mistral.rs/mistralrs-code-exec/python/executor.py community (archive-listed) unverified MIT (permissive) · c512e543f906b1ca · report
seed_everything smart-lty/parallelspeculativedecoding/src/engine.py community (archive-listed) unverified no licence file found · pointer only · 79fc1fb911ac4bf9 · report
speculative_sampling feifeibear/llmspeculativesampling/sampling/speculative_sampling.py community (archive-listed) unverified Apache-2.0 (permissive) · eb5f131d8785dd2d · report

Tasks

Language ModelingLanguage Modelling

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections