Topic 1
What a fair benchmark holds fixed
A benchmark answers one question: did the thing I changed make a difference? It can only answer if everything else stayed the same. Most misleading inference numbers aren't wrong; they were measured under different conditions from the number they are compared with.
The first two lessons already showed what moves the result:
- Model and precision. Bytes per weight set how much decode reads (lesson 2).
- Prompt and reply lengths. On the laptop CPU, the first token took 12.8 ms after a 16-token prompt and 223.3 ms after a 960-token one (lesson 1).
- Batch size, concurrency and arrival rate. Total throughput rises with the batch while each user's tokens slow down.
- Warm-up. First calls pay one-off costs. Every script in this module runs untimed requests before timing anything.
- Repeats and percentiles. 200 identical requests gave a p50 of 61.3 ms and a p99 of 112.8 ms. Report percentiles, TTFT and TPOT separately, never one run or the mean.
- The environment. Hardware, threads, library versions, power state and method. The next page shows why.
- The unit. Tokens differ between tokenizers, so AI Engineering (Ch. 9, "Throughput and goodput") suggests comparing cost per request across systems.
Scroll sideways to see the whole diagram
Decide what is held fixed. Two numbers are comparable only if everything except the thing you are testing is the same.
Text version
- Decide what is held fixed. Two numbers are comparable only if everything except the thing you are testing is the same.
- Throw away the first runs. Our scripts ran two or three untimed requests before timing anything.
- Time the same request many times. One run is one draw from a distribution.
- Summarise with percentiles. A few slow runs move the mean without telling you how slow they were.
- Write down everything you didn't vary, so someone else (or you, next month) can tell whether a new number is comparable.
After AI Engineering, Ch. 9, "Inference Performance Metrics", and the measuring routine in scripts/generate-latency-data.py.
Quick check