Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Iteration | One forward pass of the model, producing one new token for each request in the batch. |
| Request-level scheduling | The old way: pick a batch of requests, run it until every request in it has finished, then pick the next batch. |
| Iteration-level scheduling | Orca’s way: decide the batch again before every iteration. Finished requests leave and new ones join immediately. This material calls it continuous batching (12.j). |
| Selective batching | Batching the operations that can be batched (matrix multiplies) across requests of different lengths, while running attention separately per request. |
| Execution engine | The part that actually runs the model on GPUs (FasterTransformer, in the paper’s baseline). |
| FasterTransformer | NVIDIA’s 2019–2023 optimised Transformer inference library, the predecessor of TensorRT-LLM (15.c). |
| Pipeline parallelism | Splitting a model’s layers across GPUs so different GPUs work on different micro-batches at once (14.d). |
| K/V slot | Orca’s unit of reserved GPU memory: room for one token’s keys and values. |
1. The paper#
- Title: “Orca: A Distributed Serving System for Transformer-Based Generative Models”
- Authors: Gyeong-In Yu, Joo Seong Jeong, Geon-Woo Kim, Soojeong Kim, Byung-Gon Chun (Seoul National University and FriendliAI)
- Venue: 16th USENIX Symposium on Operating Systems Design and Implementation (OSDI ‘22), July 2022.
- Link: usenix.org/conference/osdi22/presentation/yu (open-access PDF). It has no arXiv version.
2. The problem#
In 2021–22 the standard way to serve a GPT model was a general server (NVIDIA Triton) that formed batches and handed them to an engine (FasterTransformer) that ran the batch to completion. That is how you serve image classifiers, and it is a bad fit for text generation:
- Requests in one batch want different numbers of output tokens. A request that finishes after 10 tokens waits until the longest one finishes after 500, holding its slot the whole time.
- A request that arrives just after a batch starts waits for the whole batch to finish before it can begin.
- Padding short requests to the batch’s longest length wastes compute.
The GPU was busy, but much of that work was waiting or padding.
3. The idea#
Two ideas, and the first is the one everyone remembers.
Iteration-level scheduling. The scheduler asks the engine to run one iteration at a time. After every iteration it removes finished requests (and returns their results at once) and adds waiting ones. A batch is no longer a fixed group; it is whatever is running this step.
Selective batching. Iteration-level scheduling creates a mixed batch: some requests are on their
first iteration (processing the whole prompt), others are generating their 300th token. Their
tensors have different shapes and cannot be stacked into one [batch, length, hidden] tensor. Orca
noticed that most operations do not care which request a token belongs to: linear layers, layer norm,
GeLU and residual adds work per token. So it flattens all tokens of all requests into one
[total_tokens, hidden] tensor for those operations, and splits the batch per request only for
attention, which needs each request’s own keys and values.
flowchart LR P["Request pool"] --> S["Scheduler: pick batch for THIS iteration"] S --> E["Engine: run ONE iteration"] E --> L["Linear, norm, GeLU: all tokens flattened together"] E --> A["Attention: split per request"] L --> D["Done requests leave; new tokens appended"] A --> D D --> S class P queue class S neutral class E,L,A compute class D io
4. How it works#
- Scheduler (Algorithm 1). Keep requests first-come-first-served at the iteration level. Each
step, select up to
max_bsrequests by arrival time. A new request is admitted only if there is room to reservemax_tokensK/V slots for it — enough memory for the longest output it might produce — so that it can never run out of KV space mid-generation. - Attention K/V manager. Holds each request’s keys and values in GPU memory between iterations, so the engine does not recompute them.
- Distributed execution. Intra-layer (tensor) parallelism as in Megatron-LM (30.c) plus inter-layer (pipeline) parallelism. Because each “job” is one iteration, Orca can keep the pipeline full with different batches in flight without the micro-batch trade-off FasterTransformer had.
- Control and data separated. Control messages travel over gRPC; tensors between GPUs go only over NCCL.
Two operator knobs: max_bs (bigger raises throughput, eventually at the cost of latency) and
n_slots (simply the most K/V slots that fit in memory).
The weak point is in the first bullet. Reserving max_tokens slots up front wastes memory whenever a
request finishes early, which is most of the time. That waste is the exact problem vLLM’s
PagedAttention (30.o) set out to remove a year later.
5. Results#
Hardware: Azure ND96asr A100 v4 VMs, 8 × 40 GB A100 per VM. Models: GPT-3-shaped models of 13 B, 101 B, 175 B and 341 B parameters (Table 1), using tensor parallelism within a node and pipeline parallelism across nodes for the larger ones.
| Measure | Result |
|---|---|
| Engine alone, same batch, no scheduler (Figure 9) | Orca’s engine similar to or slightly slower than FasterTransformer (attention is not batched) |
| End-to-end, GPT-3 175 B, synthetic trace, at median normalised latency of 190 ms/token | FasterTransformer 0.185 req/s, Orca 6.81 req/s: 36.9× |
| 101 B model at low load | the one case where FasterTransformer was competitive |
How to read the 36.9× fairly: the trace sampled input lengths uniformly from 32 to 512 tokens and output lengths from a range, with Poisson arrivals. Mixed lengths are exactly where request-level scheduling hurts most. With homogeneous requests (all the same length) FasterTransformer gained from larger batches and the gap narrowed, though Orca still came out ahead in most settings. The gain comes from the scheduler, not from faster kernels.
6. What held up and what did not#
Held up
- Continuous batching is universal. Every LLM server in 2026 (vLLM, SGLang, TensorRT-LLM, Hugging Face’s engines, llama.cpp’s server) schedules per iteration. It is the single biggest throughput idea in LLM serving.
- Flattening tokens across requests. vLLM’s and SGLang’s model runners pack all tokens of a step into one “ragged” batch for every non-attention operation, exactly as selective batching did (18.b).
- The scheduler/engine split. One component decides what runs; another runs it. That is the shape of vLLM’s engine core loop (16.g).
Did not, or changed
- Reserving
max_tokenswas too wasteful. PagedAttention (30.o) allocates KV memory in small blocks on demand, and preempts a request if memory runs out, instead of reserving the worst case. - Whole prompts in one iteration hurt latency. Orca let a request’s full prefill join a decoding batch, which stalls everyone’s next token. Chunked prefill and Sarathi-Serve (30.t) split long prompts across iterations.
- Attention per request became one batched kernel. Modern attention kernels (FlashAttention with variable lengths, FlashInfer, 30.x) handle the ragged batch in a single launch, so “split for attention” is now inside the kernel.
7. Where it lives in 2026#
- Taught in depth: continuous batching in 12.j, static and dynamic batching in 12.i, the vLLM scheduler step in 17.a, batching in servers in 20.d.
- FriendliAI, the company behind Orca, sells an inference service built on these ideas.
- The paper never says “continuous batching”; that name was popularised in 2023 (for example by an Anyscale blog post) and is now the usual one; “in-flight batching” is NVIDIA’s name for it in TensorRT-LLM.
Checked on 13 November 2026.
8. Questions#
- What goes wrong with request-level batching when outputs have different lengths?
- Explain iteration-level scheduling in two sentences.
- Why can linear layers be batched across requests of different lengths, but attention cannot be batched naively?
- How did Orca make sure a running request would never run out of KV memory? What did that cost?
- Under what workload would Orca’s advantage over request-level batching be smallest?
- Which later papers fixed Orca’s memory reservation and its prefill stalls?
- The paper reports 36.9×. What would you check before quoting that number to someone?
9. Further reading#
- Orca at OSDI ‘22 — sections 3 and 4, Figure 4 (selective batching), Algorithm 1.
- Cade Daniel and others, “How continuous batching enables 23x throughput in LLM inference” (Anyscale blog, June 2023).
- 12.j and 17.a in this material.
- Next: LLM.int8() (30.h).