Unit 10 of 12 · about 3 hours · measure
Repeated trials, uncertainty and observer overhead
One fast run proves nothing, and a heavy observer changes the result. Trials plus overhead accounting are what make a baseline trustworthy.
You'll be able to
- Run repeated interleaved trials and report uncertainty instead of single-shot means.
- Quantify observer overhead from metrics, logging and profiling, and keep it out of the critical path.
- Reuse the validated load generator so arrivals do not change between trials.
Covers
Read
In this order, only the parts listed
0 of 2 done
- Repeated sweeps with two-tool cross-checksTime to First Token - Measurement and Load-Testing Sessions
Week 5 deliverable: the scripted concurrency sweep past 1000 concurrent runs cross-checked by two tools, with p50, p95 and p99 throughout
- Observer overhead and where metrics livevLLM Metrics Design and Production Metrics
Metrics Collection on moving bookkeeping out of the engine core into the frontend; KV Cache Residency Metrics with sampling keeping the overhead tiny
Focus on
- Use the interleaved-trial discipline from the Interleaved trials, raw samples and uncertainty unit: alternate conditions, seed the order, keep raw samples and report uncertainty, not just means.
- Metrics, logging and tracing cost time and memory. Measure with the observer on and off, and sample expensive telemetry instead of recording everything.
- Cross-check with a second tool before believing a number. Two harnesses that agree rule out harness bugs that repeats of one harness never catch.
- Arrivals are part of the trial. Reuse the validated open- and closed-loop load generator so arrivals from
vllm bench serve --request-rate 4 --burstiness 1.0 --seed 0stay fixed while you vary the engine.
Common mistakes · 3
- Averaging ratios across trials with an arithmetic mean. It is asymmetric, since the mean of A/B is not the inverse of the mean of B/A; report the ratio of aggregates or the geometric mean of per-trial ratios with uncertainty.
- Profiling every trial. Full traces on all repeats inflate overhead and disk use; profile one localized case after trials establish the effect.
- Changing the arrival process between trials. A different burstiness or seed moves queueing, which then masquerades as an engine difference.
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 interleave trials instead of running all of condition A then all of B?Answer
Interleaving spreads slow drifts in temperature, clocks and background load across both conditions instead of confounding them with the condition.
2.How do you show the observer did not distort a result?Answer
Run the same trials with the observer on and off, or with sampling on and off, and show the effect is unchanged within uncertainty.
3.Two tools disagree on TPOT for the same workload. What first?Answer
Check definitions and measurement points: per-gap ITL versus per-request TPOT, client versus engine clocks, and included versus excluded single-token requests.
4.When is a single trial enough?Answer
For a correctness gate or a smoke check, never for a performance claim. Claims need repeats with uncertainty.
You're done when
Every number you quote carries its trials, its uncertainty and its observer check, and a second tool agrees.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 10 more in the section
- vLLM Metrics Design and Production MetricsvLLM Project · required
Map scheduler and cache events to exported request, queue, TTFT, inter-token and generation metrics. The link is pinned to v0.31.0; check the definitions against the version you install.
- Time to First Token - Measurement and Load-Testing SessionsPatchy631 · support
Use only Week 3 and Week 5 as a practical checklist for Prometheus, Grafana and request-rate sweeps. Follow the competency gate rather than its calendar, and replace fixed concurrency goals with your hardware-safe saturation range.
Also in this section
- Efficiently Scaling Transformer InferenceMLSys · primary
Read the prefill and decode cost, memory, batching and parallelism sections. Use its models to predict phase bottlenecks before measurement and record which assumptions fail on the selected model, engine and GPU.
- AI Systems Performance Engineering - Chapter 16, profiling and debugging inferenceChris Fregly (O'Reilly) · required
Read the first part of Chapter 16: monitoring system metrics, profiling with Nsight Systems and Nsight Compute, the troubleshooting recipes and debugging correctness. Treat every quoted speedup as a hypothesis for your own hardware.
- AI Systems Performance Engineering companion code - Chapter 16Chris Fregly · required
Begin with inference_profiling.py, inference_server_load_test.py, monitoring_bundle.py and runtime scheduler instrumentation. Run only hardware-compatible targets, retain raw artifacts and re-measure all bundled expectations on your own device.
- Hands-On LLM Serving and Optimization - Chapter 5 and the Chapter 4 metrics sectionChi Wang and Peiheng Hu (O'Reilly) · required
Read Chapter 5 on GPU specifications, model loading and arithmetic intensity in the prefill and decode phases, and "Measuring Performance in LLM Serving" in Chapter 4. Turn each claim into a prediction for one short-prompt and one long-prompt workload.
- vLLM Benchmark CLI (v0.31.0)vLLM Project · required
Use
vllm bench latency,vllm bench throughputandvllm bench servefor phase and endpoint baselines. Fix the dataset, lengths, request rate, warmup and sampling, and keep the raw per-request results. - TensorRT-LLM Benchmarking GuideNVIDIA · support
Use Before Benchmarking and Online Serving Benchmarking as a reproducibility checklist. Borrow environment capture and startup metrics even if TensorRT-LLM is not the selected engine.
- LLM Inference Systems Laboratory - InstrumentationRoadmap-Final · support
Complete Milestone B: correlate request, iteration, KV, scheduler, kernel and resource events, quantify observer overhead, and retain raw arrival and completion records.
- Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-ServeAgrawal et al. · support
Read arXiv v3, Chunked-prefills and Stall-free batching for the chunked-prefill vocabulary and the prefill-decode interference argument, and Overhead of chunked-prefills for the cost of splitting. Treat the reported capacity gains as the paper's result on its hardware.
- py-spy - sampling profiler for PythonBen Frederick · support
Use py-spy record to take CPU flame graphs of tokenizer and detokenizer work, and py-spy top to watch the hot functions live. Launch the profiled process under py-spy.
- vLLM SamplingParams API (v0.31.0)vLLM Project · reference
Look up
temperature,seed,max_tokens,ignore_eos,stopandstop_token_idsdefaults when you fix the output contract. The link is pinned to v0.31.0; check the fields against the version you install.