Inference prep
Study plan
Day 5 of 13 · Dec 2, 2026

Measure one stream end to end

Client and server clocks may differ. Measure client intervals on one monotonic clock, then correlate gateway events by request ID.

Before you start

A working gateway and its failure tests. Run one request without concurrency before building a load generator.

Read and predict 1 hour including video

Inference Engineering · §1.4.1–1.4.2 pp. 36–38; §4.5 pp. 112–115; §7.4.3 pp. 203–204

Use the printed page numbers. In the supplied PDF, add two to reach the viewer page. Write a prediction for the question below before opening its answer.

Prometheus · histograms · Baseten · Inference Engineering

MIT Missing Semester · Debugging and Profiling

Optional, 15 min. Use the logging and profiling examples to identify one observation that distinguishes waiting for a worker from spending CPU time in Python.

Play lecture
Open original lecture

Build and test 3 hours

Instrument admission, queue wait, first content token, inter-token gaps and completion. Compare equal and mixed prompt lengths. Check histogram units.

  1. Timestamp one request

    Record arrival, admission, first content token and last token using the same monotonic clock. Save the output token count.

  2. Calculate two metrics

    For arrival 0 ms, first token 150 ms, last token 350 ms and five tokens, TTFT is 150 ms and TPOT is 50 ms.

  3. Combine two replicas

    Emit histogram buckets with matching boundaries. Sum by bucket before estimating p95. Report completed and attempted counts beside the percentile.

Open benchmarks
Troubleshooting

If the slowest run looks best, inspect which timed-out requests disappeared from the sample.

Save your result 1 hour

Save requests.csv with an attempt ID, status, first-token time, finish time and output count. Record failures even when TTFT is undefined.

Explain from memory 1 hour

A stream has one output token. What goes in the TPOT column?

Check your reasoning

Leave it undefined. There are zero inter-token intervals. Count the successful completion separately.

Save a latency distribution plus a request count. Explain how excluding timeouts can make p95 look better.