The latency budget
What it is
Latency is how long the user waits. A latency budget assigns a time allowance to each stage so the total meets a target. Two numbers matter:
- Time to first word: how long until the answer starts appearing.
- Total time: how long until it finishes.
Everything before generation, plus the model's own start-up time, adds to the first; the length of the answer decides the second.
Why it matters
With streaming, users judge speed by the first word, so that is the number to defend.
- The language model usually dominates, and the retrieval stages are small beside it, but every extra model call placed before the answer (rewriting, HyDE, grading) adds directly to the wait.
- Report latency as a percentile such as p95 (95 percent of questions are faster than this), because the average hides the slow cases users remember.
In the real world: A support chat sets a target of first word within 1.5 seconds at p95, finds the rewrite step is the biggest pre-generation cost, and skips it for first messages with no history.
Visual example
ComputedStage times add up to 1,130 ms before the first word. The retrieval steps are a small part of it.
Optimising the vector search from 20 to 10 milliseconds while a query-rewrite call takes 300. Measure every stage first and work on the largest.