Topic 4
Prompt length and hardware
TTFT is mostly prefill, and prefill reads the whole prompt, so a longer prompt means a later first token. How much later, and how much better hardware helps, is something to measure, not guess.
Predict first
The calculator interpolates between the prompt lengths we measured and adds the measured gap per output token. Its assumptions are listed under it; open them. Try:
- 256 in, 200 out: about 1.71 s on the CPU, 1.22 s on the GPU. Output dominates: decode is 96% of the CPU total.
- 960 in, 32 out: the first token alone is 223 ms on the CPU, and output is now less than three-fifths of the total.
Notice what does not change much with prompt length: the time per output token, 7.7 to 9.7 ms on the CPU across all lengths. Long prompts mainly cost you up front.
Comparing hardware fairly
"The GPU is 2× faster" is only true for a given workload. Here the answer was 1.6× or 2.3× depending on prompt length, and the throughput page shows it also depends on how many requests run at once. AI Engineering (Ch. 9) suggests plotting TTFT against input length rather than quoting one number; that is exactly the curve in the calculator.
Quick check