Overview
Hao AI lab introduced distserve jan 2024, proposed a simple architectural change:
separate llm inference into two stages:
a. prefill - process input prompt and build KV cache, reads the entire prompt, processes all prompt tokens through transformer, builds KV cache, generates the first output token
b. decode - generate output tokens one at a time using the KV cache. generates remaining tokens one by one, reuse kv cache, continue until completion
run these stages onto separate GPU clusters (compute pools)
scale prefill and decode independently according to workload demand
it has been adopted by NVIDIA, ray serve, SGLang, vLLM, Mooncake
distserve established two standard latency metrics:
a. TTFT - affected by prefill performance
b. TPOT (time per output token) - affected by decode performance
Before (Colocation)
prefill and decode stage shared same GPUslarge prefill requests could block/slow down ongoing decode requests
all requests have to wait/fight for GPU time.
After (Disaggregation)
prefill GPUs handle prompt processing only
decode GPUs handle token generation only
independent scaling, improves latency under dynamic workloads
lower serving costs
but PD disaggregation increases the TTFT because the KV cache transfer takes time

PD real win is stable TPOT under heavy load

TPOT savings compound over output sequence length

workload
cache hit rate
bottleneck
long input short output
0%
prefill
long input long output
0%
decode
multi turn
80%
decode
afsdafdsf