Unit 9 of 12 · about 4 hours · derive

Draft cost, verification cost, accepted tokens and the speedup crossover

Acceptance without cost is a headline. The speedup equation decides the draft length, the draft model and whether to speculate at all under load.

You'll be able to

  • Derive expected tokens per verification from acceptance rate and draft length, including the bonus token.
  • Predict speedup from draft cost, verification cost and accepted tokens, and find the break-even boundary.
  • Explain why batch size moves the crossover, and where speculation stops paying.

Covers

Draft cost, target verification and accepted tokensSpeculation speedup and crossover model
1

Read

In this order, only the parts listed

0 of 3 done

  1. Walltime improvement and choosing draft lengthFast Inference from Transformers via Speculative Decoding

    Sections 3.3 to 3.5 (walltime improvement, operation counts, choosing ) with the expected-token equation, the draft-cost ratio and the improvement theorem

    Treat the paper tables as worked examples on the authors hardware, not as your targets.

  2. Module 08: acceptance economics and batchingLLM Inference: From scratch, one token at a time - Module 08

    Concept 03 Acceptance rate with the yield table and the worked speedup cases at , Concept 05 Why speculation stops working at high batch with the batch table, and Math by hand Parts 2 to 4

  3. Tuning, limits and the concurrency crossoverHands-On LLM Serving and Optimization - Quantization (Chapter 6) and Speculative Decoding (Chapter 7)

    Chapter 7: Tuning and Usage (printed pp. 235 to 239: draft-token count between 4 and 8, the falling-acceptance example) and Limitations (printed p. 239: decode-only help, large-batch and long-prefill losses)

2

Focus on

  • Expected tokens per verification are . The counts the bonus token; the ceiling as grows is .
  • Speedup divides yield by round cost: with draft cost ratio . A bigger draft that raises can still lose if it raises more.
  • Acceptance dominates length: at and , , while pushing to 10 gains little. Tune the draft, not the length.
  • Batching consumes the same idle arithmetic verification rides on. Past the ridge point the extra positions cost real time and rejected drafts steal compute from real tokens.
Common mistakes · 3
  • Maximizing acceptance alone. A 7B draft for a 13B target at , and lands near 1.17x; the ratio is the metric.
  • Importing a published . Acceptance moves with domain, temperature and position; measure it on your workload before sizing .
  • Enabling speculation at high batch. The free-arithmetic argument assumes memory-bound decode; compute-bound batches turn drafts into a tax.
3

Try it yourself

Closed-book, before checking anything

Closed-book, compute for , (about 3.36) and the speedup at (about 2.80x), then find a pair with below 0.5 where speculation loses.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why does the yield formula use instead of ?Answer

    A fully accepted round also emits the bonus token from the verification pass final position, so the maximum per round is drafts plus one.

  2. 2.With , and , what is the speedup?Answer

    tokens per verification divided by cost, about 2.80x.

  3. 3.With and at , speculate or not?Answer

    Not: against cost 2.20 gives about 0.75x, slower than baseline with identical output.

  4. 4.Why does the optimal draft length grow with the acceptance rate?Answer

    Higher keeps later positions alive, so extra drafts still convert. At low late drafts are usually discarded, adding cost without yield.

5

Practice

  • Tushar Module 08 code lab: speedup surface

    Code lab Parts B and C: build the yield and speedup tables, find the optimal per row, and locate the batch size where your ridge calculation crosses

    Use your own arithmetic-intensity numbers from the prefill-decode units, not the module H100 example.

You're done when

You derive yield and speedup for a new triple without notes and can name the batch regime where your deployment stops speculating and why.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section

Also in this section