Lesson deck
Scheduling and decoding flashcards
Reviewing needs JavaScript. You can read every card in the list below.
Loading your cards...
Back to the lesson12 cards in this deck
Read all 12 cards as a list
- Front
- Static versus continuous batching?
- Back
- Static: wait for N, run until all finish; short requests wait for the longest. Continuous: re-form the batch every step; finished sequences leave, waiting ones join. Needs on-demand cache allocation.
- Front
- Why does a large prefill freeze streaming?
- Back
- It occupies a whole step. 16,000 tokens on an 8B model is at least about 259 ms at peak, so every running decode waits that long for its next token.
- Front
- How does chunked prefill work, and what does the budget trade?
- Back
- Each step holds one token per running decode plus a chunk of the waiting prompt up to a token budget. Smaller budget: smoother ITL. Larger: faster TTFT for long prompts. Prefill compute is unchanged.
- Front
- State Little's law and use it for capacity.
- Back
- L = λW: requests in flight = arrival rate × time in system. Sustainable rate = concurrency limit ÷ time a request holds a slot (queue wait excluded). 20 sequences held for 8 s each is 2.5 requests per second.
- Front
- What do you do when demand exceeds capacity?
- Back
- Admission control (reject early with 429 or 503 and a retry hint), priority for interactive traffic, per-tenant quotas, preemption of lowest priority, and cancel on disconnect. Queues alone do not help.
- Front
- How does speculative decoding work?
- Back
- A cheap draft proposes γ tokens; the target scores all of them in one pass. Accept each with probability min(1, p/q); on a rejection resample from norm(max(0, p − q)) and stop.
- Front
- Speculative speedup formula?
- Back
- Expected tokens per step = (1 − α^(γ+1)) / (1 − α). Speedup = that ÷ (γc + 1), with c the draft step time over the target step time. α = 0.8, γ = 4, c = 0.05 gives about 2.8.
- Front
- Is speculative decoding lossy?
- Back
- No. With correct accept and reject sampling the output distribution equals the target's for any draft; a poor draft only lowers speed. Hardware numerics can still cause small variation.
- Front
- When does speculative decoding stop helping?
- Back
- Verification processes about (γ + 1) × B tokens per step. Past the ridge it is no longer free, so gains shrink at high batch or load. Low acceptance rate also kills the gain.
- Front
- Name draft sources for speculative decoding.
- Back
- Separate small model; Medusa heads (tree attention); EAGLE head over target features; multi-token prediction built into the base model; n-gram or prompt lookup (training-free, good when output repeats input).
- Front
- What is prefill and decode disaggregation?
- Back
- Separate pools: prefill machines compute the KV-cache and send it over a fast link to decode machines. Each pool is tuned for its own target. Costs: transfer, two pools, capacity waste.
- Front
- How big is the KV transfer, and when is disaggregation worth it?
- Back
- 4,096 tokens on a 70B model is about 1.34 GB, about 27 ms at 400 Gb/s line rate. Worth it at high volume with strict TTFT and ITL targets and long prompts; chunked prefill first for small deployments.