Async RL: train while the rollouts are still running
Move GRPO from a generate-then-train loop to two GPU pools that run at the same time, then bound how stale the data gets and correct the loss for it. How verl fully_async_policy and AReaL do each part.
Where a synchronous step spends its time
The walkthrough starts from a real run: GRPO on 16 GPUs (2 × 8 H100), 128 prompts × 8 responses = 1,024 responses per step, max_response_length = 16384. One step takes about 180 s:
| Phase | Time per step | Share |
|---|---|---|
| Rollout (vLLM generation) | ~120 s | ~67% |
| Actor update (FSDP2 forward, backward, step) | ~38 s | ~21% |
| Ref log-probs, reward, advantage, bookkeeping | ~22 s | ~12% |
In this setup verl runs a hybrid engine: all 16 GPUs switch between vLLM and FSDP2. Every GPU is always busy, but only with one phase at a time. During the 120 s of generation, no training happens.
Generation dominates for three reasons. Each decode token needs a full forward pass on a growing KV cache, which is fixed cost. The sync design makes the trainer wait for the rollouts. And the responses vary a lot in length: the source’s estimate is a median near 2K tokens (~15 s), a 90th percentile near 8K (~60 s), and a 99th percentile at the 16K cap (~120 s). The one response at the cap gates 1,023 others that finished long ago. This is tail latency.
Async RL removes the barrier. A rollout pool generates continuously, a trainer pool trains continuously on whatever trajectories are ready, and the two meet only to copy new weights from trainer to rollout. Ideally the step time drops from to .
Splitting the GPUs can make it slower
The ideal assumes each pool runs as fast as the shared pool did. On fixed hardware it does not. Split 16 GPUs into 8 for rollout and 8 for training: vLLM drops from 8 instances (TP = 2) to 4, so compute-bound generation takes roughly twice as long, ~200–240 s. FSDP2 scales roughly linearly, so the 60 s of training becomes ~100–120 s. The step is now , which is worse than the 180 s sync baseline.
playground
Drag the split between the two pools
Drag the white handle under the GPU row. Then move α toward 0 or press Sublinear.
The walkthrough lists the cases where the split wins: rollout scales sublinearly with GPUs (fewer, larger vLLM instances can pack the KV cache better), extra GPUs are available (with 32 GPUs, 16 + 16 gives s, but on twice the hardware), or training is bound by I/O rather than compute. Its first recommendation is to measure at 8 GPUs before you choose a path. The fourth case is the one that matters most at long response lengths: partial rollout.
The tail, and partial rollout
There is a spectrum between fully on-policy and fully off-policy:
- One-step-off (staleness 1): batch generates while batch trains. The PPO ratio is exactly what standard PPO expects, so nothing extra is needed. Published gains are 20–40%, but the tail of each batch still gates its step.
- Fully async (bounded staleness): there is no step at the rollout layer. Samples stream out one at a time, and the trainer pulls whatever is ready. A batch mixes data from several old policies.
Partial rollout is the fully async feature that removes the tail. When new weights arrive, a long rollout that is still generating is interrupted, and then it continues from where it stopped, now under the new weights. Its tokens span more than one policy version. The 120 s tail no longer blocks anything, and the source puts the effective rollout time at ~60–80 s, where 90% of the samples are done. Its conclusion: the published 2–3× gains are almost all at long response lengths, and the tail kill does most of the work, not the plain overlap.
verl names four modes for its async trainer. The widget below runs three of them on the same two pools: (a) staleness_threshold = 0, an on-policy pipeline; (c) staleness > 0 without partial rollout, where each sync waits for in-flight rollouts; (d) staleness > 0 with partial rollout, where a sync interrupts them.
playground
48 rollout slots and one trainer, three modes
Switch the mode. Hover a bar to see when a rollout started and which versions it spans. Change the train time.
Move the train-time slider to 180 s and the async gain shrinks: the trainer is the slow side and no overlap can help it. This is why verl reports two dials, trainer/idle_ratio and rollouter/idle_ratio. If the rollouter idles and the trainer does not, move GPUs to the trainer, and the reverse.
Four moving parts
Every async framework has the same parts. A rollout producer runs the inference engine. A buffer holds finished trajectories. A trainer pulls them, computes the loss and steps the optimiser. A weight synchroniser copies new weights to the inference pool and bumps the policy version, an integer that counts weight pushes. A fifth concern, the staleness controller, throttles the producer. Staleness is the number of versions a trajectory lags behind the trainer.
The two frameworks put the buffer in different places, and that one choice decides how they apply backpressure:
- verl runs four Ray actors. The rollouter pushes each finished sample into a separate
MessageQueueactor, a bounded deque. The trainer pullsrequire_batches × ppo_mini_batch_sizesamples per local update. When a push overflows the queue, it drops the oldest sample. - AReaL runs an SPMD trainer that talks to remote SGLang or vLLM servers over HTTP. The buffer is two deques inside the trainer’s
WorkflowExecutor. A producer thread asks theStalenessManagerfor capacity before it submits a rollout, and parks on a condition variable when there is none. Nothing is ever dropped.
animation
Samples through the pipeline: verl vs AReaL
Press Play, or Step one event at a time. Switch the design and compare the dropped and parked counters.
Neither choice is wrong. verl can waste inference compute on a sample that it later drops, but both pools stay busy and tolerate a speed mismatch. AReaL never wastes a finished generation, but a tight bound can starve the trainer or idle the inference servers.
Bounding staleness: a proportion or a version lag
The two staleness knobs bound different quantities.
verl: a proportion of a sync window. The trainer pushes weights every trigger_parameter_sync_step local updates. The rollouter pauses once it has started too many samples since the last sync:
The counter staleness_samples resets after each sync. With threshold 0.5 the rollouter may run 50% past one full window. The version lag of any one sample is an outcome of how fast the rollouter ran, so verl also measures it after the fact from trajectory_param_versions. The docs recommend keeping the threshold below 1; threshold 1 with a fast rollouter is roughly one-step-off.
AReaL: a version lag. The knob max_head_offpolicyness = is an integer, and the capacity gate is
where is the current version and is consumer_batch_size. The trainer consumes samples per version, so at most samples are outstanding. With this is synchronous RL, which AReaL’s docs call about 2× slower and useful for debugging.
playground
Two staleness knobs on one toy pipeline
Move each knob from 0 upward. Then make the rollout pool slower or faster than the trainer.
A limit of the toy, not a claim about AReaL: the toy’s trainer takes samples in the order they finish, so a rollout that started early and ran long can be trained at lag . The source describes AReaL’s bound as a per-sample version guarantee, and the toy’s ordering is the reason it differs here.
verl’s own staleness ablation (Qwen2.5-Math-7B, DAPO, 28K max response, 400 steps): threshold 0 took 1 d 1 h 53 m, threshold 0.5 took 17 h 22 m. Larger staleness gave larger gains, but response-length instability appeared later in training. Smaller require_batches means purer streaming and smaller bubbles, though require_batches = 4 gave the best wall-clock in their setup.
Correcting the loss for stale data
GRPO’s clipped objective uses the ratio , and it assumes that is the behaviour policy, the one that actually sampled . In sync training, the actor’s own forward pass after rollout gives . In fully async training, a batch holds samples from , and . A recompute at the current weights gives the wrong denominator for all but the newest, and the gradient is biased. Reported symptoms: rollout log-perplexity above 2.0, spikes in PG loss and gradient norm, oscillating response length, drifting KL, and eventually collapse.
The fix is cheap. When vLLM samples a token it already has the distribution, so it records the log-prob of that token, the rollout log-probs. The buffer carries them with the tokens. Each sample brings its own denominator, and the trainer never holds or .
Three losses use these numbers differently:
- Bypass (verl’s default,
bypass_mode=True): use the rollout log-probs directly asold_log_prob, so , and clip it as usual. One forward pass is saved. A single ratio does two jobs. - Decoupled PPO (AReaL,
use_decoupled_loss): three policies. The trainer recomputes a recent proximal policy at train time and anchors the trust region there (formula below; it follows AReaL’s code, because the two source documents write it in different forms). - verl with
bypass_mode=Falserecomputesold_log_probwith the training engine and applies Rollout Importance Sampling. For this it restores a CPU snapshot of the parameters from the first local step of the sync window. verl’s docs say that in mode (d) this approximates AReaL’s decoupled PPO.
The clip works against a recent policy, so it stays near 1 however stale the sample is. The staleness enters only through , and AReaL’s rejection_sampling masks or clamps for tokens or sequences whose diverges too far.
The widget uses the source’s numeric example. The context is "2 + 2 = " and the sampled token is "4". Under the token had log-prob −3.0 (p = 0.05); under it has −0.05 (p = 0.95). The advantage is +1.
playground
One stale token, three losses
Drag the three handles. Try π_θ moving away from π_prox, a negative advantage, and Mask instead of Clamp.
Clipping is still needed even with exact behaviour log-probs, for three reasons. Unbiased does not mean bounded variance: a token with and has and dominates a 1,024-token batch. The clip is also a trust region that limits the size of one update. And stored log-probs can hit numerical edge cases (−30, or −inf in low precision) that give of or more. Decoupled PPO splits these jobs: handles the direction, the clip on handles the size. With staleness 1, bypass is enough; as staleness grows, the source’s advice is to move to Token-TIS, then Seq-TIS, then Seq-MIS in verl, or to the decoupled loss.
Moving the weights
Both frameworks end in an NCCL broadcast from one trainer rank to every inference rank. The plumbing differs.
verl uses a checkpoint-engine modelled on Moonshot’s. It builds one collective group of size rollout_world_size + 1. Trainer rank 0 is the source, the other trainer ranks get rank −1 and skip the broadcast, and rollout ranks are 1 to N. The trainer streams full tensors into fixed-size byte buckets and broadcasts them with a double buffer, so bucket fills while bucket is in flight. Tensor metadata travels separately over ZMQ PUB/SUB. Measured sync times on H20:
| Model | Trainer × rollout ranks | Sync time |
|---|---|---|
| Qwen2.5-Math-7B | 4 × 4 | 0.02 s |
| Qwen3-30B-A3B | 16 × 16 | 4.38 s |
| Qwen3-235B-A22B | 64 × 64 | 23.70 s |
AReaL creates a second NCCL process group through a fresh TCP rendezvous. Before each broadcast, the trainer tells the servers over HTTP what to expect (param_specs: names, shapes, dtypes), then runs dist.broadcast(src=0). With FSDP2 it rebuilds each full parameter with DTensor.full_tensor(), an all-gather. With Megatron it gathers expert-parallel shards with dist.all_gather. Because this logic lives in each engine, AReaL can also remap parameter names for Qwen-VL and Gemma3, which matters if you train a VLM. A disk-reload path exists for debugging.
verl and AReaL side by side
diagram
Pick a concern, compare the two mechanisms
Click a tab.
The reported numbers, for scale: verl, up to 2.35–2.67× end to end at 128 GPUs (64 : 64) on Qwen2.5-Math-7B with comparable accuracy, and ~1.7× for a 30B MoE at a skewed 96 : 32 split. AReaL, 2.57× at 7B at matched accuracy. Both are long-response math settings, where the tail is longest.