HackerPapers

arXiv:2211.17192cs.LG

Fast Inference from Transformers via Speculative Decoding

Yaniv Leviathan, Matan Kalman, Yossi Matias

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.

arXiv comments
ICML 2023 Oral
Journal reference
DOI
Subjects
cs.LGMachine Learning cs.CLComputation and Language

On Hacker News

Linked by 8 identifiable commenters in 8 comments across 5 threads, from Jul 2025 to Jun 2026. Found in 1 HN submission from Sep 2023 to Sep 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments5 threads

    • Title is bad, it's the first line of the abstract instead of the paper title. Speculative decoding for LLM inference was published in 2022: https://arxiv.org/abs/2211.17192 This paper seems to be an improvement to speculative decoding but I haven't read it yet.

      articlepanView on HNParent context

    • Is this newer/better than the speculative decoding from 2022? https://arxiv.org/abs/2211.17192

      xnxView on HNParent context

    • >publish these incredible papers explaining how they achieved their gains - something the American labs no longer do unfortunately. Google is still releasing a lot of llm architecture research. They introduced speculative decoding of LLMs in 2022[1], then released the code to…

      sigmarView on HNParent context

    • similar idea, but the failure mode is better. a branch mispredict burns cycles. a bad guess here usually just means no bonus tokens. https://arxiv.org/abs/2211.17192

      Lihh27View on HNParent context

    • Good analysis. That's surprising. I always heard that the draft model doesn't affect the output in any way. It seems they do it like this to achieve faster generation. It would be interesting to investigate how this affects the output. Edit: I haven't gone through all the code…

      Klaus23View on HNParent context

    • Speculative decoding doesn't degrade output quality. The distribution it produces is exactly the same if you do it correctly. The original paper on it clearly talks about this. [0] Speculative decoding is the same as speculative execution on CPUs. As long as you walk back on an…

      kingstnapView on HNParent context

    • > Does this process work by having the main model compute the "probability" that it would generate the draft sequence, then probabilistically accepting the draft? It does the generation as normal using the draft model, thus sampling from the draft model's distribution for a…

      magicalhippoView on HNParent context

  1. Playing with Open Source LLMs 1 comment
    • While I'm always happy to see more people using open models, I was hoping the "playing" would be a bit more about actually interacting with the models themselves, rather than just running them. For anyone interested in playing around with the internals of LLMs without needing to…

      roadside_picnicView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.