Analytics Legends logoAI & Analytics Legends Sign inSign up
Concept card

Speculative Decoding — Cutting Per-Token Latency Without Changing the Output

Speculative Decoding — Cutting Per-Token Latency Without Changing the Output — AI & Analytics Legends section illustration for the SAP AI & Analytics knowledge base (concepts, studies, Academy)

As of 2026-11-28

What is Speculative Decoding?

Speculative decoding cuts per-token (inter-token) latency, not time-to-first-token, by having a small draft model propose several tokens and verifying all of them with the large target model in one parallel pass — a 2-4x wall-clock speedup with output mathematically identical to running the target model alone.

What it is

Autoregressive generation is sequential by definition — token n+1 depends on token n. On modern GPU hardware that sequential dependency, not raw flops, is the bottleneck: a 70B model takes roughly 30 ms per token at small batch sizes, almost independent of batch size until compute saturates, because each step waits on memory loads, not on arithmetic. Speculative decoding breaks the sequential constraint by using a small, fast draft model to propose k candidate tokens, then verifying all k with the large target model in a single parallel forward pass. When the draft model agrees with the target on j of k tokens, the system advances j+1 tokens (the j accepted + one correction) per target-model step instead of one — a 2-4× wall-clock speedup with an output distribution mathematically identical to sampling from the target model alone (identical to greedy target-model output at temperature 0).

Why it matters

  • The 70B-model bottleneck is memory loads, not arithmetic — each token takes roughly 30ms at small batch sizes, exactly the constraint speculative decoding attacks.
  • The acceptance probability min(1, q_i/p_i) guarantees the sampled output distribution is identical to sampling from the target model alone (at temperature 0 the output is identical to greedy target-model generation) — no quality trade-off, only a speed one.
  • Medusa and EAGLE remove the need for a separate draft model (lightweight prediction heads or feature-level prediction instead), avoiding the two-model serving complexity of the original recipe.

Key points

  • Sequential generation is memory-bandwidth bound, not compute bound — speculative decoding amortises one large-model forward pass across multiple accepted tokens.
  • Canonical recipe (Leviathan 2023) — small draft model proposes k tokens, target model verifies all k in one parallel pass, accept-reject preserves the target distribution exactly.
  • Modern variants — Medusa (lightweight prediction heads on the target, no separate draft); EAGLE (feature-level prediction, ~2.7-3.5× speedup); Lookahead decoding (n-gram self-verification, no draft model at all).
  • Production users — Meta Llama 3 inference stacks (vLLM/TensorRT-LLM), Mistral/DeepSeek vLLM deployments.
  • Output is mathematically identical to greedy/sampled target-model generation — speculative decoding is a pure latency optimisation, not a quality trade-off.
  • On a managed generative AI hub endpoint, speculative decoding — like the KV cache and the attention kernel — is invisible: it is the hosting vendor's implementation choice, priced into the per-token rate, not a lever SAP customers configure directly.
  • A self-hosted SAP AI Core BYOM deployment (vLLM, per SAP's own sample repository) can enable speculative decoding explicitly with a smaller sibling model as drafter — but only when a suitably matched, same-distribution small model is actually available and licensed for the tenant.
  • The single biggest practical risk is a mismatched or stale draft model: once the draft and target diverge (commonly after the target is fine-tuned but the draft is not updated), acceptance collapses toward zero and the technique adds latency instead of removing it.

Terms used on this page

Speculative decoding
An inference acceleration technique where a small fast draft model proposes k candidate tokens that a large target model then verifies in a single parallel forward pass, achieving 2-4× wall-clock speedup with identical output distribution to target-only sampling.
Draft model
The small, fast auxiliary model in speculative decoding that proposes candidate tokens; typically 10-100× smaller than the target model and ideally trained on the same data distribution to maximise draft-target agreement.
Target model
The large, expensive model whose output distribution speculative decoding preserves exactly; verifies the draft's k candidate tokens in one parallel forward pass.
Medusa
A speculative-decoding variant (Cai et al., 2024) that adds lightweight prediction heads on top of the target model itself, eliminating the need for a separate draft model and simplifying serving.
Time-to-first-token (TTFT)
The user-facing latency metric for LLM inference — the wall-clock time between the user submitting a prompt and the first generated token arriving. Speculative decoding does not shorten TTFT, which is dominated by the prefill pass; it shortens inter-token latency, and at large batch sizes it can lower throughput.

Sources

  1. Fast Inference from Transformers via Speculative Decoding (Leviathan et al., Google, 2023)
  2. Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads (Cai et al., 2024)
  3. EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty (Li et al., 2024)
  4. Anthropic engineering — Claude inference architecture commentary
  5. arXiv — Break the Sequential Dependency of LLM Inference Using Lookahead Decoding (Fu, Bailis, Stoica & Zhang, ICML 2024)
  6. GitHub hao-ai-lab — LookaheadDecoding official implementation
  7. GitHub vllm-project — vLLM (speculative decoding / draft-model serving configuration)
  8. GitHub NVIDIA — TensorRT-LLM (Medusa and draft-model speculative decoding support)
  9. SAP News Center — How SAP and NVIDIA Advance Enterprise AI Transformation (NIM inference optimisation, SAP-ABAP-1, 2026-03-17)
  10. GitHub SAP-samples — btp-generative-ai-hub-use-cases: bring-your-own OSS LLM on SAP AI Core (vLLM serving backend)
  11. SAP Help Portal — Choose a Resource Plan for training/inference in SAP AI Core (GPU sizing for a self-hosted draft+target deployment)
  12. Anthropic — Context windows documentation (Claude model family)
  13. AWS Machine Learning Blog (19 Oct 2026): push-based KV transfer for disaggregated inference in vLLM

Full card with the Consultant plan — €19.90/month. What the full card adds: the full decision framework · the SAP vs Snowflake / Databricks / Fabric comparison · the common pitfalls and their fix · the cheat sheet · the architecture schemas · the code blocks · the facts worth quoting.

Open in the app →

Open missions

SAP analytics jobs and contracts · freelance SAP contracts.