ZICQ
中 Log in / Sign up
Newsroom Paper Frontier Research #RLVR #Train-Inference Mismatch #Model Quantization #Sampler Replay

Sampler Replay Replays Sampler States to Mitigate the RLVR Train-Inference Gap

Avatar of Mr.Xu

By Mr.Xu Compiled & Reviewed by Editorial

Published:

中文阅读 (Chinese) English Version
Co-reading Select any sentence in the article to highlight, annotate, or copy a quote card. Join discussion ↓

Summary:Sampler Replay reframes reinforcement learning with verifiable rewards around the sampler that will actually be deployed. During the trainer’s forward pass, it replays sampler-generated hidden states, logits, and MoE routing decisions so that optimization follows the inference-time computation path more closely. The paper also proves that score centering is a special case in which only logits are replayed. According to the abstract, the method remains stable under weight, activation, and KV-cac


Reframing RLVR around the deployed sampler

In reinforcement learning with verifiable rewards, the trainer and inference sampler are often treated as two execution modes of the same policy. In production, however, weight precision, activation precision, KV-cache precision, kernel implementations, MoE routing, and rollout freshness can all differ. The sampler then no longer matches the trainer used for optimization.

A conventional gradient such as

g_tr ≈ E_{y~q}[∇θ log pθ(y|x)]

primarily optimizes the trainer: trajectories come from sampler q, while the gradient is evaluated through trainer pθ. Importance sampling, clipping, and trust-region methods can correct distribution bias, but they do not automatically reproduce the numerical path taken by the deployed sampler.

Sampler Replay changes the objective. The sampler that will actually be deployed becomes the target, and the trainer acts as a mechanism for estimating its gradient. Instead of regenerating trajectories, the method carries sampler-generated hidden states, logits, and routing decisions into the trainer’s forward pass, allowing subsequent computation to continue along the state path actually observed during sampling.

What the replay mechanism carries

Sampler Replay transfers three distinct classes of information, each targeting a different layer of mismatch:

  1. Hidden states connect the trainer to representations produced during sampling. This prevents quantization error, weight perturbations, or kernel differences from accumulating unchecked through the prefix. It aligns the internal computation path, not merely the final action probability.
  2. Logits expose the sampler’s actual output distribution to the trainer. The paper proves that score centering, in which only logits are replayed, is a special case of Sampler Replay.
  3. MoE routing decisions keep the sparse expert path aligned. If the sampler and trainer select different experts, their hidden states can diverge even when the prompt and sampled tokens appear identical.

The method is therefore not merely importance weighting on old trajectories. It brings parts of the sampler’s internal computation graph into training. The mathematical treatment of score centering as a special case also unifies techniques that have previously been studied separately, although it does not imply that every replay combination provides equal value.

Why quantization makes the problem severe

The abstract identifies four sources of train-inference mismatch:

  • Weight quantization changes matrix-multiplication results, allowing small errors to compound across depth.
  • Activation quantization directly changes the inputs and outputs of nonlinear layers.
  • KV-cache quantization alters the precision of long-prefix attention and may amplify error as context grows.
  • Stale rollouts are generated by an older policy and remain off-policy even when training and deployment precision are identical.

Conventional RLVR corrections focus primarily on constraining the ratio between old and new policies. Sampler Replay instead asks whether the training graph reproduces the deployment graph. The approaches are complementary: importance sampling, KL regularization, and conservative policy updates can still control policy drift, while state replay narrows numerical and structural differences in the forward path.

Engineering costs: memory, bandwidth, and MoE load

Replay does not make accurate gradients free. For sequence length T, depth L, and hidden size H, storing one BF16 hidden state per token and layer requires roughly 2TLH bytes before metadata and other overhead. Retaining full-vocabulary logits adds approximately 2TV bytes. A practical system can store selected layers, Top-K logits, or compressed states, but truncation removes tail probability information and may be especially damaging for tasks that depend on low-probability candidates or long-tailed rewards.

The usual training computation also remains. The sampler still generates rollouts, and the trainer still performs forward and backward passes. New costs come from state capture, inter-device transfer, and replay. In a high-throughput RLVR cluster, long reasoning trajectories may make the replay buffer the first bottleneck, ahead of optimizer memory. Chunked storage, layer-wise compression, asynchronous prefetching, or retaining only the most influential layers may be necessary.

Implementation fidelity is critical. Replayed states must come from the same quantization configuration and operator path used in deployment. Replaying a state after quantizing and then dequantizing it does not fully reproduce rounding behavior inside the inference kernel. Dynamic batch shapes, fused operators, and GPU-specific implementations can introduce further divergence.

MoE systems face a separate constraint. Replaying hard routing decisions preserves expert selection, but the token load observed during training may differ from the load produced by the sampler. Operators should therefore monitor expert congestion, routing-flip rates, and token drops or reroutes.

Replay also does not make stale rollouts current. It can reduce inconsistency caused by evaluating old trajectories through a mismatched trainer, but the rewards and supervision embedded in those trajectories remain old. Production pipelines need a hard upper bound on rollout age and periodic refreshes from a newer sampler.

Evidence and evaluation limits

The abstract reports that Sampler Replay stabilizes training across tasks and model scales, outperforming strong baselines under severe mismatch caused by weight, activation, and KV-cache quantization, weight perturbations, and staleness. Its strongest theoretical contribution is the proof that score centering is a special case of replaying only logits, placing several previously separate techniques under one framework.

The available material does not disclose model sizes, task lists, baseline names, absolute scores, variance, GPU hours, or additional storage requirements. A claim that a method beats “strong baselines” cannot establish whether the gain comes from more stable optimization, a larger sampling budget, or a particular quantization combination. Quantized training and inference benchmarks are especially sensitive to batch size, kernel version, and KV-compression policy, so independent replication is necessary.

A convincing evaluation should report verifiable reward and final pass rate, token-level KL between trainer and sampler, Top-1 and Top-K agreement, MoE routing agreement, results across rollout-age buckets, per-step GPU time, peak memory, and replay-storage overhead. These metrics determine whether better gradient alignment actually improves end-to-end economics.

Practical deployment guidance

  1. Define the deployment contract first: Specify weight, activation, and KV-cache precision, backend kernels, batch shapes, MoE routing rules, and the maximum accepted rollout age. Training should target the real serving stack rather than an idealized FP16 model.
  2. Enable replay incrementally: Start with the lower-overhead logits-only variant, add hidden states when prefix drift is measurable, and evaluate routing replay separately for MoE systems. Ablate each layer so the system does not pay the full replay cost for marginal gains.
  3. Instrument the mismatch: Track logit KL, Top-1 agreement, reward curves, gradient norms, routing-flip rates, and rollout age, segmented by quantization configuration.
  4. Bound asynchronous staleness: Enforce a maximum age for queued rollouts and balance refresh cost against policy lag. Replay corrects the gradient path; it does not substitute for fresh data.
  5. Optimize total cost: Compare GPU hours, memory, and bandwidth per unit of verified reward, not only final accuracy. In high-throughput serving, added I/O may outweigh the benefit of improved stability.

Bottom line

Sampler Replay recasts train-inference mismatch in RLVR from a problem of tolerating two different systems into one of making optimization pass directly through the deployed system. Its significance lies not in another reward hack, but in a state-level gradient-alignment framework that can unify quantization, MoE, and asynchronous staleness under one mechanism. If deployment contracts, replay storage, and evaluation are handled rigorously, the approach could reduce retraining and tuning costs after quantization. Until the complete experiments and code are available, it is better viewed as a promising RL training direction than a universally production-proven solution.


Source: Hugging Face Daily Papers (2026-11-30)

— END —

Tags: #RLVR #Train-Inference Mismatch #Model Quantization #Sampler Replay

Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.

What's your take on this story?
Explore & Submit Works

Community Comments

Loading live comments and annotations…