Inference Trade-offs Explained

Chapter 07

Encoder-only prefill (CED)

A causal encoder–decoder split that changes what the prefill pool has to compute. Below, the mechanism as the simulator ran it, step by step; then what it measured, why it behaves that way, and the papers.

Check yourself ↓ three questions and what to remember, at the end

Loading the pool animation…

What the simulator recorded

The sweep does not include CED (the scheduling levers are not modelled for it); these are the simulator's recorded runs (results.md sections 16 and 17), in the matrix's colours against the decoder-only model.

Promptdecoder-onlyCED, replay on prefillratioCED, encoder onlyratio
2,048133.9 ms 71.8 ms 0.536 67.5 ms 0.504
8,192564.3 ms 288.3 ms 0.511 283.5 ms 0.502
32,7682,741 ms 1,382 ms 0.504 1,375 ms 0.502
One prompt per prefill step, four H100s: the decoder-only time, then CED with the replay on the prefill pool, then the encoder alone (the replay on the decode pool), with their ratios to decoder-only.
Prompt : outputModelBest splitBest req/svs decoder-only best
4096 : 256decoder-only 4P2D 13.33 1.00x
4096 : 256CED, replay on prefill 4P2D 27.01 2.03x
4096 : 256CED, replay on decode 4P2D 27.90 2.09x
16384 : 64decoder-only 5P1D 3.81 1.00x
16384 : 64CED, replay on prefill 5P1D 6.89 1.81x
16384 : 64CED, replay on decode 5P1D 8.29 2.18x
Capacity under both SLOs, best split of six instances into prefill and decode pools, for two prompt-to-output ratios (results.md section 17). Gains above two are queueing, not FLOPs.

Most of the prompt never meets the decoder

A causal encoder-decoder (DeepSeek-V4.1-Flash, section 2.2) splits the model's layers in two. A prompt token runs only the encoder and the decoder's key and value projections, which make the decoder's KV cache from the encoder's last state; only the last few prompt tokens are replayed through the decoder. Decode runs the whole model as before. For a prompt token that halves the work: it touches 0.502 of the parameters a decode token does. In the animation TTFT p99 falls from 1,301 ms to 490.8 ms with the replay on the prefill pool, while TPOT is unchanged (16.1 ms).

The replay can also run on the decode pool, as its first step for a new request. Then the prefill pool holds only the encoder, which frees memory there and makes its passes slightly shorter, at the cost of a heavier first decode step: TTFT p99 561.6 ms in the animation.

Why capacity can more than double

A prefill step is compute-bound (the roofline), so half the FLOPs is close to half the time. Under a fixed TTFT SLO the gain in capacity is larger than that, because halving the service time of a queue cuts its waiting by more than half: at a prompt-to-output ratio of 4096 : 256 the best split serves 2.03x the decoder-only model's best. At some ratios it also moves the best split to fewer prefill instances. What it costs is outside this simulator: the model must be trained this way, and the paper's model is a mixture of experts with compressed attention, not this dense proxy.

Check yourself

Commit to an answer before you reveal it: a wrong guess you can explain teaches more than a right one you skimmed. Every number in the answers comes from the same tested model as the chapter’s.

Q1In the animation, with CED's replay on the prefill pool, what is TTFT p99, in ms?
Reveal the answer

Answer: 490.8 ms (counted right within 10%)

Against 1,301 ms decoder-only: a prompt token runs only the encoder and the decoder's key and value projections.

Most of the prompt never meets the decoder →

Commit to a number, then reveal.

Q2What does CED do to time per output token?
Reveal the answer

Answer: Nothing: decode runs the whole model as before

TPOT p99 is 16.1 ms against 16.1 ms: only prefill changes.

Most of the prompt never meets the decoder →

Pick one, then reveal.

Q3Why can CED's capacity more than double when it only halves prefill work?
Reveal the answer

Answer: Under a fixed TTFT SLO, halving a queue's service time cuts its waiting by more than half

Queueing, not FLOPs: at one prompt-to-output ratio the best split serves 2.03x the decoder-only model's best.

Why capacity can more than double →

Pick one, then reveal.

Papers and sources