Skip to content
AI & Machine Learning Rich #speculative-decoding#inference

Speculative Decoding

A small draft model proposes tokens; the big model verifies in parallel. 2-3x throughput.

A free, animated speculative decoding you can read here or embed on any website, from Scrollchart.

Speculative Decoding

Speculative DecodingDraft model proposes k tokens; target verifies all k in one pass. First rejection rolls back. Typical 2-3x throughput gain.Draft model (small, fast)proposes k=5 tokens sequentiallydraft tok 1proposeddraft tok 2proposeddraft tok 3proposeddraft tok 4proposeddraft tok 5REJECTTarget model (large)verifies all k+1 tokens in ONE forward pass (parallel)1 forward pass (all k+1 positions batched)accept 4 / reject tok 5accaccaccaccrej -> resampleThroughput (tokens / sec, relative)Vanilla AR1xSpec decode(k=5, acc=80%)~2.6xAccept rate ~80% (Llama-3 70B + 8B draft)Gain scales with draft quality and kStep 1: draft proposes k tokens in k serial small-model callsStep 2: target evaluates all k+1 positions in ONE parallel forward passStep 3: accept token i if p_draft(i) / p_target(i) passes threshold; reject first failure, resampleStep 4: repeat. Accept rate ~80% for well-matched draft gives ~2-3x token throughputSpeculative decoding is lossless: accepted tokens are distributed identically to unmodified target sampling. Works with any temperature or top-p.

Draft model proposes k tokens. Target model evaluates all k in one parallel forward pass. Tokens are accepted while draft probabilities are within target distribution; first rejection rolls back and the target sample replaces. Effective accept rate and throughput gain plotted.

Good for

  • LLM inference optimisation explainers for ML engineers and AI product teams
  • Serving cost reduction case studies comparing speculative vs vanilla AR
  • Architecture deep dives on vLLM, TensorRT-LLM, and frontier inference stacks

Source & accuracy

This speculative decoding is an editorial illustration built to represent the concept accurately. Where it shows figures, they are typical or representative values chosen to make the relationship clear, not a single underlying dataset. The diagram and its explainer are reviewed and maintained centrally, and updated over time as understanding improves.

Draft-and-verify acceleration for LLM inference

Standard autoregressive generation requires the full model to process one token at a time, creating a latency bottleneck where each step depends on the previous output. Speculative decoding breaks this chain by running a smaller draft model in parallel with the main model. The draft model rapidly proposes the next 4-6 tokens, and the main model verifies them all at once in a single forward pass.

If the draft predictions match the main model's top-1 choices, they are accepted and the process repeats. If verification fails, the pipeline rewinds and continues from the last accepted position using the main model's output. This maintains generation quality while reducing the number of main-model forward passes.

Throughput gains with zero quality loss

Because the draft model proposes speculative tokens and the main model validates them, the final outputs are identical to traditional decoding (the main model always has the final say). The speedup depends on draft accuracy and cost ratio. With a 3-5x cheaper draft model achieving 80-90% acceptance rate, speculative decoding delivers 2-3x higher throughput on latency-sensitive applications like chat interfaces. Production LLM services commonly use this technique to serve more users with the same hardware.

Embed this diagram

Add this animated speculative decoding to your own site. Copy one line of HTML, or use the embed builder for theme and sizing options.

Reference

What this is
A free, embeddable, animated speculative decoding for any website.
Who uses it
AI/ML blogs, DevOps / SRE sites.
How to embed
Copy one line of HTML. No signup. No watermark. Works in WordPress, Webflow, Ghost, Substack, plain HTML.
File size
iframe embed, ~80 KB gzipped (loads on demand, does not block your page paint).
License
Free forever. Editorial explainer text included; updated centrally over time.

Embed format options

Copy the universal HTML snippet, the WordPress shortcode, or an iframe fallback - see the WordPress plugin page for details. Any format keeps the same Core Web Vitals profile and the same explainer text.

Embed snippet
<div data-scrollchart="speculative-decoding" data-scrollchart-v="1"></div>
<script src="https://scrollchart.com/embed.js" async></script>

Frequently asked questions

Where can I get a free animated "Speculative Decoding" for my website?
Scrollchart provides "Speculative Decoding" as a free, embeddable animated diagram you can add to any website with one line of HTML. No signup is required and there is no watermark. The diagram and its explainer text are served from scrollchart.com, so the embed stays current without any maintenance on your end.
How do I embed a speculative decoding in a developer or tech blog?
Copy the one-line snippet from the Scrollchart diagram page and paste it into your post HTML. It works in any static site generator, CMS, or hand-coded HTML page. The embed is a thin loader, not an iframe, so the content is fully in your DOM.