TL;DR
Reinforcement Learning (RL) for Large Language Models frequently suffers from sudden training collapse caused by numerical discrepancies between inference and training engines. This paper reveals that this "training-inference mismatch" is a dynamic optimization failure rather than a static hardware artifact, and it introduces a simple, reactive learning rate scheduler triggered by response length surges to consistently stabilize training.
What Problem Does This Paper Address?
Large-scale RL fine-tuning for LLMs (such as PPO or GRPO) is notoriously fragile, often experiencing abrupt "collapses"—sharp declines in training rewards and validation accuracy mid-run. Recent literature points to training-inference mismatch as the primary catalyst.
To maximize throughput, modern setups use a heterogeneous software stack: specialized inference kernels (e.g., vLLM, SGLang) generate massive rollouts, while distributed training frameworks (e.g., FSDP, Megatron-LM) compute gradients. Because floating-point arithmetic is non-associative, the different operation sequences across these engines create subtle numerical variances. These variances get amplified by low-precision formats (BF16/FP16) and deep non-linear networks, injecting severe noise into the optimization process. Standard remedies like Importance Sampling (IS) variants try to correct this off-policy bias, but they introduce high variance or require heuristic clipping that eventually fails during extended training runs.
Methods
The authors propose a novel, reactive Learning Rate (LR) scheduler called length-decay. Instead of relying on a predefined, time-based epoch schedule, this scheduler dynamically triggers an LR decay based on an internal early-warning signal: a sudden surge in average response length.
- The Mechanism: The scheduler maintains the initial high learning rate to maximize exploration during early, benign stages. Once a "response length surge" is detected, it halves the learning rate every set decay period until it hits a predefined floor (defaulting to 10% of the initial LR).
- The Heuristic: Empirically, setting the decay period to $\approx 1.8\times$ the time step of the response length surge balances learning speed and stability.
- Theoretical Backing: The authors prove that the gradient error bound scales quadratically ($O(T^2)$) with the sequence horizon $T$. Thus, longer responses drastically amplify the training-inference mismatch, explaining why response length serves as an excellent proxy for impending instability.
Datasets
The experiments were conducted using a filtered DAPO training dataset (approximately 13,000 samples) focused on mathematical RL reasoning tasks. Evaluation metrics include the AIME24 score (American Invitational Mathematics Examination 2024) and training rewards, implemented on the open-source VeRL framework.
Key Insights and Ideas
- Dynamic, Not Static: Training-inference mismatch isn't just static, state-independent background noise from hardware precision limits. It is deeply coupled with the model's location in the weight space. As training progresses, malignant dynamics lead the model weights into sharper regions of the loss landscape with higher curvature, which actively amplifies these numerical discrepancies.
- The Length Surge Warning: Average response length can triple in just a few steps during RL training. Because gradient estimation errors scale quadratically with sequence length, this surge acts as a reliable, proactive indicator of upcoming gradient noise escalation.
- Epochs are Poor Proxies: Traditional epoch-based LR schedules are ill-suited for RL because training stability is largely independent of data volume once a "saturation threshold" is reached. Reducing dataset size doesn't linearly shift the collapse point, meaning time-based schedules will either decay too early or too late.
- Not Just a Precision Issue: Switching from BF16 to FP16 does not inherently solve the problem; FP16 runs exhibit the exact same sudden collapse behavior, proving that optimization-level interventions are required.
Key Results
- Failure of IS Patches: Traditional Importance Sampling patches (like Masked IS or Truncated IS) merely delay the inevitable, eventually suffering catastrophic collapse.
- Stabilization via Length-Decay: Applying the length-decay scheduler successfully stabilized training across different model scales (Qwen3-4B-Base and Qwen3-8B-Base), preventing collapse and maintaining high peak validation performance (AIME24 scores).
- Gradient and Mismatch Control: The proposed scheduler effectively constrained the gradient norm, preventing the noise explosion seen in the baseline.
- Decay Period Scaling: For Qwen3-4B-Base, the length surge occurred near step 110, and a decay period of 204 performed best. For Qwen3-8B-Base, the surge occurred earlier at step 90, and the optimal decay period scaled linearly to 160, confirming the $1.8\times$ scaling heuristic.
Limitations and Future Work
- The exact interplay between numerical stability and the geometric characteristics of the loss landscape (e.g., why the model drifts into high-curvature regions later in training) remains an open question.
- The current trigger relies on a heuristic-driven approach ($1.8\times$ the surge step). Developing a fully automated, non-parametric trigger based on real-time gradient signal-to-noise ratio (SNR) could make the scheduler more robust across diverse tasks.
- The method was primarily validated on math reasoning tasks; its generalizability to other RLHF domains (like alignment or creative writing) needs further exploration.
Summary updated