Sampler Replay: Train The Sampler Not The Trainer in Reinforcement Learning with Verifiable Rewards
Abstract
Train-inference mismatch is a well-known problem that degrades reinforcement learning with verifiable rewards (RLVR) performance. This problem is currently framed as training the trainer with samples coming from an imperfect version of itself: a sampler optimized to meet some efficiency criteria. Therefore, current RLVR algorithms are designed to account for the discrepancy in the trainer's gradient due to the sampler's off-policy rollouts. In this paper, we reframe the problem: 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. Therefore, we view the trainer merely as a mechanism to get an approximation of the sampler's true gradient. We propose Sampler Replay, an algorithm that replays the sampler's hidden states, logits, and routing decisions in the trainer's forward pass to better approximate the sampler's gradient. Across tasks and model scales, we show that Sampler Replay stabilizes training under severe train-inference mismatch induced by quantization (weights, activations, KV cache), weight perturbation, and staleness, outperforming strong baselines. Furthermore, we show that Sampler Replay is a generalization of techniques that have been widely used in the literature to address TIM but that, so far, have been treated independently. Notably, we mathematically prove that Score Centering is a special case of Sampler Replay, where only the logits are replayed.
Community
First Author of the paper here. Let me explain the paper in simple terms. I am excited by what we found so much.
Current RLVR algorithms adopt a shared implicit framing: They train the trainer policy using an off-policy imperfect sampler. But, who said the sampler is imperfect? Let's view it differently. We train the Sampler with an imperfect trainer. In other words, instead of trying to estimate the policy gradient for the trainer with off-policy sampler, let's estimate the sampler's gradient with imperfect trainer! It is a complete reframing.
And many popular techniques and papers have been doing it in disguise! Let me explain.
We find replaying hidden states + logits + routing as a nice way to recreate the sampler's forward pass in the trainer, so the trainer's backward pass gets close to sampler's backward pass. In other words, replaying sampler's inner working in the trainer, makes trainer (gradient engine) to compute sampler's gradient instead.
Shockingly, we prove Score-Centering (the current SOTA) mathematically equals replaying sampler logits in trainer's forward pass. It is a subset of Sampler Replay in disguise!
We find Sampler Replay to be very robust, outperforms SC and SC+TIS and also show that it really does estimate Sampler's gradient better.
Please check the paper out! Also you can check our blogpost or straight check the GitHub code.
Get this paper in your agent:
hf papers read 2611.41862 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper