GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
OSDI 2024

Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve

When a long prompt arrives, most servers pause all other output to process it. Sarathi-Serve slices prompts into chunks riding along with ongoing decodes: up to 3.7x more load within a latency target.

Breakdown by FDE Interviews · 11 min read · Updated

About the original · 2024
AUTHORS
Agrawal, Kedia, Panwar, Mohan, Kwatra, Gulavani, Tumanov, Ramjee
FROM
Microsoft Research India, Georgia Institute of Technology
PUBLISHED
Mar 2024 · OSDI 2024
CITED BY
920Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 18% of this breakdown.

01

The paper in one minute

Every request has two phases. Prefill processes the whole prompt at once; it is compute-bound and saturates the GPU even for a single request. Decode produces one token per request per iteration; it is memory-bound, since each iteration reads all the weights to do very little arithmetic, so batching many decodes together is nearly free.

Servers like vLLM and Orca batch at the iteration level and admit new requests eagerly, running their prefills first because that grows the next decode batch. The cost is a generation stall: while a multi-thousand-token prompt is processed, every ongoing response pauses, sometimes for seconds. Time between tokens (TBT) at the tail goes up with load. Older request-level batching avoids stalls but leaves the GPU underused. So operators trade throughput against latency.

Sarathi-Serve removes the trade with two pieces. Chunked prefill splits a long prompt into chunks of a few hundred tokens, computed over several iterations. Stall-free batching builds each iteration in a fixed order: all running decodes, then any partly done prefill, then new requests, until a token budget is reached. Because decode iterations have idle compute, adding a few hundred prefill tokens barely lengthens them, and no running response ever waits for a whole prompt. Iterations also become uniform, which removes pipeline bubbles when a model is split across machines.

The token budget sets the trade: 512 tokens for strict latency targets, 2,048 for relaxed ones. Built on vLLM, Sarathi-Serve served 2.6x more load than vLLM for Mistral-7B and 3.7x for Yi-34B under strict P99 TBT targets, and made pipeline parallelism over ordinary Ethernet practical for Falcon-180B.

THE IDEA, VISUALLY
SAME REQUESTS, TWO SCHEDULES (FIGURE 7) time → prefill-first A,B A,B prefill C + D (whole) A–D A–D A and B produce nothing: a generation stall stall-free A,B A,B+C₀ A,B+C₁ A,B+D₀ A–C+D₁ every iteration: all decodes + a prefill chunk HOW EACH ITERATION IS FILLED (ALGORITHM 3) 1. add every running decode (1 token each) 2. continue any partly done prefill, in a chunk 3. admit new requests while tokens remain under the budget token budget: 512 for strict targets, 2048 for relaxed Why it is nearly free: a decode iteration is memory-bound, so time barely changes until the batch passes a few hundred tokens. Chunking fills that slack with prefill work and keeps every iteration about the same length, which also removes pipeline bubbles when the model is split across nodes. Cost: each chunk re-reads the KV of earlier chunks; ≤ ~25% slower prefill at 512, near zero at 2048 (Fig. 14) CAPACITY, STRICT P99 TBT TARGET, SHAREGPT queries per second, read from Figures 10-11 (approximate) Mistral-7B, 1 A100 (TBT ≤ 0.1 s) Orca 0.72 vLLM 0.77 Sarathi-Serve 2.00 Yi-34B, 2 A100s TP2 (≤ 0.2 s) Orca 0.27 vLLM 0.29 Sarathi-Serve 1.07 Falcon-180B, 8 A100s TP4-PP2 (≤ 1 s) Orca 0.13 vLLM 0.17 Sarathi-Serve 0.61 about 2.6x, 3.7x and 3.6x vLLM ABLATION, YI-34B, BUDGET 1024 (TABLE 4) TTFT P50 TBT P99 hybrid batches only 0.53 s 0.68 s chunked prefills only 1.04 s 0.17 s both (Sarathi-Serve) 0.76 s 0.14 s ShareGPT trace. Both together give the lowest tail TBT; TTFT sits between the two single techniques.
Prefill-first schedulers stall every ongoing response while a new prompt is processed. Sarathi-Serve fills each iteration with all running decodes plus a slice of new prompt, so no response pauses and the GPU's spare compute does the prefill.
Research notes: the problem, approach and results
3.7x

more queries per second than vLLM for Yi-34B on two A100s within a strict P99 time-between-tokens target

28.3x

how much longer an iteration can take when a full prompt joins a decode batch unchunked, versus a decode-only batch

≤ ~25%

extra prefill time from chunking at 512 tokens per chunk; near zero at 2,048

THE PROBLEM

LLM servers batch requests at every iteration for throughput, and they admit new prompts eagerly. A new prompt's prefill can take seconds; while it runs, every ongoing response stops producing tokens. Smaller batches avoid these generation stalls but waste the GPU. With pipeline parallelism, uneven iterations also leave stages idle.

THE IDEA

Decode iterations are memory-bound and leave compute idle. Split each prompt into chunks and build every iteration from all running decodes plus prefill chunks up to a fixed token budget (stall-free batching), so new requests join without pausing anyone and iterations take about the same time. Pick the budget from the latency target.

THE RESULT

Against vLLM at strict tail-latency targets, serving capacity rose 2.6x for Mistral-7B on one A100 and 3.7x for Yi-34B on two A100s. With pipeline parallelism across two nodes, Falcon-180B served 3.6x more than vLLM's hybrid-parallel setup under strict targets.

02

Why it matters to an FDE

Users notice two latencies: time to first token and how smoothly the rest streams. When a customer says "the answer freezes mid-sentence when it's busy," the cause is often a scheduler stalling decodes to run someone else's long prompt.

Ask how the serving engine admits prefills. Chunked prefill is now a standard option in major engines; whether it is on, and with what token budget, changes tail latency at load more than most other settings.

Batch size limits don't fix it. The paper found vLLM's capacity under strict latency targets barely moved across maximum batch sizes of 32, 64 and 128, because stalls come from prefill length, not batch size.

Long prompts make it worse. RAG, document and agent workloads with prompts in the thousands of tokens are where prefill interference is largest; the arXiv-summarization workload (median prompt 7,059 tokens) had the lowest capacities in the paper.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Why decodes have slack, the token budget, the TTFT cost, pipeline parallelism and three misreadings

    Free account
  2. 04How it works

    The batch-building loop, picking the budget, chunk overheads and the pipeline-parallel effect

    Premium
  3. 05The numbers that matter

    Setups and SLOs, capacity results, the latency trade-off curve, pipeline results and ablations

    Premium
  4. 06Try it yourself

    Recheck ratios and tables, then simulate prefill-first and stall-free schedulers under load

    Premium
  5. 07Where it breaks

    TTFT cost, budget tuning, very long prompts, no disaggregation comparison, and slips

    Premium
  6. 08Using it on a deployment

    Diagnosing stalls, setting the token budget, and what to measure at load

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →