Topic 5
Capstone: the workload and its targets
The module's capstone: optimize a defined workload against latency, throughput and cost constraints, documenting assumptions and trade-offs. Here is the workload and what it must meet. The next page is the planner.
The workload. A chat service on the laptop from lessons 1 and 2, serving GPT-2 small in float32. 600 requests arrive at random, 6 per second on average (Poisson arrivals, as in MLPerf's Server scenario), over about 102 seconds. Prompts are 16 to 512 tokens and replies 8 to 256, drawn at random: 48,136 output tokens in all, about 473 per second.
The targets.
- Latency: p90 time to first token at 6 requests per second ≤ 300 ms.
- Throughput, as capacity: once a server keeps up, its output rate is set by demand, so the real question is how much more traffic it could take. The highest arrival rate at which p90 TTFT still meets 300 ms must be at least 9 per second, 1.5 times today's.
- Memory: weights plus KV cache ≤ 2 GB. This is a budget set for the exercise; the laptop has more.
- Cost: ≤ $0.001 per 1,000 output tokens at today's traffic, at the machine's price per hour. The price is illustrative: $1 per hour by default, editable.
Scroll sideways to see the whole diagram
You choose the configuration. The workload and the targets are fixed.
Text version
- You choose the configuration. The workload and the targets are fixed.
- The simulator replays the 600 requests, timing every prefill and decode step from the laptop measurements.
- Latency: at today's 6 requests per second, 90% of first tokens must arrive within 300 ms.
- Capacity: the planner raises the rate one request per second at a time until p90 TTFT breaks 300 ms. It must hold at 9 per second, 1.5 times today's traffic.
- Memory needs no simulation: one copy of the weights plus a full-length KV cache for every seat in the batch.
- Cost: the machine's price per hour divided by the output tokens it produced per hour at today's traffic.
lib/labs/benchmark.ts: simulate() timed with the measured GPT-2 steps in lib/labs/data/bandwidth.json; the $/hour is illustrative.
Predict first