RL for LLM Agents · 5 min read
To keep GPUs busy, many RL systems generate data with an older copy of the policy while training a newer one. That makes the data slightly off-policy, and the gap needs managing.
Why drift happens
Policy-gradient theory assumes the samples came from the policy being updated. In large systems, rollouts are produced by a separate inference engine, sometimes several updates behind the trainer. The samples therefore come from a policy that differs from the current one.
The importance ratio
The standard correction multiplies each term by the ratio of the new policy’s probability of the sampled token to the old policy’s. When the policies are close, the ratio is near one and the correction is small. When they are far apart, the ratio varies widely, and updates become noisy or unstable. Clipping the ratio, as PPO-style objectives do, limits how far one batch can push the policy.
A second source of mismatch
Even with identical weights, the inference engine and the training code may compute slightly different probabilities because of numerical precision or kernel differences. For long sequences these small differences add up, and can destabilize training if not monitored.
What to monitor
- The distribution of importance ratios and the fraction clipped.
- The KL divergence between the rollout policy and the trainer’s policy on the same samples.
- Staleness, meaning how many updates old the rollout data are.
- Reward and held-out accuracy together, since instability often shows up in one before the other.
