research24 min studyLesson 736 in Engineering

Compare agreement gains with the full resident resource bill

Choose a proposal mechanism using measured overlap, draft latency, cache footprint, and serving capacity rather than parameter count or acceptance alone.

On this page

What you’ll understand

  • Separate draft-model quality from acceptance overlap at relevant histories.
  • Budget draft weights, KV state, logits, and temporary storage alongside target work.
  • Explain why shared or smaller drafts still need implementation-specific validation.

A larger draft raises acceptance from one workload sample but consumes memory needed for concurrent target requests. Another smaller proposal mechanism accepts fewer tokens yet improves overall serving latency. Draft selection is a joint quality and systems problem. Measure distributional overlap and stage costs under the intended target decoder, then include the resident and temporary memory that affects feasible batch size. A nominally accurate draft is not useful if its execution cost or memory pressure exceeds the work it saves.

Measure overlap where the target will actually decode

Perplexity, parameter count, and top-token agreement can help characterize a draft but do not directly determine the exact proposal overlap sum min(p, q). Evaluate that overlap or observed verified-prefix behavior on representative prompts, temperatures, constraints, and context lengths. A draft trained for one domain may be cheap but poorly matched elsewhere. A more accurate language model can still have an unfavorable runtime ratio on the chosen hardware. Keep target and draft tokenization compatible with the selected verifier, and measure any supported translation or mapping cost separately.

Proposal mechanisms include separate smaller models, trained auxiliary heads, early-exit paths, and prompt-based lookup under particular supported algorithms. They do not all have the same probability information or correctness argument. A shared backbone can avoid duplicating some weights, while adding heads or jointly fine-tuning a backbone can alter what baseline model is being preserved. Distinguish an unchanged target plus verified proposals from an updated target whose quality is assessed against an older release. Pinned API support and paper results apply to their stated models and implementations; do not infer that every assistant choice has the same compatibility or performance.

Mresident=Mtarget+Mdraft+Ktarget+Kdraft+WM_{\mathrm{resident}}=M_{\mathrm{target}}+M_{\mathrm{draft}}+K_{\mathrm{target}}+K_{\mathrm{draft}}+W
These disjoint byte-accounting terms represent weights, retained KV state, and workspace including temporary logits or proposal buffers. Actual sharing, allocator reservation, quantization metadata, and lifetimes must be accounted for explicitly rather than double-counted or omitted.↔ Scroll wide equations horizontally.

Budget KV and temporary state, not only weights

For a conventional decoder with keys and values stored per layer, cache bytes scale with layer count, KV-head count, head width, scalar size, and retained tokens across requests. Use KV heads rather than query heads for grouped-query or multi-query attention. Compression, quantization scales, sliding windows, and architecture-specific state can change the estimate. The draft has its own cache unless a supported implementation shares state correctly. Temporary verification tokens and branches also need storage even when later rejected, so peak memory can exceed the committed-prefix cache size.

Logits can be substantial when many candidate positions each produce a vocabulary-sized vector, particularly if sampling calculations use a wider dtype than stored weights. Workspace, graph captures, communication buffers, and fragmentation also affect the feasible batch. A memory budget should state which allocations coexist and what remains available for request growth. Reducing weight precision can change both memory and proposal probabilities, so remeasure overlap and numerical behavior instead of assuming a storage reduction preserves every previous verification property. The target model and its declared law remain the reference for exactness.

K≈2LHKVdhb∑r=1BTrK\approx2L H_{\mathrm{KV}}d_h b\sum_{r=1}^{B}T_r
For this conventional cache estimate, L is layer count, H_KV stored KV heads, d_h scalars per head, b bytes per scalar, and T_r retained tokens for request r. The factor 2 counts keys and values. Metadata, special architectures, compression, and temporary speculation are outside this approximation.↔ Scroll wide equations horizontally.

Choose against the actual deployment objective

Compare draft alternatives using committed tokens per time, peak memory, time to first token, inter-token latency distribution, and throughput at the intended load. A proposal that saves target weight reads for one isolated request may interfere with a saturated batch. Include low-acceptance and short-output requests where overhead dominates. Record model and backend versions and keep a non-speculative fallback under the same target settings. A higher acceptance percentage is one diagnostic, not a release decision detached from the added execution and capacity costs.

The roofline lab illustrates the resource distinction only. For each separate view, Reset, set both bandwidth B=100 GB/s and operational intensity I to 2 or 10 FLOP/byte, predict, then inspect. The synthetic ceilings are 200 and 1000 GFLOP/s with a fixed 1000 GFLOP/s compute roof. This model has no draft, acceptance process, cache allocation, or measured accelerator. It shows why additional useful arithmetic may fit a bandwidth-bound regime yet compete with a compute ceiling; actual draft selection still requires the full memory and latency measurements just described.

A higher-acceptance draft can exceed the memory envelope

A fictional device budget is 24 GiB. Disjoint existing allocations are 16 GiB target weights, 4 GiB target KV, and 1 GiB workspace. Draft option A needs 2 GiB weights, 0.5 GiB KV, and 0.75 GiB additional temporary workspace; option B needs 1.25, 0.25, 0.5 GiB respectively.

  1. Existing target allocations total 21 GiB, leaving 3 GiB under the stated budget.

  2. Option A adds 3.25 GiB, taking the total to 24.25 GiB, which exceeds the envelope by 0.25 GiB. Its acceptance improvement alone does not make this configuration feasible.

  3. Option B adds 2 GiB, totaling 23 GiB and leaving 1 GiB within this simplified budget. Measure its latency and overlap; the arithmetic does not establish that the remaining headroom covers every real allocation.

The result

The specified option A does not fit while B fits the stated terms. Feasibility and actual performance are separate from which draft has the higher acceptance rate.

Explore the model

Interactive lab

Interactive lab · roofline

Distinguish arithmetic headroom from a bandwidth ceiling

For each view: Reset, set both B=100 GB/s and I, predict, then inspect. Compare I=2 with I=10 FLOP/byte: synthetic ceilings are 200 and 1000 GFLOP/s. Playback traces the fixed roof. This is not a draft benchmark, cache allocator, or speedup estimator.

Distinguish arithmetic headroom from a bandwidth ceilingSynthetic roofline ceiling min(1000, B·I), in GFLOP/s, with B in decimal GB/s and I in FLOP/byte. Playback traces the roof without changing the selected kernel. This upper-bound model is not a measured throughput prediction, hardware comparison or price model. Current readings: Attainable ceiling: 640 GFLOP/s; Ridge intensity: 12.5 FLOP/byte; Ceiling regime: Memory-bound ceiling. All parameters are adjustable with the labeled controls below.Hypothetical roofline upper bound: 640 GFLOP per second at operational intensity 8 FLOP per byte and bandwidth 80 gigabytes per second.0.1110641101001000Operational intensity · FLOP/byte · log scaleCeiling · GFLOP/s · log scalePeak: 1000
Attainable ceiling / kernelBandwidth roof / traceCompute ceiling
Attainable ceiling
640 GFLOP/s
Ridge intensity
12.5 FLOP/byte
Ceiling regime
Memory-bound ceiling
t = 0 s

Synthetic roofline ceiling min(1000, B·I), in GFLOP/s, with B in decimal GB/s and I in FLOP/byte. Playback traces the roof without changing the selected kernel. This upper-bound model is not a measured throughput prediction, hardware comparison or price model. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forExtra proposal work has a resource cost even when it amortizes target weight access. Evaluate the real memory, overlap, and load regime together.

Check your understanding

Why is the draft with the highest acceptance rate not automatically the best serving choice?

Try it yourself

A fictional 30 GiB envelope already has 25 GiB of disjoint target allocations. A draft adds 3 GiB weights, 1 GiB KV, and 1.5 GiB workspace. Does it fit? What does a smaller 4 GiB total draft allocation leave?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Compare the complete additional allocation with the five GiB remaining.

Compare with the solution

The first draft adds 5.5 GiB, producing 30.5 GiB and exceeding the envelope by 0.5 GiB. A 4 GiB total draft allocation would produce 29 GiB, leaving 1 GiB under the stated accounting. Neither result predicts real acceptance or latency.

Take it with you

  • Evaluate proposal overlap and execution cost on relevant histories.
  • Budget weights, KV state, logits, workspace, and actual sharing.
  • Choose the net latency and capacity result rather than one acceptance percentage.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.