ELLMEngineering Large
Language Models
Download PDF

Chapter 44

Distributed Reinforcement Learning and Policy Freshness

On this page

RL training is a changing model that manufactures its own next dataset. A correct distributed design must preserve both physical tensor ownership and the identity of the policy that produced each action.

Assign roles before choosing parallel degrees

Role Main work and state Typical pressure
Rollout workers Actor weights, sampling, KV or recurrent state, tool interaction Decode bandwidth, long-tail outputs, active sessions
Learner workers Differentiable actor, gradients, optimizer, activations Training memory, GEMMs, gradient collectives
Reference / critic, if used Fixed reference log probabilities or learned value estimates Extra forward passes or training state
Verifier / environment Tests, rewards, tool state, timeout and resource policy CPU, sandbox capacity, external latency
Coordinator Policy versions, queues, batch membership, publication and recovery Backpressure and semantic consistency

A PPO setup may need all these roles; a critic-free GRPO setup removes the learned critic, not the verifier, behavior-policy identity, or learner optimizer. Some roles share hardware sequentially; others use disjoint pools. Rollout TP can differ from learner TP/FSDP because decode and backward have different local shapes and memory needs. The weight-transfer path must reshard the same logical parameters rather than assume shard files are interchangeable. HybridFlow studies the orchestration and resharding problem across these RL computations.

Trace one synchronous update

Publish actor version 40 with a checksum and tokenizer/precision configuration. Generate a declared group of responses per prompt using that version. Store sampled token IDs, action masks, behavior log probabilities, end reasons, and verifier results. Calculate advantages, then perform the declared number of learner updates against that fixed batch. Publish version 41 only after the learner update is committed.

The behavior log probability is the probability under the policy that actually sampled the token, with the recorded temperature and sampling transformations when required by the chosen estimator. A log probability recomputed from version 41 is not a replacement. If an inference backend quantizes or truncates the sampling distribution, training must explicitly account for that policy mismatch rather than silently treating it as identical to the unmodified learner.

Within a response, a synchronous design uses one weight version. An asynchronous design may pause or refresh generation, but then it needs the algorithm's explicit per-segment or per-token policy semantics. “Latest weights” is not a sufficient provenance field.

What asynchrony buys and what it changes

Suppose four generation jobs take 2, 2, 3, and 20 seconds. A batch barrier waits for 20 seconds before it can finish. Continuous scheduling can put new work on the first three workers while the long job continues. It improves utilization, but the resulting queue now contains trajectories generated under different learner ages and a length-dependent arrival order.

AReaL separates ongoing generation from training and controls stale data with workload balance and an adapted optimization method. StreamRL likewise examines disaggregated stream generation. These systems are evidence for particular designs, not proof that removing a barrier from an arbitrary GRPO loop preserves its objective.

For a hypothetical learner updating every four seconds, a trajectory that spends 20 seconds in generation plus eight seconds waiting can be roughly seven updates old. An age limit of two updates will discard it. That limit is a policy, not a theorem: a small learning rate can make seven updates less different than one large update. Monitor version lag and distribution drift, ratio statistics, task/length slices, and independent evaluation.

Importance ratios correct a sampling-distribution mismatch only under the estimator's assumptions, including adequate support. Long products of ratios can have extreme variance. Clipping improves stability but introduces bias; it is not a magic conversion of any stale dataset into on-policy data.

2026-10-12T12:02:55.221986 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

For nonnegative importance weights, effective sample size diagnoses weight concentration; it is not a count of independent tasks.

Four equal weights have ESS four. Weights [1, 1, 1, 9] have ESS 144/84 ≈ 1.71: a nominal batch of four is dominated by one sample. The 2026 Stable Asynchrony study uses this variance perspective, proposing ESS-aware learning-rate control and an off-policy baseline. Treat its tested lag regimes as experimental results, not a universal safe queue depth.

Compute policy ratios at the action boundary

For a sampled action token a_t, store its behavior-policy log probability b_t=log pi_behavior(a_t|s_t) with the exact prompt, preceding tokens, and action mask. At training time compute q_t=log pi_current(a_t|s_t) and ratio r_t=exp(q_t-b_t). For a clipped PPO-style surrogate, the token contribution is min(r_t*A_t, clip(r_t,1-epsilon,1+epsilon)*A_t) before the chosen masking and normalization.

A parameter-version counter measures age, not this ratio. Two nearby versions can disagree sharply on an action; an older version can remain close on another. Clipping the surrogate also does not make arbitrary asynchronous trajectories on-policy. Preserve behavior log probabilities and expose ratio distributions rather than reconstructing them using whichever policy happens to be loaded later.

If sampling uses temperature or truncation, specify whether stored probabilities describe the sampling distribution or the raw model distribution and which distribution the estimator requires. Support removed by top-k or top-p sampling cannot be recovered merely by recording a model revision. Apply the same token shift used to generate actions; a one-position error can produce finite, plausible, entirely incorrect ratios.

Backpressure must preserve the dataset contract

A bounded queue prevents unbounded memory use and policy age. When it fills, choose explicitly among pausing rollout admission, canceling old jobs, dropping stale completed trajectories, or slowing updates. Each changes cost or data selection. Dropping long trajectories preferentially can teach a different length distribution; accepting only quickly verified successes can bias the reward signal.

For GRPO, preserve prompt-group identity. Do not calculate group statistics from whichever two of eight responses returned first and pretend they were a complete random group. Define how timeout and canceled members enter the objective. A verifier crash is missing evidence, not automatically a wrong model answer. Keep infrastructure failures distinct from valid negative outcomes.

An original capacity calculation: if rollout workers produce 120,000 action tokens per second and the learner consumes 100,000, queued tokens grow by 20,000 per second before filtering. A two-million-token reserve fills in 100 seconds. Adding a faster learner may help; adding rollout workers makes the queue problem worse. For highly variable sequence lengths, cap both tokens and trajectory counts, and reserve verifier capacity separately.

Publication, replay, and recovery

verl is a practical reference for this separation of roles: its documented training backends include FSDP2 and Megatron-LM, while rollout generation can use vLLM or SGLang. Trace one rollout batch across generation, reward, log-probability calculation, update, and weight publication. Backend support is not evidence that every combination is validated on every accelerator; pin and test the complete combination.

Pay particular attention to training-versus-rollout numerical mismatch. Even nominally identical weights can produce different log-probabilities under different precision, kernels, batching, or token processing. Record the actual behavior probabilities when the algorithm requires them and compare a fixed sequence across both paths. Policy version alone does not identify the distribution that generated a sample.

Publish weights through a manifest only after every required shard is available and validated. Rollout workers finish or invalidate incompatible in-flight state before acknowledging a version switch. Retain immutable behavior metadata even after an old weight checkpoint is garbage-collected. Store enough information to distinguish replay of an optimizer batch from regeneration of its samples; regeneration may produce different data.

Checkpoint learner/optimizer state, consumed trajectory IDs, batch/group membership, policy publication state, and the disposition of in-flight work. A repeated learner batch doubles its influence. A repeated tool action can have an external effect. Exactly-once progress therefore cannot be achieved merely by saving model weights. Use committed batch IDs and an explicit replay policy; use tool-side idempotency where supported.

Exercises and worked answers

  1. Can rollout TP=2 and learner TP=4 be valid? Yes, with compatible logical weights, correct resharding, and separately validated numerical/sampling behavior. Physical shard identity need not match.
  2. Can you recompute old log probabilities with current weights? No. That erases the denominator's behavior-policy identity.
  3. Does a larger queue improve throughput? It can absorb bursts, but cannot fix a persistent production/consumption imbalance and increases staleness.
  4. What does low ESS suggest? A few samples dominate the weighted update. Investigate drift, ratio tails, and estimator stability rather than counting the nominal batch as fully useful.
  5. What must survive recovery besides weights? Optimizer and schedule state, consumed data/batch IDs, behavior versions and log probabilities, group membership, reward/verifier identity, and committed external-action state.

A freshness table exposes selection bias

Consider this constructed rollout group from behavior policy version 40 while the learner advances to 43. Ratios below are for one selected action, not complete sequence likelihoods.

Trajectory Behavior probability Current probability Ratio Outcome Arrival
A 0.20 0.30 1.50 Verified success Fast
B 0.40 0.20 0.50 Failure Fast
C 0.10 0.25 2.50 Verified success Slow
D 0.30 0.25 0.83 Failure Slow

Training on A and B immediately, then discarding C and D as stale, selects for runtime and changes the group used to calculate normalized advantages. An importance ratio alone does not repair that group-completeness selection. Declare whether the algorithm waits for a complete group, forms groups before rollout under a deadline policy, or accepts a documented biased approximation. Preserve behavior log-probabilities and policy identity so the choice can be audited.