Skip to content

18.8 Rollout systems, GRPO variants, and training diagnostics

RL training repeatedly runs an inference workload inside the learning loop. Generation, scoring, optimization, and weight synchronization must fit together. A fast serving engine helps only when it supplies valid, fresh, correctly scored data to the learner.

Concepts from other sections (14)

This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.

Learning objectives

  • Design synchronous and asynchronous actor/learner flows.
  • Explain group size, normalization, and length-weighting choices in GRPO.
  • Diagnose useful learning throughput rather than raw generation throughput.
versioned prompts → rollout actors at revision k → checker/reward model
↓ behavior probabilities ↓ scores
immutable trajectory records → learner updates
↑ ↓
new weights ← validated revision k+1

In a synchronous design, actors finish a round before the learner updates and publishes new weights. It simplifies revision accounting but can idle GPUs during scoring or updates. In an asynchronous design, actors collect while the learner updates. Queues improve utilization but introduce policy lag, mixed revisions, and backpressure. The learner should define a maximum acceptable lag and reject, refresh, or explicitly correct stale samples according to its algorithm.

Colocation places learner and actor on shared devices, often with weight swapping or time-sharing. It saves hardware and potentially transfer work but complicates memory scheduling. Disaggregation gives generation and learning separate pools, allowing different TP/DP layouts and independent sizing. It adds weight-transfer cost and consistency requirements. Publish a new revision only after all necessary actor shards agree; mixing layer weights from two revisions creates a different, unintended policy.

SGLang and vLLM are examples of rollout runtimes. A trainer supplies data flow, objective, backpropagation, optimizer, and checkpoint state. An inference server is not by itself a PPO or GRPO trainer. Compare their local serving contracts on fixed tokens before integrating them with learning.

From a scalar toy loss to token-level GRPO

Section titled “From a scalar toy loss to token-level GRPO”

For prompt xx, sample GG completions yiy_i from an old policy and assign outcome rewards RiR_i. Define group-normalized advantages AiA_i and token ratios ρi,t\rho_{i,t}. A common original-style surrogate averages each sequence before averaging sequences:

J=1G∑i1Ti∑t=1Ti[min⁡(ρi,tAi,clip⁡(ρi,t,1−ϵ,1+ϵ)Ai)−βki,t].J=\frac1G\sum_i\frac1{T_i}\sum_{t=1}^{T_i} \left[\min(\rho_{i,t}A_i,\operatorname{clip}(\rho_{i,t},1-\epsilon,1+\epsilon)A_i)-\beta k_{i,t}\right].

TiT_i counts valid generated actions according to the EOS/mask convention. Padding and prompt tokens do not participate. The same sequence advantage is broadcast across its generated tokens for outcome supervision; a process-reward variant requires a different credit construction. A whole-sequence probability ratio is not interchangeable with these per-token ratios.

The original GRPO formulation, section 4.1 removes a learned value baseline, not the cost of rollouts or a separate reward model when the task uses one. The earlier scalar implementation is a toy reduction over supplied entries; a production recipe must define the masks, token/sequence weighting, behavior distribution, and KL estimator explicitly.

For Bernoulli success probability pp, the probability that a group contains both success and failure is

1−pG−(1−p)G.1-p^G-(1-p)^G.

At p=0.5,G=4p=0.5,G=4 this is 0.8750.875. At p=0.01,G=4p=0.01,G=4 it is about 0.03940.0394. Larger groups can reveal comparisons but cost more generation and do not fix an impossible task. Correlated samples can reduce diversity further; independence is an assumption of this calculation.

Subtracting an action-independent baseline preserves the expected policy gradient. The inclusive mean of a sampled group includes the current action’s reward and is not action-independent. Without standard-deviation normalization, its expected gradient has a finite-group factor (G−1)/G(G-1)/G under independent samples. A leave-one-out baseline removes this particular self-inclusion factor for G>1G>1. Dividing by sampled reward standard deviation adds further weighting and estimator effects. Avoid calling every group-normalized estimator unbiased.

An equal-reward group has zero centered policy advantages. Reference regularization or another objective can still update its tokens. Track zero-spread fraction by prompt difficulty and task, along with the denominator of discarded groups.

Design choiceMotivationWhat must be compared
Per-sequence token meanGive each sequence equal total weightLength bias and task quality by generated length
Global valid-token meanWeight tokens equally across sequencesLonger responses receive more total weight
Fixed length denominatorRemove a sampled-length-dependent denominatorGradient scale as actual lengths vary
Group/batch/no standard-deviation scalingChange how easy/hard prompts contributeDifficulty weighting, advantage variance, and stability
Asymmetric ratio clippingChange exploration and update incentivesRatio tails, entropy, drift, and success
Filtering all-equal groupsSpend updates on nonzero comparisonsResampling cost and changed prompt distribution
Length-cap penalties or maskingHandle incomplete generationsTruncation rate, denominator, and length-conditioned success

DAPO and Dr. GRPO’s analysis motivate several such changes. The TRL 0.23.1 GRPO reference exposes choices including loss_type and reward scaling. A trainer’s current default should not be assumed to reproduce the original paper. Record the resolved recipe, not just the algorithm name.

Log rollout tokens/sec, accepted fresh tokens/sec, scorer timeouts, weight-sync time, queue age, optimizer tokens/sec, total GPU-hours, and success per compute budget. Record raw reward components, independent task success, length, truncation, entropy, reference KL, old/current KL, clip fraction, and per-group reward spread. Explain each metric’s mask and denominator.

If generation throughput doubles but most data is stale, useful learning throughput can fall. If output lengths grow, reward may improve while successful answers per GPU-hour decline. If learner and actor probabilities disagree before an update, check sampling transforms, numerical execution, dropout, and model revisions before changing clipping.

  • Actor/learner architecture: a system separating experience generation from gradient updates.
  • Zero-spread group: a prompt group with identical rewards and zero centered advantages.
  • Recipe: objective, masks, normalizations, update schedule, and generation contract taken together.

The serving runtime, estimator, and scheduling policy form one learning system. Optimize accepted evidence and task improvement per total cost, while keeping algorithmic changes visible.

  1. Why can global token averaging change the learned policy compared with sequence averaging?

    AnswerIt changes the relative weight assigned to long and short completions, so it changes the objective rather than merely implementation speed.
  2. Does removing the critic make GRPO automatically cheaper than PPO at the same quality?

    AnswerNo. More samples per prompt, scoring, synchronization, and different sample efficiency can outweigh critic-memory savings.