Unit 12 of 12 · about 5 hours · implement, measure

Engine integration, versioned fallback, and benefit and loss regions

Integration is where paper gains meet serving reality. A path without fallback and without a measured loss region is a demo, not an engine change.

You'll be able to

  • Integrate one quantized or speculative path into an engine with a versioned configuration and a tested fallback.
  • Measure a benefit region and a loss region across batch size and sequence length with quality held fixed.
  • Explain each region from format, kernel coverage, acceptance, draft cost or workload evidence.

Covers

Quantized or speculative engine integrationVersioned configuration and safe fallbackBenefit and loss regions across batch and length
1

Read

In this order, only the parts listed

0 of 3 done

  1. Hands-on speculative decoding and the concurrency crossoverHands-On LLM Serving and Optimization - Quantization (Chapter 6) and Speculative Decoding (Chapter 7)

    Chapter 7, Hands-on Speculative Decoding (printed pp. 240 to 242): the four vLLM server setups (vanilla, n-gram, improved n-gram, EAGLE-3) compared at concurrency 1 and 16, with the TTFT versus ITL trade-off discussion

    Reproduce the comparison shape on your model and GPU: n-gram and EAGLE gains at low concurrency fading or reversing at high concurrency. The book numbers are its hardware, not your target.

  2. vLLM speculative configuration schemavLLM Speculative Decoding and Quantization (v0.31.0)

    --speculative-config schema with the common keys (method, model, num_speculative_tokens) and the n-gram keys (prompt_lookup_min, prompt_lookup_max), plus the lossless-guarantees and per-request acceptance-metrics notes

    For each method you integrate, first write its correctness contract, the engine support it needs, and a predicted winning and losing workload, then run it. The schema keys are v0.31.0 keys; older releases differ.

  3. Chapter 18 speculation sweep toolingAI Systems Performance Engineering companion code - Chapters 16, 18 and 19 labs

    code/ch18/speculative_decode/spec_config_sweep.py with code/ch18/spec_configs: sweeping speculator configs and emitting acceptance rate, chunk size, throughput, TTFT and TPOT per config

    Use the sweep shape and metric set on your engine; regenerate every number on your hardware. Its config keys (chunk_size, max_spec_tokens, fallback_chunk_size) drive the chapter's own benchmark, not the vLLM speculative config.

2

Focus on

  • Version the full path: method, model or drafter artifact, quantization format, engine version and every speculation flag. Fallback is a config switch back to the validated baseline, tested before it is needed.
  • Map two axes at least: batch size and sequence length. Speculation typically wins small-batch decode and loses large-batch or prefill-heavy load; quantization wins memory-bound shapes and loses where kernels are missing.
  • Hold quality fixed across the map with the slice checks from the methods unit. A faster region with failed quality is not a benefit region.
  • Attribute each region to a mechanism: acceptance and draft cost, kernel coverage, dequantization overhead, or scheduler interaction. Name the shifted bottleneck on the losing side.
Common mistakes · 3
  • Shipping without exercising fallback. An untested fallback fails exactly when the primary path does; trigger it deliberately under load before relying on it.
  • Sweeping one axis. A batch-1 win that reverses at batch 16 is the normal shape, not an anomaly; the map needs both axes plus a long-context point.
  • Changing sampling or prompts between configs. Any output difference voids both the quality and the latency comparison; pin the contract first.
3

Try it yourself

Closed-book, before checking anything

From a blank page, write the integration contract for one method: configuration version, fallback trigger, predicted winning workload and predicted losing workload with the mechanism behind each prediction.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.What belongs in a versioned speculation configuration?Answer

    Method, drafter artifact and version, target model, engine version, draft length and lookup bounds, sampling parameters, and the fallback revision. Anything missing cannot be rolled back to exactly.

  2. 2.N-gram speculation wins at concurrency 1 and loses at 16. What mechanism explains the crossover?Answer

    At low concurrency verification rides idle arithmetic; at high concurrency the batch already consumes it, so proposing and verifying add cost while acceptance stays the same. The book also names the extra CPU work of proposing.

  3. 3.A quantized path is faster but fails the code slice. Is that a benefit region?Answer

    No. Benefit regions require the quality contract to hold; report it as a loss region with the slice failure as the cause.

  4. 4.How do you test fallback before an incident?Answer

    Flip the config switch under replayable load, confirm outputs match the baseline contract and latency returns to baseline, and keep the evidence with the version.

You're done when

Your contract predicts a win and a loss region before the run, the measurements confirm the shape with quality held, and fallback flips cleanly under load.

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