Loading…
gathering yarn balls…
Cat Game Research
Frontier
Dev-log transmissions from the expedition

How LLMs Get Faster Without Changing Their Answers: A Companion Guide

A companion guide to Jia-Bin Huang's lecture on speculative decoding: why a cheap draft model plus one parallel verification pass speeds up LLM inference, how rejection sampling keeps the output distribution identical, and how draft trees, Medusa, MTP, EAGLE, and DFlash push the trick further.

Source: How LLMs Get Faster Without Changing Their Answers | Speculative Decoding by Jia-Bin Huang · used as the primary text for this companion

Jia-Bin Huang's lecture How LLMs Get Faster Without Changing Their Answers is a guided tour of one of the most useful tricks in modern LLM serving: speculative decoding. The setup is counterintuitive. A large model is slow precisely because it writes one token at a time, each token requiring a full forward pass. So you ask a small, cheap model to guess several tokens ahead, then let the big model score all of them in a single pass and keep the ones it agrees with. The output distribution is provably unchanged. The video then traces how the field has spent three years making that draft smarter: from a single linear guess, to draft trees, to heads bolted onto the target, to look-ahead learned during pre-training, to a drafter that emits a whole block of tokens in one parallel pass.

The thesis in one sentence. Autoregressive decoding is serial and slow, but verification is parallel and cheap — so the entire research program is about spending that one parallel verification pass better, while a rejection-sampling rule guarantees the answers never change.
2–3×
Original spec-decode speedup
6.5×
EAGLE-3 vs. vanilla
>6×
DFlash lossless
1.8×
DeepSeek-V3 MTP (TPS)

The problem: one token per forward pass

The video opens with the bottleneck. A transformer produces a probability distribution over the next token, you sample one, append it, and feed the whole sequence back in. The next token cannot be written until all preceding ones are available, so decoding is inherently serial. Each token costs one full forward pass through every layer.

There is one place where the model is already fast: when the tokens are known. During parallel prefill, the model scores every position in a prompt at once in a single pass, because nothing about position i depends on a token that has not yet been generated. Prefill is fast precisely because it is parallel. The question speculative decoding asks is blunt: if parallel scoring is cheap, can we get someone to hand us tokens to score for free?

The core trick: draft, then verify in parallel

Let a small draft model quickly guess K tokens ahead. Then run the large target model once. Because the target only has to score the proposed tokens, it can evaluate all K positions in a single forward pass — the same parallel scoring prefill already does. Walk the proposals left to right, stop at the first rejection, sample one correction token, and discard the rest.

1
Draft. A cheap model proposes K candidate tokens autoregressively. Cheap because it is small; the video's example uses five drafts.
↓
2
Verify. The target model scores all K positions in one forward pass — the same cost as producing a single token the slow way.
↓
3
Accept the prefix. Accept proposals left to right until the first rejection. If all K survive, one verification yields K + 1 tokens (the extra one comes from the target itself).
↓
4
Correct. At the first rejection, sample a correction token from the leftover target mass and discard everything after it. Even the worst case still yields one token per target pass.

The speedup is governed entirely by how many of the K drafts survive that single target pass. If the draft is good, one expensive pass buys several tokens. If the draft is bad, you still get the one token you would have produced anyway — you only wasted the cheap draft work. This is why the entire subsequent history of the field is a campaign to make the draft better without making it expensive.

Why the answers do not change: rejection sampling

The subtle part is that the draft model's distribution Q is not the target's distribution P. Naively accepting draft tokens would shift the output toward whatever the draft over-predicts. The fix is a modified rejection sampling rule that makes the final distribution identical to sampling from the target alone.

Accept a proposed token x with probability P(x) / Q(x), capped at 1. Where the draft already assigns more probability than the target (Q > P), the cap never binds and you accept at the ratio — thinning out the over-predicted tokens. Where the draft assigns less (Q < P), the ratio exceeds 1, so you cap at 1 and accept every occurrence — those tokens are rare in the draft, so keeping them all does not overshoot.

acceptance = min( 1, P(x) / Q(x) )   ·   accepted mass = min( P(x), Q(x) )

After a rejection you cannot just sample from P directly, because some mass has already been paid out to accepted drafts. You sample from the correction distribution: the target mass P(x) minus the overlap min(P, Q) that the draft already consumed, renormalized. Together, the acceptance rule and the correction distribution preserve the target's distribution exactly. This is the losslessness guarantee that runs through every method below — the draft can be aggressively wrong, and the output still matches the target.

Rejection sampling: thin the overlap, redistribute the leftover
TARGET P(x)cat .40dog .30bear .20cow .10DRAFT Q(x)cat .50dog .20bear .10cow .20P/QCORRECTIONdog .50bear .50P − min(P,Q)

The diagram shows the video's worked example with four tokens. The draft over-predicts cat and cow, so those are thinned by the ratio; it under-predicts dog and bear, so every occurrence is accepted. After a rejection, the leftover target mass (the part the accepted drafts did not cover) is renormalized into the correction distribution — here, 50% dog and 50% bear, exactly the 0.1 the draft was short on each.

"A cheap draft, then one target pass that verifies many tokens. … This acceptance rule and this correction distribution preserve the target model's distribution exactly."

Jia-Bin Huang · How LLMs Get Faster Without Changing Their Answers

The campaign to make the draft better

Once losslessness is guaranteed, the only lever is the accepted length — how many drafts survive before the first rejection. The rest of the video is a progression of ideas for raising it, each removing a constraint the previous method accepted.

The progression: from one linear guess to a fully parallel block
LINEARone chainTREESbranch & mergeMEDUSAheads on targetMTPlearned in pre-trainEAGLE 1–3feature drafterDFLASH 1–2parallel blockeach step removes a constraint on the draft
2023 · baseline
Linear drafting
The draft model emits one continuation sequence; the target verifies it; on the first rejection you discard everything after it and start over. Brittle: one early wrong guess throws away the whole pass.
tree attention
Draft trees
Several candidate continuations share a prefix, so merge them into a tree. Flatten it into one sequence and use a custom attention mask so each token attends only to its true ancestors — no leakage between branches. The target verifies the whole tree in one pass and commits the longest valid branch.
no second model
Medusa
Skip the separate draft backbone. Attach multiple lightweight heads (MLP + skip connection) to the target's final hidden state, each predicting a different future position. Take top candidates from each head into a sparse tree and verify with tree attention. A lossless variant keeps the distribution exact; a typical variant accepts more at the cost of exactness.
learned at training time
MTP · DeepSeek-V3
Multi-token prediction bakes look-ahead into the training objective itself. DeepSeek-V3 chains its MTP modules so each predicted token conditions on the previous one, preserving causality across depths. At inference only one module is kept; the main model verifies the extra token in parallel. DeepSeek reports an 85–90% acceptance rate and 1.8× tokens-per-second.
feature-level · recurrent
EAGLE → EAGLE-2 → EAGLE-3
EAGLE drafts at the feature level (easier to extrapolate than discrete tokens) with one lightweight recurrent module — one module, arbitrarily many positions. EAGLE-2 makes the tree context-aware: branch where the next token is uncertain, stay narrow when it is obvious. EAGLE-3 drops feature prediction for direct token prediction and fuses low/mid/high layers, reaching up to 6.5× over vanilla (~1.4× over EAGLE-2).
parallel block · diffusion drafter
DFlash → DFlash 2
DFlash drafts the whole block in one pass: anchor the last verified token, mask the slots to guess, run a small bidirectional stack once, sample all positions at once. Injects target layer features as KV cache so the drafter sees the full prefix. DFlash 2 adds a path selector (low-rank bilinear scoring of adjacent candidate pairs) and local mixing (depthwise conv) to fix block-level incoherence and end-of-block decay.

Draft trees: verifying a tree in one pass

The first real upgrade is structural. Linear drafting throws away an entire pass on a single early rejection. But several independent guesses usually share a prefix, so they can be merged into a draft tree. The trick is verifying the whole tree in one forward pass. You flatten the tree into a single sequence, then replace standard causal attention with a tree-structured attention mask: each token attends only to the path from the root to itself, never to tokens in sibling branches. Without this, a token would leak information from an unrelated branch simply because that branch sits earlier in the flattened sequence. With it, every candidate path is preserved in the same flattened sequence, and the target commits the longest accepted prefix along any valid branch.

Medusa: draft from the target's own hidden states

A separate draft model is a deployment burden: it must share the target's tokenizer and vocabulary, stay in sync, and compete for the same GPU memory. Medusa removes the second backbone. It attaches several lightweight heads to the target's final hidden state, each predicting a different future position. The heads produce per-position distributions; you take a few top candidates from each and assemble a sparse tree, verified in one pass with tree attention — the token-tree verification paradigm introduced by SpecInfer (Miao et al., ASPLOS'24). A lossless variant stays exact via rejection sampling; a typical variant relaxes exactness to accept more drafts.

MTP: learn the look-ahead during pre-training

Medusa's heads are bolted on after pre-training. Multi-token prediction (MTP) asks why not bake look-ahead into the training objective from the start. A single hidden state branches into several parallel predictions, one per future position. The naive version makes those predictions independent, so each head guesses without seeing the others. DeepSeek-V3 fixes this by chaining its MTP modules: each extra token conditions on the previously drafted one, preserving a causal chain across prediction depths. Each module takes the target's intermediate state plus the embedding of the prior draft, normalizes and concatenates them, projects, and runs a transformer block. During training an auxiliary loss teaches look-ahead; at inference DeepSeek-V3 keeps a single module and the main model verifies the extra token in parallel. The reported payoff: an 85–90% acceptance rate for the second token across generation topics, and 1.8× tokens-per-second. The trade-off, as the video notes, is that the number of extra predictions is fixed at training time.

EAGLE: one recurrent feature-level drafter

MTP's look-ahead depth is fixed. EAGLE reuses one lightweight draft module in a loop — each predicted token feeds back in to produce the next, so a single module drafts as many positions as inference needs. The key move is drafting at the feature level rather than the token level: high-level feature sequences are easier to extrapolate than discrete tokens. Because the next feature is uncertain and depends on which token was actually sampled, EAGLE conditions the drafter on both the previous feature and the sampled token — the feature carries continuous state, the token resolves which discrete path was taken. A regression loss teaches the drafter to match the target's next feature.

EAGLE-2 fixes the static tree. EAGLE grows the same branching pattern every step regardless of context, wasting branches on near-certain tokens. EAGLE-2 makes the tree context-aware: expand where the next token is uncertain, stay narrow where it is obvious. The EAGLE-2 paper reports speedup ratios of 3.05–4.26×, which is 20–40% faster than EAGLE-1, with no extra training and no change to the target's output. EAGLE-3 goes further: it abandons feature prediction for direct token prediction and fuses lower, middle, and upper layer features via a technique called training-time test. Across the paper's evaluations EAGLE-3 reaches up to 6.5× the baseline speed, about 1.4× over EAGLE-2.

DFlash: draft the whole block in one parallel pass

Every method above still drafts autoregressively — one token at a time through the recurrent module, so draft cost grows linearly with the number of tokens and error accumulates. DFlash, from Z Lab and Inco AI, breaks that: it drafts an entire block in a single parallel pass. Anchor the last token the target accepted, put mask tokens in every slot you still need to guess, and run a small stack of bidirectional attention and MLP layers once. One pass yields a hidden state at every mask position, so you sample the whole block in one shot.

To keep the draft grounded, DFlash does not feed only the last token's features. It collects the target's layer features for every verified prefix position, turns them into keys and values, and injects them into each draft layer's KV cache — so the drafter sees the full prefix context, and the input does not fade as you go deeper into the stack. The target still verifies the block, so the output stays correct. DFlash reports over 6× lossless acceleration, up to 2.5× higher than EAGLE-3.

DFlash 2: a selector and local mixing

Parallel drafting is fast but locally incoherent: each position picks its token independently, so a block can be locally plausible yet globally nonsensical — "jump fast the same fox" is not a sentence, and two neighbors can even pick the same word. The right tokens are usually already on the short lists; the problem is selecting a coherent path through them.

DFlash 2 keeps the top 16 candidates at each position and scores every adjacent pair. The score has two terms: DFlash's own logit for the candidate (how much the drafter already liked it alone), plus a compatibility term — two learned linear maps embed the predecessor and the candidate into 256-dimensional vectors, matched under a context gate that decides which parts of the match count. In essence this is a low-rank bilinear attention over adjacent candidates. Scoring stays fully parallel; the only sequential work is a short greedy walk over precomputed scores from the last verified token. This is the path selector.

St(a, b) = Ut(b) + ⟨ A(a) ⊙ H(ht), B(b) ⟩

The selector fixes which candidate to pick, but it cannot invent a token that never made the list. The drafter's accuracy still decays toward the end of the block — the blog reports top-1 recall falling from 85.4% at position 0 to 72.9% at position 6, and top-16 recall from 99.5% to 87.8%. That is a backbone problem, not a selector problem. So DFlash 2 splits the job: attention keeps reading long-range context, and a small depthwise convolution handles local mixing inside the block. Before and after each attention and MLP layer, a two-tap conv mixes each position with its predecessor (reaching back to the last verified token at the first draft position), and the mixing weights can be made adaptive — a base kernel plus a correction from the current hidden state. All of it stays parallel. The video reports mean accepted length rising from DFlash's 4.92 tokens to 5.97.

Recap: what each step removed

The video closes by framing the whole arc as a sequence of removed constraints. Speculative decoding began as draft-and-verify. Then the field enhanced draft quality (trees), unified the draft and target models (Medusa), learned look-ahead during pre-training (MTP), made sequential forecasts of upcoming features (EAGLE), and finally enabled fully parallel drafting (DFlash). At every step the losslessness guarantee from rejection sampling is what makes the experimentation safe — you can make the draft arbitrarily aggressive and the output still matches the target.

1
Serial decoding is the bottleneck. One forward pass per token; verification, by contrast, is parallel.
↓
2
Rejection sampling buys losslessness. Accept at min(1, P/Q), correct from the leftover mass — the output distribution is provably unchanged.
↓
3
Raise accepted length. Trees, Medusa heads, MTP, EAGLE's recurrent feature drafter, and DFlash's parallel block each remove a constraint on the draft.
↓
4
Parallel drafting is the frontier. DFlash / DFlash 2 draft a whole block in one pass; the selector and local conv fix coherence and end-of-block decay.

Glossary

Caveats & sourcing

This is a companion to a single video; the video is the primary source for the narrative arc and the worked examples. Where the video reports a number that originates in a paper or project page, that primary source is linked below and was checked directly.

  • Verified against primary sources. The original speculative-decoding framework: Leviathan, Kalman & Matias (ICML 2023) and the concurrent Chen et al. (2023) (2–2.5× on Chinchilla-70B). DeepSeek-V3 MTP figures (85–90% acceptance, 1.8× TPS) come from the DeepSeek-V3 technical report. EAGLE-2 figures (3.05–4.26×, 20–40% faster than EAGLE-1) come from the EAGLE-2 paper (EMNLP'24). EAGLE-3 figures (up to 6.5×, ~1.4× over EAGLE-2) come from the EAGLE-3 paper. The SpecInfer token-tree verification reference comes from Miao et al. (ASPLOS'24). DFlash figures (>6× lossless, up to 2.5× over EAGLE-3) come from the DFlash paper. DFlash 2's recall table (85.4%→72.9% top-1, 99.5%→87.8% top-16) and the selector formula come from the DFlash 2 blog.
  • Video-reported, not independently re-measured here. The DFlash 2 "mean accepted length 4.92 → 5.97" figure is stated in the video. The DFlash 2 blog reports per-task acceptance lengths (e.g. 5.46 on GSM8K) rather than a single 5.97 mean, and its own DFlash baseline on GSM8K with Qwen3-4B is 4.27, not 4.92 — so the video's absolute numbers likely come from a different model or benchmark configuration. The relative gain (~21%) is consistent with the blog's stated "16–25%" improvement range. Treat 4.92→5.97 as the video's aggregate framing, not a number lifted from the blog table.
  • Transcript corrections. The auto-generated transcript contains several mis-transcriptions that were corrected against the named systems' published names: "Deep Sea v3" → DeepSeek-V3; "Ego / Ego 2 / Ego 3" → EAGLE / EAGLE-2 / EAGLE-3; "D-Fresh / Deep Flash" → DFlash; "tractor" → drafter; "logics" → logits; "hands" (in the Medusa section) → heads; "NTP's wings" → MTP's weakness. "SpecInfer" appears in the Medusa section as the tree-attention verification approach.
  • Disambiguation. "Speculative decoding" here is the LLM-inference acceleration technique, unrelated to "speculative execution" at the CPU level or to any game/graphics concept of the same name.
  • Scope. The video focuses on the dominant draft-and-verify lineage. Adjacent ideas it names only in passing — lossy Medusa variants, the auxiliary MTP training loss, EAGLE-3's training-time test — are summarized here but not derived in full; see the linked papers for the math.

Read further

Related on the frontier

← All transmissions