DistServe Disaggregated Queues and Dual Latency SLOs
DistServe · OSDI 2024 · Medium · 40 minutes
Replay separate prefill/decode queues and compute goodput subject to both TTFT and TPOT.
An FCFS discrete-event model with one prefill worker and one decode worker, including KV-transfer waits; request-serial decoding is a teaching simplification.
Functions to implement
disaggregated_trace(arrivals: list[float], prefill: list[float], decode: list[float], transfer: list[float], tokens: list[int]) -> tuple[list[float], list[float]]slo_goodput(arrivals: list[float], first: list[float], last: list[float], tokens: list[int], ttft_limit: float, tpot_limit: float) -> float
DistServe Disaggregated Queues and Dual Latency SLOs
1. Problem
Replay separate prefill/decode queues and compute goodput subject to both TTFT and TPOT.
An FCFS discrete-event model with one prefill worker and one decode worker, including KV-transfer waits; request-serial decoding is a teaching simplification.
Source: DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving · Sections 2 and 3: TTFT/TPOT, disaggregated prefill and decoding, goodput.
2. Core equations
$$ F_i=\max(A_i,F_{i-1})+P_i,\quad E_i=\max(F_i+K_i,E_{i-1})+(n_i-1)D_i,\quad TTFT_i=F_i-A_i,\quad TPOT_i=\frac{E_i-F_i}{n_i-1}. $$
3. From equations to code
disaggregated_trace(arrivals: list[float], prefill: list[float], decode: list[float], transfer: list[float], tokens: list[int]) -> tuple[list[float], list[float]]— First- and last-token times under independent FCFS workers.slo_goodput(arrivals: list[float], first: list[float], last: list[float], tokens: list[int], ttft_limit: float, tpot_limit: float) -> float— Joint TTFT/TPOT-compliant request rate over the observation horizon.
Maintain separate worker clocks. Decode waits for its own worker and the current request’s prefill plus transfer. Average TPOT includes all waiting between first and last tokens, not only raw decode service cost.
4. Conventions
Equal-length numeric lists: nonnegative sorted arrivals, positive prefill/decode costs, nonnegative transfer costs, integer tokens>=2. Prefill completion F produces the first token; KV transfer affects later decoding. Each worker follows input FCFS order and transfer may overlap. Return (first,last). Goodput is jointly compliant requests divided by max(last)-min(arrivals), with inclusive thresholds.
5. Experiment view
Replay three simultaneous requests with prefill cost four, decode cost one and three output tokens, sweeping KV-transfer time. Report first/last-token times and jointly compliant goodput.
The chart is generated by the actual submitted kernel during T3 and by the reference during export. Values are synthetic teaching measurements, not GPU throughput or full-model quality claims.
6. Run your implementation
Complete the functions in the Python editor on the right, then click Run tests. Inspect each failed check, update your implementation, and run again. Passing every required check marks the problem as solved and unlocks the notes.
7. Further study
Read the cited section and explain which dimensions or scheduling constraints the kernel preserves. Then extend the experiment beyond the stated fixture while retaining the existing contract. Larger models, real devices, and communication costs require separate measurement.