Unit 11 of 11 · about 6 hours · implement, measure
A topology and capacity simulator, evidence labels and cost comparison
A simulator can rank plans only within its assumptions. Plausible latency samples are not measured cluster evidence, and omitted queues or ownership constraints can make an infeasible placement look best.
You'll be able to
- Implement deterministic replay with rank memory, phase queues, shared links and bounded KV handoff ownership.
- Label analytical, simulated and measured evidence separately, and validate simulator predictions against independent oracles.
- Compare colocated and disaggregated plans by SLO-qualified goodput, utilization, KV traffic and cost under the same arrivals and resource budget.
Covers
Read
In this order, only the parts listed
0 of 2 done
- Audit a lightweight placement modelAI Systems Performance Engineering companion code - Chapters 15 and 17
PlacementConfig, PlacementMetrics and PlacementSimulator: simulate, _prefill_latency_ms, _decode_latency_ms, _kv_transfer_ms and _allreduce_ms
Read and exercise the CPU path only. Its returned TTFT excludes its computed prefill collective cost. Its KV formula omits layer/head geometry, and it has no arrival queues or local memory admission. Restore these terms in your model before comparing capacity; its bandwidth names and comments also need an explicit bits/s versus bytes/s and direction convention.
- Calibrated service models and placement evidenceDistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM Serving
arXiv:2401.09670v3, Appendix A.1 to A.3 Latency Model for LLM Inference; Section 4.1, Simulator building paragraph; Section 6.4 Ablation Studies, Simulator accuracy paragraph and Table 2
Read how profiling fits phase coefficients and how prediction error is evaluated. Do not reuse its OPT/A100 coefficients or universalize its kernel-bound classifications. A fitted service model still needs queue, topology and memory validation for your workload.
Focus on
- Build on A continuous-batching simulator with deterministic replay and event traces, and Communication measurement contracts and analytical or CPU simulation. Add rank ownership, topology links, phase transfer credits and attempt-fenced terminal events rather than reimplementing those foundations.
- Replay an immutable arrival trace through equal-budget plans. Log offered, admitted, rejected, failed, retried and completed requests, phase waiting, TTFT, decode gaps and peak per-rank KV. Count one logical completion even when attempts repeat.
- Use a declared observation window and completion policy. Goodput counts only accepted completions meeting the quality and latency contract per elapsed second. Utilization is resource busy time over available time, not a sum of request latencies; cost per good completion includes idle reserve, failed work and retries.
- Label formula results analytical, event-model outputs simulated and actual device observations measured. A CPU simulator's wall-clock runtime is not GPU service latency. If you calibrate on your GPU, record the model, dtype, engine/version and shapes, validate on held-out shapes, and keep multi-device extrapolations simulated.
Common mistakes · 3
- Calling synthetic percentile outputs measured tail latency. Independent length samples without arrival queues cannot reveal queueing tails or saturation.
- Using the sum of request service times as elapsed benchmark time when requests overlap. Goodput and cost need a common observation window.
- Removing rejected or failed work from the offered-load denominator, counting retries as new successes, or comparing plans with different warm reserve and device cost.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Why does the admission-limited replay have the same goodput but lower utilization?Answer
Both runs have two SLO-qualified completions in the same 6 ms window. The unlimited run spends 6 ms serving three requests, including one late completion; the limited run serves two requests for 4 ms and rejects the other.
2.Does matching one isolated-request latency validate capacity predictions?Answer
No. Capacity also depends on batching, arrivals, shared resources, memory admission and ownership. Validate those constraints and held-out workload mixtures separately.
3.Can a fitted single-GPU service curve make a cross-node comparison measured evidence?Answer
No. Only the calibration observations are measured. Unobserved collective, transfer and contention behavior remains analytical or simulated, with its assumptions stated.
4.What should happen when a placement violates one rank's KV budget?Answer
Reject the placement or simulate its declared admission, eviction or preemption policy. Do not report its unconstrained latency as feasible capacity.
You're done when
Your replay matches the hand timelines and resource ledgers, infeasible plans cannot win, and your equal-budget comparison separates simulated predictions from measurements and includes a negative regime.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 11 more in the section
- DistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM ServingPeking University and Microsoft Research · primary
Read the interference model, independent phase parallelism, placement, KV transfer and goodput evaluation. Reuse the break-even method with your workload and topology; do not transfer the paper's speedups to different hardware.
- AI Systems Performance Engineering companion code - Chapters 15 and 17Chris Fregly · required
Use the single-device KV-handoff and simulation paths before the multi-GPU pairs. Then choose one disaggregation, routing or MoE target compatible with available hardware and keep bundled results separate from newly captured evidence.
Also in this section
- AI Systems Performance Engineering - Chapters 15 and 17, distributed and disaggregated inferenceChris Fregly (O'Reilly) · required
Read the disaggregated prefill and decode architecture and the MoE parallelism strategies in Chapter 15, then Chapter 17 on disaggregated pools, routing policies and scalability. Reproduce every communication and KV-transfer estimate for a small declared topology.
- Hands-On LLM Serving and Optimization - Chapter 7, multi-GPU and disaggregationChi Wang and Peiheng Hu (O'Reilly) · support
Read "Multi-GPU and Multi-Node Inferencing" (data, tensor, pipeline and expert parallelism) and "Prefill-Decode Disaggregation" (architecture, KV transfer, when to use it) in Chapter 7.
- NVIDIA Dynamo - Disaggregated Serving and KV-Aware RoutingNVIDIA · required
Trace frontend, prefill router, prefill worker, KV transfer, decode routing and decode worker. Record how load, cache overlap, worker discovery and transfer metadata affect placement; implement only a small simulated or available-hardware slice.
- TensorRT-LLM Disaggregated Serving and KV Cache ExchangeNVIDIA · required
Study the KV exchange abstraction, unique request identity, layout conversion, overlap and fleet-worker model. Use its reproducible benchmark sections only on supported hardware and pin the release.
- SGLang documentation - PD DisaggregationSGLang Project · support
Use the transfer backends, router integration, heartbeat, timeout and cleanup behavior as a second engine's view of the same handoff.
- Mooncake: A KVCache-Centric Disaggregated Architecture for LLM ServingMoonshot AI · support
Read the KV-centric architecture, transfer engine and scheduling sections to understand remote cache pools. Compare its assumptions with DistServe and your simpler handoff; defer reproduction requiring a large cluster.
- 100 Days of LLM Inference - Days 12, 17 and 18Elizabeth Thomas · support
Use the Dynamo, model-parallelism and disaggregation notebooks for a compact topology simulator and request-handoff trace. Label notebook outputs as local analytical or simulated evidence unless real devices were used.
- TensorTonic Language Modeling from Scratch - Route Cache-Aware Prefill RequestsTensorTonic · support
Solve after the routing unit and compare its cost rule with your own placement model.
- LLM Inference: From scratch, one token at a time - Module 09Tushar Amrit · support
Work the Distributed Inference module's communication arithmetic before the tensor and pipeline parallel units.
- AI Performance Engineering - Distributed InferenceWafer · reference
A curated index. Use Section 5 only to find a distributed-serving paper the other entries lack.
- Python 3.14 hashlib - byte digests for KV integrity checksPython Software Foundation · reference
Usage and Hash Objects only: compute and compare a SHA-256 digest over a declared canonical KV payload. Add request/version checks separately; a byte digest is not cache compatibility or authentication.