Sampler Replay trains the sampler, not the trainer, in RLVR

Sampler Replay trains the sampler, not the trainer, in RLVR

A paper on Hugging Face takes aim at train-inference mismatch, a well-known problem that degrades the performance of reinforcement learning with verifiable rewards (RLVR). In RLVR setups, rollouts come from a sampler that is tuned to meet some efficiency criteria, so it is an imperfect version of the trainer. The problem is currently framed as training the trainer on samples from that imperfect copy of itself. Current RLVR algorithms are therefore built to correct the discrepancy in the trainer's gradient that the sampler's off-policy rollouts cause.

The authors reframe it. They argue RLVR should strive to train the sampler, because the sampler's performance at test time is what ultimately matters. In that view the trainer is merely a mechanism for getting an approximation of the sampler's true gradient.

From this they propose Sampler Replay. It replays the sampler's hidden states, logits and routing decisions in the trainer's forward pass, which better approximates the sampler's gradient.

The authors report that, across tasks and model scales, Sampler Replay stabilizes training under severe train-inference mismatch. The mismatch sources they test are quantization (of weights, activations and KV cache), weight perturbation and staleness. They say it outperforms strong baselines.

They also argue that Sampler Replay generalizes techniques widely used in the literature to address train-inference mismatch (TIM), techniques that so far have been treated independently. They mathematically prove that Score Centering is a special case of Sampler Replay in which only the logits are replayed.

Key facts

  • The paper reframes train-inference mismatch in RLVR: instead of training the trainer on off-policy samples from an imperfect sampler, RLVR should train the sampler, whose test-time performance is what matters.
  • Sampler Replay replays the sampler's hidden states, logits and routing decisions in the trainer's forward pass to better approximate the sampler's gradient.
  • The authors report stable training under mismatch from quantization (weights, activations, KV cache), weight perturbation and staleness, outperforming strong baselines across tasks and model scales.
  • They mathematically prove that Score Centering is a special case of Sampler Replay where only the logits are replayed.

Why it matters

Train-inference mismatch is described as a well-known problem that degrades RLVR performance. The paper's contribution is a change of viewpoint: current algorithms correct the trainer's gradient for the sampler's off-policy rollouts, while this work treats the sampler as the thing to train and the trainer as a gradient approximator. It also ties together techniques that were treated separately, by showing Score Centering is a special case.

Who it affects

Researchers and engineers running RLVR training, especially those whose sampler differs from the trainer through quantization (weights, activations, KV cache), weight perturbation or stale weights. The mention of routing decisions suggests relevance to models with routing, though the abstract does not say which models were tested.

How to use it

The method is an algorithm applied in the trainer's forward pass: it replays the sampler's hidden states, logits and routing decisions there. Replaying only the logits recovers Score Centering, according to the authors' proof. The abstract gives no details on implementation, so practitioners would need the full paper.

How solid is it

This is a preprint abstract, and the claims are the authors' own. The abstract reports outperforming strong baselines across tasks and model scales, but it gives no numbers and does not name the baselines, tasks or models. The proof that Score Centering is a special case is stated as a mathematical result.

Risks and caveats

The size of the gains cannot be judged from the abstract, since no benchmark scores or improvement figures are given. No code release or compute cost is mentioned. The stability results cover the mismatch sources the authors tested: quantization, weight perturbation and staleness.

“we argue that RLVR should strive to train the sampler, since it is the sampler's performance at test time that we ultimately care about”

— Sampler Replay paper abstract