Unit 12 of 12 · about 4 hours · derive, measure
Predictions before profiles, residuals and goodput under latency targets
A prediction written after the profile explains everything and predicts nothing. Residuals against a prior prediction are the only honest evidence in this section.
You'll be able to
- Write a bottleneck prediction with numbers before profiling, then explain the residual from evidence.
- Measure goodput under explicit TTFT and TPOT targets and report what meets the objectives.
- Preserve one failed prediction with the observation that disproved it.
Covers
Read
In this order, only the parts listed
0 of 3 done
- A worked prediction tableEfficiently Scaling Transformer Inference
Section 4.4 with Tables 2 and 3 (pp. 9 to 10): the low-latency versus high-throughput rows as predictions, with cost as chip-seconds per token and MFU as the check
- Goodput from the benchmark result formatvLLM Benchmark CLI (v0.31.0)
Online Benchmark result format with request, output-token and total-token throughput beside mean, median and P99 TTFT, TPOT and ITL; Load Pattern Control Parameters for testing against a target rate
- Prediction-first measurementLLM Inference Systems Laboratory - Instrumentation
Milestone E: validate the operation, byte, launch, resource, KV, queue and capacity model and quantify residuals; optimize only measured critical-path terms
Focus on
- Write the prediction before the profile: the regime, the expected TTFT and TPOT ranges, and the bottleneck with numbers. Date it; postdiction is the failure mode.
- The residual is measured minus predicted with an attributed cause from spans or profiles, such as unmodeled launch overhead, queueing or cache effects.
- Goodput counts only requests meeting the TTFT and TPOT targets. Throughput without targets is not goodput, and a faster engine can have worse goodput under tight targets.
- Keep the failed prediction visible with its disproving observation. The checkpoint requires one, and it is the most portable artifact of the unit.
Common mistakes · 3
- Tuning the prediction after seeing the profile. A post-fit story has no residual; lock the numbers first.
- Reporting goodput without stating the targets. The same run has different goodput under different objectives, so targets are part of the number.
- Changing workload, cache state or versions between prediction and measurement. Residuals need identical contracts on both sides.
Try it yourself
Closed-book, before checking anything
vllm bench serve --request-rate 4 --goodput ttft:500 tpot:50 against both, compute the residuals, and attribute each to evidence.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What must a prediction contain to admit a residual?Answer
The regime, numeric TTFT and TPOT ranges, and the named bottleneck, written before profiling under a fixed contract.
2.Measured TPOT doubles the prediction while TTFT matches. What class of cause fits?Answer
A decode-side miss: interference from concurrent prefills, cache pressure, or unmodeled per-step overhead. Prefill-side causes would move TTFT.
3.Engine A has higher throughput but lower goodput than engine B under strict targets. Consistent?Answer
Yes. Goodput counts only requests meeting the targets; A can serve more tokens while missing the objectives more often.
4.Why preserve a failed prediction instead of replacing it with the corrected one?Answer
The failure with its disproving observation records a tested boundary of the model. The corrected prediction alone hides what was ruled out.
You're done when
You hold a dated prediction, measured residuals with attributed causes, a goodput number with stated targets, and one preserved failure.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 9 more in the 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.
- 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. - 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.
Also in this section
- 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 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.
- 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.
- 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.
- 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.