Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Reinforcement learning (RL) | Training a model by letting it try, scoring the tries with a reward, and nudging the weights toward what scored well. |
| Policy | The model being trained. Its current weights decide what it generates. |
| Rollout | One generated attempt (a completion, or a whole multi-turn agent episode) that gets a reward. Generating it is inference. |
| Reward / verifier | The scorer: a unit-test run, a maths checker, a reward model, or an environment’s success signal. |
| GRPO | Group Relative Policy Optimization: generate a group of rollouts per prompt and score each against its group’s average, so no separate value model is needed. |
| Trainer | The training side (FSDP or Megatron-LM) that computes gradients and updates weights. |
| Colocated / disaggregated | Training and generation share the same GPUs in turns, or run on separate GPU pools. |
| Straggler | The last, longest rollout that everyone else waits for. |
1. What is it?#
Post-training a reasoning or agent model with RL is a loop:
┌──────────────────────────────────────────────────────────────┐
▼ │
prompts ──► ROLLOUT (inference engine) ──► REWARD ──► TRAIN ──► SYNC WEIGHTS
G attempts per prompt verifier, gradient new policy into
(long, multi-turn, tools) tests, env step the engine (27.e)The rollout stage is an inference workload, served by vLLM or SGLang inside the RL framework. It is often the largest part of an RL step for reasoning models, because each rollout may be thousands to tens of thousands of tokens (27.a) and agentic rollouts add tool and environment time (27.b). Lesson 8.a shows where RL sits in the hardware lifecycle; this lesson is about serving the rollout side well.
Open-source RL frameworks, all of which drive vLLM or SGLang for rollouts (versions checked on 13 November 2026):
| Framework | Latest release | Trainer | Rollout engine | Notes |
|---|---|---|---|---|
| verl | v0.9.1 (20 Sep 2026) | FSDP/FSDP2, Megatron-LM | vLLM, SGLang | HybridFlow paper; “3D-HybridEngine” reshards the actor between training and generation; rollout runs in server mode by default since v0.7 |
| OpenRLHF | v0.11.2 (14 Sep 2026) | DeepSpeed | vLLM | Ray + vLLM; a hybrid engine lets models and vLLM share GPUs; async training via --train.async_enable |
| slime | v0.4.0 (9 Oct 2026) | Megatron-LM | SGLang (+ router) | SGLang-native; prefill/decode disaggregation and a fully asynchronous rollout example |
| TRL | v1.17.1 (30 Oct 2026) | Hugging Face / Accelerate | vLLM | GRPOTrainer with use_vllm=True; vllm_mode="colocate" (default) or "server" |
| SkyRL | skyrl-v0.4.0 (1 Oct 2026) | Modular | vLLM | skyrl-gym environments; uses vLLM’s native weight-sync and pause/resume APIs |
| prime-rl | v0.10.0 (13 Oct 2026) | FSDP2 | vLLM | Fully asynchronous, built for agentic RL; examples with P/D disaggregation and KV offload |
2. Why does it matter?#
- Scale. A growing share of inference capacity at model labs serves no users; it generates rollouts (24.j). A team that post-trains models runs a second inference fleet whose customer is the trainer.
- Different success metric. User serving optimises latency under a throughput target. Rollout serving optimises training steps per hour at a given quality, which depends on throughput, on how long the slowest rollout takes, and on how fast new weights reach the engines.
- Correctness requirements that user serving never had. The trainer needs the engine’s per-token log-probabilities, and they must agree with the trainer’s own computation (27.e). An MoE model may also need to report which experts each token used.
3. Simple analogy#
A cooking school where every student cooks the same dish eight times per lesson, a judge tastes every plate, and the teacher adjusts the recipe before the next lesson.
- The lesson cannot end until the slowest plate reaches the judge: one soufflé that takes an hour holds up the whole class.
- If the kitchen and the classroom are the same room (colocated), the students must clear the benches before the teacher can write on them.
- If they are separate rooms (disaggregated), the new recipe must be carried from one room to the other, and someone has to decide whether students may keep cooking from the old one meanwhile (27.e).
4. Tiny example: one synchronous step#
64 prompts × 8 rollouts each = 512 sequences, lengths drawn from a long-tailed distribution with a median of 4,000 tokens and a cap of 32,768. One decode step for the whole batch takes 30 ms.
512 rollouts: p50 3855, p90 10930, p99 27362, max 32768 tokens
policy step time slot use finished tokens carried over
wait for every rollout 983 s 16% 100% 0
cut at p99, resume next step 821 s 19% 99% 26999
cut at p90, resume next step 328 s 43% 90% 274158Waiting for every rollout takes 983 seconds, and on average only 16% of the batch slots are busy: after a few minutes most sequences have finished and the engine is decoding a handful of stragglers. Cutting the step at the p90 length and carrying the unfinished rollouts into the next step (partial rollouts) triples the step rate. The price is that carried-over rollouts finish under newer weights: an off-policy question, handled in 27.e.
5. Technical explanation#
How a rollout workload differs from user traffic#
| Property | User serving | RL rollouts |
|---|---|---|
| Goal | Latency per request under an SLO | Steps per hour; wall time of the slowest rollout |
| Arrivals | Continuous, unpredictable | A fixed batch per step (synchronous) or a steady stream (asynchronous) |
| Prompt sharing | Some (system prompts) | Heavy: G attempts per prompt share it exactly |
| Output length | Mostly short | Long and long-tailed, capped by max_tokens |
| Outputs needed | Text | Token IDs, per-token log-probabilities, sometimes routed expert IDs |
| Model | Fixed for weeks | Changes every step (minutes) |
| Numerics | Close enough | Must match the trainer (27.e) |
Group sampling and the prefix cache#
GRPO-style algorithms (DeepSeekMath introduced GRPO; DAPO refined it) generate G completions per
prompt. Sending one request with n = G, or G requests to the same replica, prefills the prompt
once and shares its KV blocks (17.f). For agentic rollouts the same applies per turn: each of the G
episodes is its own multi-turn session (27.b), and session-sticky routing keeps their histories
warm.
What the rollout engine must return#
- Token IDs, not just text. Re-tokenizing text can give different tokens from those sampled,
and the training loss is per token. Frameworks ask vLLM for token IDs (TRL sends prompt token IDs
to
/v1/completions). - Per-token log-probabilities of the sampled tokens, from the rollout policy, for importance weighting and KL terms (27.e).
- Routed experts for MoE models. Router decisions can differ between the engine and the trainer
even when logits nearly match, which changes which parameters receive gradient. vLLM v0.32.0 can
return the expert IDs each token used (
enable_return_routed_experts=True, exampleexamples/rl/routed_experts_e2e.py) so the trainer can replay them; verl showed “router replay” for its Megatron backend in April 2026.
Colocated or disaggregated#
| Colocated (time-share) | Disaggregated (separate pools) | |
|---|---|---|
| How | Generate on all GPUs, put the engine to sleep, train on the same GPUs, wake it with new weights | A rollout pool and a trainer pool run side by side; weights cross the network |
| Memory | Engine and trainer take turns with HBM: vLLM sleep mode releases it (16.g); level 2 suits weight updates where old weights are not needed | Each side sized independently |
| Weight sync | Local (CUDA IPC); fast | NCCL, RDMA or object storage; sharding layouts may differ (27.e) |
| Idle time | Trainer idle during rollouts, engine idle during training | Either side idles unless the loop is asynchronous |
| Fits | Small and medium runs, few GPUs | Large runs, very long rollouts, agentic RL with slow environments, different hardware per side |
| Examples | TRL colocate mode, verl’s hybrid engine, OpenRLHF hybrid engine | TRL server mode, slime, prime-rl, SkyRL fully async |
The direction in 2026 is toward disaggregated and asynchronous designs for large and agentic runs, because long-tailed rollouts make synchronous colocated steps mostly idle (section 4). Colocated designs remain the simplest way to run RL on one node.
Fighting the long tail#
- Partial rollouts. Stop the step at a token budget; continue unfinished rollouts in the next step (described in the Kimi k1.5 report). Needs the engine to keep or recompute their KV, and an off-policy correction because the weights change mid-rollout.
- Asynchronous RL. Never stop: generation runs continuously and training consumes finished rollouts, accepting bounded staleness (27.e). This is what AReaL, PipelineRL, prime-rl and SkyRL’s fully async mode do.
- Over-sampling and filtering. Generate a few more groups than needed. Note the bias: taking the first finished rollouts favours short answers. DAPO’s dynamic sampling filters a different thing: groups whose rewards are all equal carry no learning signal.
- Length caps and penalties limit the tail directly, at some cost to what the model learns.
Agentic rollouts#
When each rollout is an agent episode (run tests in a sandbox, browse, use a computer), the rollout engine sees exactly the session pattern of 27.b: dozens of turns, tool pauses, high prefix reuse. The environment becomes part of the critical path: sandbox start-up, tool latency and reward computation (often running a test suite) can take longer than generation. Plan environment capacity (CPU, containers) as carefully as GPU capacity.
6. Under the hood: the straggler model#
// rollouttail.go — why the longest rollout sets the pace of a synchronous RL step.
package main
import (
"fmt"
"math"
"math/rand"
"sort"
)
func main() {
const (
prompts = 64
group = 8 // completions per prompt (GRPO-style group)
median = 4000.0 // rollout length, tokens
sigma = 0.8 // lognormal spread
maxLen = 32_768 // generation cap
stepSecs = 0.030 // one decode step for the whole batch
)
r := rand.New(rand.NewSource(7))
n := prompts * group
lens := make([]int, n)
total := 0
for i := range lens {
l := int(median * math.Exp(sigma*r.NormFloat64()))
lens[i] = min(max(l, 50), maxLen)
total += lens[i]
}
sort.Ints(lens)
pct := func(p float64) int { return lens[int(p*float64(n-1))] }
fmt.Printf("%d rollouts: p50 %d, p90 %d, p99 %d, max %d tokens\n\n",
n, pct(0.5), pct(0.9), pct(0.99), lens[n-1])
fmt.Println("policy step time slot use finished tokens carried over")
report := func(name string, cut int) {
used, done, carried := 0, 0, 0
for _, l := range lens {
used += min(l, cut)
if l <= cut {
done++
} else {
carried += l - cut
}
}
util := float64(used) / float64(n*cut)
fmt.Printf("%-30s %8.0f s %7.0f%% %7.0f%% %19d\n",
name, float64(cut)*stepSecs, 100*util, 100*float64(done)/float64(n), carried)
}
report("wait for every rollout", lens[n-1])
report("cut at p99, resume next step", pct(0.99))
report("cut at p90, resume next step", pct(0.90))
fmt.Printf("\nuseful tokens this step: %d\n", total)
}Output:
512 rollouts: p50 3855, p90 10930, p99 27362, max 32768 tokens
policy step time slot use finished tokens carried over
wait for every rollout 983 s 16% 100% 0
cut at p99, resume next step 821 s 19% 99% 26999
cut at p90, resume next step 328 s 43% 90% 274158
useful tokens this step: 2705450What the model leaves out: a real decode step gets faster as the batch shrinks, so idle slots are
not wasted one for one; but a GPU decoding 20 sequences instead of 512 is far below its throughput
(2.d), which is the waste that matters. The maximum equals the cap, so some rollouts were truncated:
check how many of your rollouts end at max_tokens, because truncated rollouts usually get a zero
reward and teach the model something you did not intend.
7. Performance implications#
- Throughput per GPU-hour is the metric, measured over whole steps including tails, syncs and idle time, not tokens per second during the busy part.
- Large batches and long contexts favour engines configured like offline inference (27.f):
high
max_num_seqs, generous KV memory, CUDA graphs for decode. - Prefix sharing across the group saves prefill; for long prompts or multi-turn rollouts, routing the G attempts together matters.
- Exactness costs speed. Batch-invariant kernels and matching numerics cost single-digit percentages in vLLM’s 2026 results (6.8% step time on one agent task; 8.7% rollout throughput in an earlier post), and are usually worth it (27.e).
- Speculative decoding helps rollouts too, but the drafter must keep up with a policy that changes every step; a stale drafter’s acceptance rate falls as training proceeds.
8. Production implications#
- Treat the rollout fleet as a tenant with its own SLOs: steps per hour, weight-sync time, rollout failure rate. Do not share replicas with user traffic unless you can pause it cleanly.
- Pin versions and kernels of the engine across a run; an engine upgrade mid-run changes numerics and can change the training curve.
- Monitor length distributions per step: rising p99 or a growing share of capped rollouts is a training signal as well as a capacity one.
- Size environment capacity: sandboxes, test runners and reward models can become the bottleneck for agentic RL.
- Log weight versions per rollout so every training sample can be traced to the weights that produced it (27.e).
9. Common mistakes#
- Measuring rollout throughput only during the busy part of a step and ignoring the tail.
- Returning text and re-tokenizing it for training.
- Running a synchronous colocated loop with long agentic rollouts, leaving GPUs mostly idle.
- Using “first N finished” to fill a batch and unknowingly training toward short answers.
- Upgrading the inference engine mid-run without checking log-probability agreement.
- Forgetting that the environment (sandboxes, tests) is part of the rollout critical path.
10. Hands-on exercise#
A. Measure the tail. Run TRL’s GRPOTrainer with use_vllm=True on a small model and a maths
dataset. Log rollout lengths per step and the time the engine spends with fewer than 10% of its
slots busy.
B. Colocate vs server. Run the same job with vllm_mode="colocate" and "server" (vLLM on
separate GPUs). Compare steps per hour and GPU utilisation on each side.
C. Partial rollouts. Extend rollouttail.go to carry unfinished rollouts into the next step and
run 20 steps. What is the steady-state step time and the distribution of “steps a rollout spanned”?
D. Group prefix sharing. Send 64 prompts with n=8 versus 512 separate requests to one vLLM
server. Compare prefill tokens computed (prefix-cache metrics) and total time.
11. Interview questions#
- How does serving RL rollouts differ from serving users? Name four differences.
- Why does a synchronous RL step waste so much GPU time, and what are three ways to reduce it?
- Colocated or disaggregated rollouts: what decides it?
- Why does the trainer need token IDs and log-probabilities from the engine, not text?
- What is router replay and why do MoE models need it in RL?
- What can bias your training data when you cut rollouts short or over-sample?
12. Further reading#
Checked on 13 November 2026.
- vLLM v0.32.0 — Reinforcement learning with vLLM (framework list)
- verl and HybridFlow (arXiv 2409.19256)
- OpenRLHF
- slime and slime: an SGLang-native post-training framework (LMSYS blog)
- TRL — vLLM integration (colocate and server modes)
- SkyRL and prime-rl
- DeepSeekMath, which introduced GRPO (arXiv 2402.03300)
- DAPO (arXiv 2503.14476)
- Kimi k1.5, including partial rollouts (arXiv 2501.12599)
- RL on the hardware lifecycle: 8.a. RL rollouts as a research area: 24.h, 24.j.