06.04

Disaggregated prefill and decode

skillmaxingInference EngineeringDisaggregated prefill and decode
Visual lesson

Disaggregated prefill and decode

Included with Pro · 5:14
Lessons · 1,197 words

Prefill and decode are different jobs sharing one GPU. Prefill crunches thousands of prompt tokens in one burst and is limited by compute. Decode produces one token per step for every running request and is limited by memory bandwidth. When both run in the same batch, a big prefill makes the step longer for every user who is waiting on their next token.

Disaggregation puts them on different GPUs. A prefill worker computes the prompt's KV cache and the first token, ships the KV cache to a decode worker, and the decode worker streams the rest. Each pool can then be sized and tuned for one metric: prefill for time to first token, decode for inter-token latency. The price is a transfer of the KV cache for every request, and a more complicated system.

Pro

Continue reading

Pro unlocks every video lesson, the full notes, worked sizing and cost calculations, and runnable configs across the Inference Engineering course, from GPUs and kernels to quantization, speculative decoding, disaggregation and production autoscaling.

Unlock full access to
Python with AIInference EngineeringAI researchComplete system design
30% off with LAUNCH30first payment
Buy now
View all plans ·Already Pro? Sign in