# What Is Prefill/Decode Disaggregation?

> How splitting prefill and decode onto separate GPU pools works, why it can help, and what it costs, explained for your AI interview.

**In short:** Prefill/decode disaggregation runs the two stages of an AI request on separate pools of GPUs, so each pool can be sized and tuned for its own job. The price is copying the saved keys and values between pools, so it often isn't worth it for small or short-prompt workloads.

AI and LLM interview question Q335, Inference, performance and cost. Advanced, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-prefill-decode-disaggregation

## Say it in 30 seconds

A model answers in two stages: prefill reads the input, and decode writes the reply. Usually one pool of GPUs does both, so the stages can slow each other down. Disaggregation puts each stage on its own pool, sized and tuned for its job. The gain is steadier streams on a busy system. The price is copying the saved keys and values between pools, plus a router and a machine ratio to tune. For small or short-prompt workloads, one pool is often simpler.

## Say it in 2 minutes

A model answers in two stages. Prefill reads the whole input, and decode writes the reply one token at a time. Normally one pool of GPUs does both, and that means the two stages can slow each other down. Disaggregation puts prefill and decode on separate pools, so each can be sized and tuned for its own work.

The reason it helps is that a long reading pass can delay other users' streams on a shared chip. Splitting the pools lets me add prefill machines for long documents and decode machines for many open chats, and set each pool's layout on its own. The measure to talk about is goodput: how many requests per GPU finish inside both the first-word limit and the per-word limit.

The cost is real. Each request's saved keys and values have to move from the prefill pool to the decode pool, so the network matters. I also need a router and a sensible ratio of machines. vLLM's docs say its disaggregated prefill does not improve throughput, so there it is a tool for latency control. DistServe reports that it can serve more requests than state-of-the-art systems, in its own evaluations. For small models, short prompts or low traffic, I would keep one pool.

In the interview, I would name the two stages, the interference, the goodput target and the cache copy. That shows I know both the gain and the price.

## What is prefill/decode disaggregation, in plain words?

A model answers a request in two stages. Prefill reads the input, and decode writes the reply (see the Prefill vs Decode Phases answer). Normally one group of GPUs does both. Disaggregation means splitting the two stages onto separate groups of GPUs, called pools, so each pool can be set up and tuned for its own job.

Think of a busy restaurant kitchen. When one cook takes a huge catering order and the table orders at the same time, every table waits. Many kitchens split the prep station from the grill line, so each can be staffed for its own work. For an AI support assistant, the catering order is a 50,000-token loan file pasted into a chat (made up), and the table orders are the short replies customers are waiting for.

- **Pool:** A group of GPUs set up for one kind of work, with its own size and settings.
- **Disaggregation:** Splitting one job into parts that run on separate pools.
- **Interference:** One kind of work slowing another that shares the same chip.
- **KV transfer:** Copying the saved keys and values from one pool to the other.
- **Goodput:** The request rate a system keeps while meeting its latency targets.

## Why do the two stages get in each other's way?

On one shared pool, a long reading pass can land in the middle of other users' token streams. Those users see a pause, even though their own requests are small. Researchers call this interference. The DistServe paper, listed for OSDI 2024 on arXiv, puts the problem this way:

> "We find that this strategy not only leads to strong prefill-decoding interferences but also couples the resource allocation and parallelism plans for both phases." (DistServe paper (OSDI 2024))
>
> "Without disaggregated prefilling, vLLM may insert some prefill jobs during the decoding of one request." (vLLM project docs)

The vLLM docs add that this raises the slow end of token timing, which they call tail latency. Splitting the stages removes that clash, because each pool only does one kind of work.

## What does splitting buy you?

Three gains, in plain words. First, each pool scales on its own: add prefill machines when prompts get longer, and decode machines when more people chat at once. Second, each pool can use its own layout (how the model is spread over the chips), so the first-word time and the time per word can be tuned apart. vLLM's docs list this as one of two main reasons to split.

Third, the target is goodput, the measure the DistServe paper is built around. It counts useful speed under latency limits. DistServe measures a system by the maximum rate it can serve while staying inside both the time to first token (TTFT) and the time per output token (TPOT) limits, on each GPU. Its paper says these two latencies matter, and that without a split a team has to favour one or over-provision to meet both.

The Splitwise paper, submitted to arXiv in November 2023, proposed the same split and argued that it lets a team provision resources for each phase independently. Moonshot AI's Mooncake, the serving platform for Kimi, a leading LLM service, separates the prefill and decoding clusters. Its paper calls it a KVCache-centric disaggregated architecture.

## What would this look like for a real team?

Take a bank's support assistant running on one shared pool of 8 GPUs (made-up setup). Most chats are short. Then a compliance officer pastes a 50,000-token loan file (made up) into a chat. The pool spends a burst of compute reading it, and the short chats already streaming pause mid-sentence. The numbers below are made up to show the shape of the problem. None of them come from a benchmark.

- **Before: One shared pool.** New chats wait about 2 seconds for the first word (made up). Streams pause for about 0.3 seconds each time a long file is read (made up).
- **After: Split pools.** A prefill pool of 3 GPUs reads the file, and a decode pool of 5 GPUs keeps streams steady. First words come in about 1 second (made up), cache copy included, and the pauses go away. The 3 and 5 GPU split needs retuning when traffic shifts.

*Diagram, One pool or two: Top: one pool does both stages, so a long reading pass can stall chats. Bottom: two pools, each sized for its own job, with the saved keys and values copied across.*
1. A long reading pass delays other users' tokens on the same pool.
2. The saved keys and values are copied across to the decode pool.
3. The decode pool streams tokens at its own steady pace.

The fix changes how the GPUs are sized, and the model stays the same. The reading pool can get more GPUs for long files, and the streaming pool stays sized for the number of open chats.

## What does the split cost?

The split has a price. The Splitwise paper says that splitting a request across machines needs its state moved from the prompt machine to the token machine. Its authors built that move on the fast interconnects available in GPU clusters.

> "It is not automatically better. For small models, short prompts, low concurrency, or clusters without a fast KV-transfer fabric, an aggregated deployment is simpler and often faster." (NVIDIA Dynamo docs)
>
> "TCP is slow enough that transfers of long prompts can exceed the engine's KV transfer timeout, and requests fail." (NVIDIA Dynamo docs)

- **Copying the cache:** The saved keys and values move between pools on every request. When Dynamo scales across several machines, it needs an RDMA-capable network, which lets one machine write straight into another's memory, to keep that copy short. A slow link can make the copy the whole wait.
- **More knobs to tune:** You need a router that sends each request to the right pool, and a ratio of prefill to decode machines that fits your traffic. Get the ratio wrong and one pool sits idle while the other queues.
- **Short or small workloads:** With short prompts, low traffic or no fast link, one combined pool is simpler and often faster. vLLM's docs say its disaggregated prefill does not improve throughput, so there the split buys latency control.
- **Still young:** vLLM marks its disaggregated prefilling as experimental and subject to change.

> **Tip:** Say the trade in one line: the split buys control over each stage's latency, and it pays with a cache copy and more machines to run.

### How would you decide whether to split?

1. **Measure first:** Log the first-word time and the time per word under real traffic, and note the average prompt length.
2. **Set the two targets:** Write down the first-word limit and the per-word limit that your users actually need.
3. **Check the link:** Confirm the machines can move the saved cache quickly. If they cannot, the split loses the time it was meant to save.
4. **Compare under load:** Run one combined pool and one split setup on the same traffic, then compare goodput per GPU.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Two stages on separate pools: prefill and decode.
- [ ] Why: on a shared GPU, one stage slows the other's latency.
- [ ] What you gain: each pool sized and tuned for its own job.
- [ ] Goodput: requests per GPU that stay inside both latency limits.
- [ ] The cost: the cache copy, a router, and the pool ratio.
- [ ] When not to split: small models, short prompts, low traffic.

**Common traps**

- Trap: "Splitting always makes serving faster." Better: It helps latency control and long-prompt traffic. It is not automatically better, and the cache copy adds cost.
- Trap: "The split means each request finishes sooner." Better: Each stage can run faster, but a request still waits for the cache copy and two queues. Judge the change by goodput under load.
- Trap: "Just add more GPUs to the prefill pool." Better: That only helps if prefill is the bottleneck. Measure the first-word time and the queue first.

## Can you spot the fix?

**Spot the fix:** Long loan files stall short chats on one shared pool. Which change most directly separates the two stages?

A. Ask users to keep their messages short.
B. Lower the model's temperature.
C. Run prefill and decode on separate pools, each sized on its own.
D. Add a longer system prompt with more rules.

**Answer:** C. Separate pools stop one stage's reading burst from delaying other users' streams. Shorter messages, a lower temperature and a longer system prompt do not change how the two stages share a chip.

**Quick check:** What does the split cost that one combined pool does not?

A. A longer system prompt.
B. Copying the saved keys and values between pools.
C. A bigger model.
D. A lower temperature.

**Answer:** B. Each request's keys and values have to move from the prefill pool to the decode pool. You also need a router and a machine ratio to tune. The other options don't change where the stages run.

## Can you answer these from memory?

**Flash cards**

- **What is disaggregation?** Running prefill and decode on separate GPU pools, each sized on its own.
- **What is goodput?** The request rate a system keeps while meeting both first-word and per-word limits.
- **Why do the stages interfere?** A long reading pass delays other users' token streams on a shared GPU.
- **What does the split copy?** The saved keys and values (the KV cache) from the prefill pool to the decode pool.
- **Does splitting raise throughput?** Not by itself. vLLM's docs say its version does not improve throughput.
- **When should you not split?** Small models, short prompts, low traffic, or no fast link between machines.

## Likely follow-up questions

- Q065 Prefill vs decode phases? https://designervenkat.online/interview/ai/prefill-vs-decode-phases
- Q055 What is the KV cache, and why does it speed up generation? https://designervenkat.online/interview/ai/what-is-the-kv-cache
- Q314 Static vs continuous batching? https://designervenkat.online/interview/ai/static-vs-continuous-batching
- Q334 How do you cut cost on a cloud-hosted LLM workload? https://designervenkat.online/interview/ai/how-do-you-cut-cost-on-a-cloud-hosted-llm-workload
- Q336 Hosted API vs self-hosted open weights for an enterprise? https://designervenkat.online/interview/ai/hosted-api-vs-self-hosted-open-weights
- Q326 Prompt cache vs semantic cache vs KV cache? https://designervenkat.online/interview/ai/prompt-cache-vs-semantic-cache-vs-kv-cache
