Lab: disaggregated prefill and decode on two GPUs
Run the same model colocated and disaggregated (one prefill GPU, one decode GPU, KV cache moved between them), drive it with a workload of mixed short and very long prompts, and measure what happens to inter-token latency, time to first token and goodput. Predict with the course's simulation first; explain every difference.
By Sandip Maity, Applied AI Engineer
Goal: see the prefill/decode interference problem on your own hardware, then measure what disaggregation fixes and what it costs, against a fair baseline.
You need: two NVIDIA GPUs in one machine (NVLink preferred; PCIe works and is instructive), vLLM or SGLang with disaggregation support, a 7 to 8B model, loadgen.py from the baseline-to-3x lab, and about two hours.
Honest limits. Disaggregation is the fastest-moving part of open-source serving: connector names, router commands and flags change between releases. Follow your engine's current disaggregation guide for the exact launch commands; this lab gives the structure and the measurements. NVIDIA Dynamo and llm-d are alternatives that wrap the same idea.
#Step 0: the workload
Mix short chat requests with occasional very long prompts, which is where interference shows:
80% of requests: prompt 500 tokens, output 200 tokens
20% of requests: prompt 16,000 tokens (a long document), output 200 tokens
SLOs: TTFT p95 <= 3 s; TPOT p99 <= 60 msEdit loadgen.py's prompt and output length lists, or add a weighted choice, to produce this mix.
Pro content
Keep reading with Inference Academy Pro
Unlock this full lab, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.
Still to come in this lab
- Step 1: predict
- Step 2: the fair baseline, two colocated replicas
- Step 3: disaggregated, one prefill GPU and one decode GPU
- Step 4: fill the table
- Step 5: explain
- Self-check
- Stretch goals
You will be able to answer
- What should disaggregation improve most in this lab?
- Time to first token got worse after disaggregating. Name a likely cause.
- Why compare against two colocated replicas, not one?
Articles that build on this lesson