Read page 1 as text
Can an LLM write several tokens ahead?
If output is sequential, how can speculative decoding help?
WHAT WE WILL FIGURE OUT
01
A cheap proposal is not the final answer
02
Verify the draft with the target
03
Know when speculation pays off
OUR EXAMPLE
A draft proposes The cat slept. A target verifies the proposal.
Follow the steps. Ask the obvious questions. Check the result.
Part 12 of 18 · Challenge: page 5 · Suggested answers: page 6
Read page 2 as text
A cheap proposal is not the final answer
1
THE SEQUENTIAL DEPENDENCY
target distribution
dependent tokens
target distribution
dependent tokens
Did we break the rule from comic 3?
The target still defines dependent next-token predictions. Speculation adds a way to propose future tokens cheaply.
Ordinary decode remains the reference process
2
A DRAFTER PROPOSES
DRAFT PROPOSAL
The
→
cat
→
slept
draft
→
The cat slept
A smaller model or another drafting mechanism proposes several possible next tokens. The proposal may be wrong.
Illustrative draft: The cat slept
3
THE TARGET CHECKS
FOLLOW THE CHANGE
known proposal
target scoring
known proposal
→
target scoring
Because the proposed tokens are now available, the target can score their positions together with causal masking.
Verify proposed positions in a target pass
4
CAUSAL ORDER REMAINS
FOLLOW THE CHANGE
The
cat
slept
The
→
cat
→
slept
The target's score for slept is conditioned on the proposed earlier tokens. Parallel verification does not let a position see the future.
Known draft positions can be checked together
Read page 3 as text
Verify the draft with the target
5
A VERIFIED PREFIX
TARGET VERIFICATION
The
→
cat
→
slept
ACCEPT
ACCEPT
REJECT
The cat: accept
slept: reject
Must the target accept everything?
An acceptance procedure determines which proposed prefix can be used. At a rejection, later proposals cannot simply be trusted.
Accept The cat; reject slept in our toy path
6
CORRECT AND CONTINUE
CORRECTED CONTINUATION
The
→
cat
→
sat
Corrected continuation: The cat sat
accepted The cat
→
corrected sat
A correction is sampled using the target procedure, then drafting resumes from the accepted context.
Toy continuation becomes The cat sat
7
A DISTRIBUTION GUARANTEE
FOLLOW THE CHANGE
accept + correct
target distribution
accept + correct
→
target distribution
Exact speculative sampling uses acceptance and correction rules to preserve the target sampling distribution.
It is more precise than just checking the top token
8
NOT IDENTICAL RANDOM WORDS
same distribution
different draws
same distribution
different draws
Preserving the distribution does not mean an ordinary run and a speculative run must generate the same random sequence.
Same target distribution, not same random trajectory
Read page 4 as text
Know when speculation pays off
9
WHERE THE WIN COMES FROM
FOLLOW THE CHANGE
draft tokens
accepted prefix
draft tokens
→
accepted prefix
What work did we save?
When enough proposals are accepted, one target verification pass can advance multiple positions.
More accepted draft tokens per costly target pass
10
WHERE THE COST COMES FROM
draft cost
verify cost
rejects
draft cost
verify cost
rejects
Drafting, verification, cache state and rejected work all cost resources. A weak drafter may add work instead of saving it.
Low acceptance can remove the benefit
11
MEASURE YOUR WORKLOAD
acceptance
latency
memory
acceptance
latency
memory
Acceptance, end-to-end latency, throughput and memory all matter. Gains depend on task, model pair and implementation.
No universal 2× or 3× promise
12
MY NEW MENTAL MODEL
FOLLOW THE CHANGE
measure
exact or approximate
measure
→
exact or approximate
Guess cheaply, verify carefully.
Speculation moves work around the dependency. It does not make unverified future words correct.
Check whether the implementation is exact or approximate
Read page 5 as text
Your turn. Can you explain what happens?
Use the same example. Change one detail. What follows?
KEEP THIS EXAMPLE IN MIND
A draft proposes The cat slept. A target verifies the proposal.
Try first. Suggested answers are on the next page.
1
Can tokens after a rejected draft position be accepted blindly?
What makes you say that?
2
What does exact speculative sampling preserve?
What makes you say that?
3
Name one workload measurement needed before enabling it.
What makes you say that?
Write your answers in the comments.
Read page 6 as text
Suggested answers
Can an LLM write several tokens ahead?
01
Can tokens after a rejected draft position be accepted blindly?
No. Their predictions depended on the rejected proposed context.
02
What does exact speculative sampling preserve?
The target sampling distribution, under the exact algorithm assumptions.
03
Name one workload measurement needed before enabling it.
Acceptance rate, end-to-end latency, throughput or extra memory.