Prefill and decode: slow start and slow word are not the same bottlenecks
A request for services first handles known prefixes, creates a cache and gets the next distribution, usually called prefill; Then a new token is gradually generated, belonging to decode.
Learning objectives and first steps2 objectives . 1 first fix
Try to do it after reading
- Explain Prefill and decode: The slow start and slow end are not the same bottleneck mechanisms and prerequisites
- Positioning the mechanism ' s fault limits with fixed examples
Suggested first
- Self-regression generation and cache
Issues and mechanisms
A request for services first handles known prefixes, creates a cache and gets the next distribution, usually called prefill; Then a new token is gradually generated, belonging to decode. The parallelness of the two paragraphs and the features of the memory visit are different. Long input may slow down the first entry, long output may increase the total time, and the two cannot be described in full by a single token number per second.
End-to-end token time also includes queues, sequencing and network costs; The internal prefill of the model takes time to be only one of them. The first item can be followed by a report of a delay between token, and the entire request should also indicate the length of the output and the conditions for cessation. Batch processing may increase overall vomiting, while adding a single request to wait, so optimizing targets requires a clear choice between user experience and resource utilization.
A concrete example
The request for synthesis queues 30 milliseconds, prefix count 40, network and sequence ten, with an initial token time of 80 milliseconds. A total of six tokens were generated, each with a delay of seven milliseconds, the last one arriving at one hundred and fifteen milliseconds, as there were only five intervals after the first entry. If we add six by mistake, we'll get one more step. If you publish only seven milliseconds, you hide 80 milliseconds before you start.
Borders and checks
Preheat, compile, cache hits, and distribution of co-match and input length changes the result. For comparison to be achieved, these conditions should be fixed and reported as late and failed requests. The network flow buffer may bring together multiple tokens, which may not be observed at intervals equal to the time of progressive calculation on the equipment, and should avoid mixing two clocks.
If no output or request is cancelled, failures and cancellations should be listed separately and not removed quietly from time-consuming statistics; Otherwise, tail delays would be selectively underestimated.
A method of verification
If no output or request is cancelled, failures and cancellations should be listed separately and should not be deleted from time-consuming statistics. The initial delay should be clearly counted from the client, the receipt of services or the implementation of the equipment, and the starting point cannot be mixed. Also indicate whether the prefix cache is reused for the same input; Cached mean life-saving and unattainable combinations may mask cold start-up experiences. Interpretation is only possible before the comparative optimization, when the same clock and condition are defined.
Check understanding
Every new token seven milliseconds, does that mean the user can see the answer in seven milliseconds?
No, it's not. The first token also has to be queued and prefixed; A single steady state interval does not amount to a first delay.
Is it always faster than a single request for a higher configuration?
Not necessarily. More batch processing or more active queues could increase overall utilization while increasing waiting. It should be seen at the same time, with the first item and the tail delayed.
Sources and reconciliations
Definitions, methods and interfaces are available.
Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.