NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Trust Region Masking for Long-Horizon LLM Reinforcement Learning

Yingru Li, Jiacai Liu, Jiawei Xu, Yuxuan Tong, Ziniu Li, Qian Liu, Baoxiang Wang

TL;DR

Reinforcement learning for long-horizon LLMs suffers from training-inference mismatches that render classical trust region guarantees useless due to quadratic ($O(T^2)$) error scaling. This paper derives tighter, non-vacuous bounds ($O(T)$ and data-dependent) and introduces Trust Region Masking (TRM), a sequence-level filtering method that restores monotonic improvement guarantees and stabilizes long-context LLM-RL.

What Problem Does This Paper Address?

When training Large Language Models using Reinforcement Learning (LLM-RL), algorithms like Proximal Policy Optimization (PPO) rely on a critical assumption: the policy generating the data (the rollout policy, $\pi_{\text{roll}}$) must be close to the policy being optimized ($\pi_\theta$).

However, in modern production pipelines, this assumption breaks down due to unavoidable off-policy mismatch caused by three main factors:

  1. Backend Discrepancies: Using high-throughput inference engines (like vLLM or SGLang) for rollouts alongside different training frameworks (like Megatron-LM or PyTorch FSDP) introduces floating-point non-associativity and logit differences that compound autoregressively.
  2. MoE Routing Discontinuities: In Mixture-of-Experts models, minor numerical jitter can flip expert selection, causing massive spikes in token probabilities.
  3. Distributed Staleness: Asynchronous actor-learner architectures introduce latency between data generation and gradient updates.

Classical trust region theory dictates that the approximation error scales quadratically ($O(T^2)$) with sequence length $T$. For a modern reasoning task with $T = 4096$ tokens, the classical bound yields a completely vacuous error guarantee. Standard PPO attempts to fix this via token-level clipping, but because LLM generation is sequential and autoregressive, small early shifts compound drastically over the trajectory.

Methods

The authors tackle this problem from both a theoretical and algorithmic perspective:

1. Tighter Theoretical Bounds

Instead of relying on loose classical bounds, the authors derive a family of new bounds using both KL-divergence and Total Variation (TV) distance routes:

  • Pinsker-Marginal Bound: Achieves $O(T^{3/2})$ scaling by exploiting sublinear context-shift scaling.
  • Mixed Bound: Achieves $O(T)$ scaling, proving much tighter when divergence is sparse.
  • Adaptive Bound: A data-dependent bound that looks at the expected per-position TV distance rather than the worst-case maximum.

Taking the minimum of all these bounds yields a unified, ultra-tight bound ($B^*$).

2. Trust Region Masking (TRM)

The math reveals that all tight bounds depend on the maximum token-level divergence across a sequence—a quantity that token-independent methods like PPO clipping cannot control. The authors propose TRM (Algorithm 1), which computes the exact KL divergence for each token during the training forward pass. If any single token in a sequence violates the trust region threshold ($\delta$), the entire sequence is masked out (rejected) from the gradient update.

3. Length-Neutral Variants

Because a longer sequence naturally has more opportunities to violate a threshold, strict TRM exhibits a "length bias" that systematically punishes longer reasoning chains. To fix this, the authors introduce Length-Neutral TRM (LN-TRM) and a simplified Sequence-Error Ratio (SER) variant, which normalize the error across the trajectory length to remain fair to long-form responses.

Datasets

The authors validated their approach using the following setup:

  • Base Model: Qwen3-8B-Base under a Zero-RL setup.
  • Training Dataset: Deduplicated DAPO-MATH-17k.
  • Evaluation Benchmark: AIME25 (American Invitational Mathematics Examination 2025), evaluating mathematical reasoning performance.

Key Insights and Ideas

  • Token-Level Interventions Leak Gradients: Token masking or token-level PPO clipping alters the loss gradient but leaves the underlying policy pair $(\pi_{\text{roll}}, \pi_\theta)$ unchanged. The trust region remains violated.
  • Sequence-Level Rejection is Necessary: Because error accumulates autoregressively, if one token goes off the rails, the entire trajectory becomes compromised as an estimator for the true objective. You must drop the whole sequence.
  • TV and KL are Complementary: The KL route provides sublinear context-shift scaling but a lossy advantage factor. The TV route provides a tight advantage factor but linear scaling. Combining them (as done in the Adaptive hybrid bound) allows the algorithm to dynamically select the tightest route per position.

Key Results

  • Theoretical Tightness: As shown in the paper's core analysis, for a sequence length of $T=4096$, the classical bound gives a completely useless error maximum of 1677. The authors' unified TV-Mixed bound slashes this to $\le 4.1$—a 409× improvement that makes monotonic improvement guarantees non-vacuous at scale.
Error bounds comparison for T=4096
  • Empirical Stability: In experiments simulating real-world training-inference mismatch (vLLM vs. FSDP), standard PPO clipping suffered from severe instability, causing the training-rollout perplexity (PPL) gap to explode and performance on AIME25 to degrade. Both TRM-Max and TRM-Avg successfully stabilized training, keeping the PPL gap bounded and delivering consistent score improvements.

Limitations and Future Work

  • The Price of Precondition-Free Guarantees: The tightest sublinear bounds rely on a global precondition ($D_{\mathrm{KL}}^{\mathrm{tok,max}} \le \delta$). If this precondition fails globally, the authors provide a "precondition-free" alternative, but it requires linearly penalizing the objective based on the empirical rejection rate.
  • Tuning the Rejection Threshold: If the threshold $\delta$ is set too strictly, the sample efficiency drops because too many sequences are discarded. Future work could explore dynamically adjusting $\delta$ based on the empirical training variance.

Summary updated

BibTeX
@inproceedings{li2026trust,
  author = {Yingru Li and Jiacai Liu and Jiawei Xu and Yuxuan Tong and Ziniu Li and Qian Liu and Baoxiang Wang},
  title = {{Trust Region Masking for Long-Horizon LLM Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=dPaBOu0Xwk},
}
Figure