Diagnosing Training Inference Mismatch in LLM Reinforcement Learning
Authors: Tianle Zhong, Neiwen Ling, Yifan Pi, Zijun Wei, Tianshu Yu, Geoffrey Fox, Peng Wu, Xiao Yu (ByteDance, University of Virginia)
Summary (Overview)
- Identifies Training–Inference Mismatch (TIM) as a critical infrastructure-level confounder in LLM reinforcement learning: implementation differences between training engines (FSDP) and inference engines (vLLM) cause divergent token probabilities for identical inputs and weights, which can independently trigger training collapse.
- Introduces VeXact, a lightweight zero-mismatch rollout engine that achieves bit-wise alignment with the FSDP training engine by unifying kernel implementations and employing deterministic, batch-invariant kernels—providing a TIM-free diagnostic baseline.
- Demonstrates that TIM alone destabilizes RL training: In REINFORCE experiments, vLLM-based rollout shows reward collapse (MoE: 0.574→0.255 training reward) while VeXact remains stable (0.753), isolating TIM as the sole causal factor.
- Analyzes failure modes of recomputation vs. bypass strategies in GRPO, showing that TIM changes the effective optimization objective through sign-imbalanced, advantage-weighted loss contributions rather than uniform noise—explaining why KL estimators fail to detect early-stage instability.
- Ablates algorithmic TIM compensations (truncated importance sampling, rejection sampling), finding that a combination of token-level truncation with -based sequence-level rejection can closely track the zero-mismatch baseline.
Introduction and Theoretical Foundation
Background
LLM reinforcement learning has become central to post-training foundation models, yet RL training remains difficult to stabilize—policies may rapidly degrade over short training windows. Diagnosing collapses is complicated because multiple failure modes are entangled: hyperparameter issues, reward misspecification, reward hacking, and infrastructure-level confounders.
The TIM Problem
Training-Inference Mismatch (TIM) arises from implementation differences between training engines (FSDP, Megatron) and inference engines (vLLM, SGLang). Even with identical model checkpoints and inputs, divergent model/kernel implementations produce different token probability distributions. This introduces an unintended off-policy bias between sampling and model update—distinct from PPO mini-step off-policy drift, as it cannot be addressed by naive PPO clipping.
Formal Definition
Given context and sampled response with state , TIM is defined at the token level as:
where is the trainer-side reference distribution and is the behavioral distribution realized by the rollout engine. This definition is objective-agnostic (applies to REINFORCE, PPO, or GRPO).
Key Empirical Observation
Table 1 shows token-level drift between rollout and training stacks on Qwen3-8B (bf16) weights:
| The | problem | states | that† | there | exist | real | numbers | |
|---|---|---|---|---|---|---|---|---|
| -0.279 | -0.063 | -0.314 | -0.694 | -0.000 | -0.030 | -0.000 | -0.000 | |
| -0.278 | -0.063 | -0.314 | -0.827 | -0.000 | -0.038 | -0.000 | -0.000 | |
| 0.001 | 0.000 | 0.000 | -0.133 | 0.000 | -0.008 | 0.000 | 0.000 |
† marks an argmax flip: training side's top-1 token differs from rollout's, potentially ending a clause differently. While mean is small per batch, max can reach ~1.0 for extreme tokens.
Methodology
VeXact: Zero-Mismatch Rollout Engine
VeXact eliminates TIM from two sources:
- Model/kernel implementation differences: Uses the same HuggingFace-based model implementation as FSDP, registering VeXact kernels in the FSDP engine initialization.
- Kernel reduction order and tiling variations: Employs deterministic, batch-invariant kernels that fix tiling and reduction order. Implements batch-invariant versions of:
- RMSNorm
- Batched matrix multiplication
- Fused MoE kernels
- Attention (with KV splitting disabled for determinism)
To maintain practical throughput despite fixed tiling, VeXact integrates chunked prefill, CUDAGraph, pipeline parallelism, and optimistic KV allocation with preemption fallback. Its codebase is lightweight (similar LOC to nano-vLLM).
Experimental Configurations
| Setting | Model | Dataset | Evaluation |
|---|---|---|---|
| REINFORCE (dense) | Qwen3-1.7B | Sanity-Test-R1D-1.5B | AIME 2024 (every 50 steps) |
| REINFORCE (MoE) | Qwen3-30B-A3B | DAPO | AIME 2024 (every 20 steps) |
| GRPO | Qwen3-1.7B | Sanity-Test-R1D-1.5B | AIME 2024 (every 50 steps) |
PPO/GRPO Surrogate Objectives
The token-level clipped surrogate is:
Under recomputation vs. bypass, the PPO ratios differ in their denominators:
Zero-Centered Loss Contribution
To analyze objective-space distortion:
This has the same gradient as the standard objective but is zero when .
Empirical Validation / Results
REINFORCE: TIM Alone Causes Collapse
In Figure 2, with TIM as the only difference:
- MoE (Qwen3-30B-A3B): vLLM run degrades after step 280 (training reward 0.574→0.255, validation 0.293→0.067); VeXact reaches 0.753 training / 0.534 validation reward.
- Dense (Qwen3-1.7B): Similar instability pattern with vLLM; VeXact remains stable.
GRPO: Failure Modes of Recomputation and Bypass
Figure 3 shows:
- VeXact: Stable, training reward ~0.93.
- vLLM recomputation: Degrades from ~0.87 to ~0.40 (first 650 steps), partially recovers, then collapses to near-zero after ~step 1665.
- vLLM bypass: Single-stage degradation to ~0.4 without collapse; not accompanied by comparably large loss spikes.
KL Estimators Fail to Detect Early Instability
KL estimators and :
- Bypass mode: Both and increase noticeably.
- Recomputation mode: Both remain nearly flat during the first 700 steps even as reward degrades—aggregate probability-space divergence is not sufficient to characterize early TIM-induced failure.
Sign-Imbalanced Loss Contributions
Figure 5 reveals that recomputation induces a sign-dependent skew in advantage-weighted update signals:
- Harmful contributions are amplified, while offsetting contributions are not symmetrically amplified.
- Symmetric numerical noise in is transformed into skewed, non-zero-mean gradient distortion due to asymmetric interaction with PPO clipping bounds (which react differently for positive vs. negative ).
Why Bypass Also Fails
In bypass mode, the PPO ratio correctly uses the behavioral distribution in the denominator, but the numerator is evaluated on the trainer's numerical path. The optimizer exploits numerical artifacts in the trainer's forward pass; weight updates fail to translate into behavioral improvements when deployed back to the rollout engine.
Algorithmic TIM Compensation Results
Three correction configurations were evaluated (Figure 6):
| Configuration | Description |
|---|---|
| srs-k3-corr-ratio | Sequence-level rejection using |
| srs-k3-ppo-ratio | Sequence-level rejection using |
| tis-srs-k1-corr-ratio | TIS + -based rejection (K1) |
| tis-srs-k3-corr-ratio | TIS + -based rejection (K3) |
Key findings:
- -based rejection outperforms -based: measures system-induced mismatch, while overlaps with PPO's policy-ratio mechanism (controlling update magnitude, not starting distribution location).
- TIS is effective: It corrects the PPO ratio from to by multiplying with .
- Combined TIS + sequence rejection tracks VeXact closely, indicating TIM manifests at multiple granularities.
- The choice between and for sequence rejection has minor impact.
Theoretical and Practical Implications
TIM Changes the Effective Optimization Problem
- Recomputation mode: The sampling log-probabilities used in loss computation are not from the actual samplers, creating a skew in advantage-weighted loss contributions—a fundamentally different optimization landscape than intended.
- Bypass mode: The optimization target exists in a different sampling space from the rollout, making policy updates ineffective even though the denominator is correct.
Implications for Asynchronous LLM RL
Large-scale asynchronous RL (e.g., agentic tasks) is off-policy by design. TIM remains critical because it creates different probability landscapes for optimization and sampling spaces. Zero-mismatch RL preserves the full learning signal, unlike algorithmic corrections that mask or discard high-mismatch tokens/sequences.
VeXact as a Calibration Tool
VeXact enables:
- Scientific benchmarking of algorithmic patches in a noise-free environment.
- Accurate tuning of sensitive filtering thresholds (, ) before deployment to large-scale pipelines.
- Causal diagnosis of whether a given stabilization technique addresses TIM, off-policy drift, or introduces new optimization bias.
Conclusion
This work demonstrates that TIM is not benign numerical noise but a systems-level perturbation that should be treated as a first-order factor in analyzing LLM RL stability. Key takeaways:
- TIM alone can destabilize RL training across REINFORCE and GRPO setups.
- Common implementation choices (recomputation, bypass) fail to eliminate TIM's impact because they change the effective optimization objective.
- Algorithmic corrections (TIS + -based rejection) can closely approach the zero-mismatch reference but require careful design and calibration.
- A joint system-algorithm perspective is essential for RL stability, highlighting the need for zero-mismatch RL execution.
Limitations and Future Directions
- Evaluation is limited in scale and coverage (finite models, tasks, system configurations).
- Generalization of mitigations across broader RL settings remains unclear.
- Potential optimization side effects of algorithmic corrections are not fully visible in current experiments.
- Future work should explore zero-mismatch execution as the default for both synchronous and asynchronous RL pipelines.
Related papers
- Does RoPE Prevent or Degrade Retrieval Heads? A Mechanistic Analysis Across Model Families
RoPE's frequency axis, not dimension utility, is causally load-bearing for retrieval heads, with zeroing low-frequency dimensions collapsing recall across all model families tested.
- RestoreKV: Recovering Full-Cache Behavior Under Aggressive Query-Agnostic KV Cache Eviction
RestoreKV generates a small, context-conditioned restore cache via LoRA-adapted tokens to complement evicted KV pairs, boosting RULER accuracy by up to 35 points at 5% budget with negligible overhead.
- Priming: Hybrid State Space Models From Pre-trained Transformers
Priming initializes hybrid state-space models from pre-trained Transformers using less than 0.5% of the token budget, yielding faster, lighter models that outperform source Transformers on reasoning benchmarks.