Distributionally Robust Token Optimization in RLHF

Yeping Jin, Jiaming Hu, Ioannis Ch. PaschalidisNeurIPS 2026

TL;DR

Large Language Models often stumble over complex reasoning tasks if you slightly tweak the prompt's phrasing, format, or language. Distributionally Robust Token Optimization (DRTO) fixes this brittleness during post-training by slicing generated responses into logical segments ("spans") and mathematically forcing the model to focus on its worst-performing steps. The result is an LLM that handles real-world curveballs in math and coding much more reliably, with almost zero extra training overhead.

What Problem Does This Paper Address?

Imagine studying for a math exam using practice tests, only to blank out on the real thing because the professor used slightly different notation or translated the word problems into Spanish. LLMs suffer from a very similar fragility.

Standard alignment techniques—like Proximal Policy Optimization (PPO) and Direct Preference Optimization (DPO)—do a great job aligning models to human preferences on familiar data. However, they are notoriously vulnerable to distribution shifts: superficial changes in wording, formatting, or topic difficulty encountered in the wild. Furthermore, standard RLHF usually judges an entire multi-step response with a single thumbs-up or thumbs-down at the very end, making it hard for the model to know which specific reasoning step went off the rails. While recent methods try to make alignment more robust, they often become overly conservative (hurting performance on normal prompts) or computationally bloated, and they fail to take advantage of fine-grained, token-by-token feedback.

Methods

Instead of reinventing the RLHF wheel, the authors build directly on Reinforced Token Optimization (RTO)—a recent standard method that upgrades PPO by giving the model dense, token-by-token rewards derived from a frozen DPO model.

What’s new here is wrapping that token-level learning inside Distributionally Robust Optimization (DRO)—a mathematical framework that trains a model against a hypothetical adversary who reweights the data to highlight worst-case errors. Rather than applying DRO to individual tokens (too noisy) or whole responses (too coarse), DRTO introduces span-level DRO:

Overview of the DRTO pipeline showing how rollouts are cut into spans at low-confidence tokens and aggregated via KL or Chi-square DRO.
  1. Smart Segmentation: As the model generates an answer, DRTO watches its confidence. Whenever token probability drops below a threshold, DRTO makes a cut—naturally slicing the response at transitions between reasoning steps or syntactic clauses.
  2. Span Losses: Token-level PPO losses are averaged within each contiguous span, treating every reasoning chunk as an equal citizen regardless of length.
  3. Worst-Case Reweighting: Instead of taking a flat average of these span losses, DRTO constructs an "ambiguity set" (a mathematical bubble of plausible probability distributions) around them using two classic divergence geometries:
  4. KL-DRTO uses Kullback-Leibler divergence, simplifying neatly into an exponential tilting formula that smoothly turns up the volume on high-loss spans.
  5. $\chi^2$-DRTO uses Pearson $\chi^2$-divergence, yielding a clean, fast surrogate objective: simply optimize the mean span loss plus a scaled standard deviation of the span losses.

Datasets

No new benchmarks were introduced; instead, the authors curated existing datasets to intentionally test out-of-distribution generalization:

  • Math Reasoning (Llama3-8B): Trained online using 10,000 diverse math prompts from OpenMathInstruct (plus an in-distribution check trained on GSM8K). Evaluated across five benchmarks representing progressively wider shifts: GSM8K (in-distribution arithmetic), GSM (CoT) (prompt-format shift), GSM (ES) (Spanish language shift), MATH-500 (competition-level difficulty shift), and GPQA (graduate-level science topic shift).
  • Code Reasoning (Qwen3-8B): Trained on 5,000 programming prompts from UltraInteract. Evaluated on HumanEval (function synthesis), MBPP (broader Python patterns), and LiveCodeBench (contamination-resistant competitive coding).

Key Insights and Ideas

  • Model uncertainty is a natural scalpel: You don't need an external parser to find the boundaries between reasoning steps. Low-confidence tokens naturally cluster where one thought ends and the next begins, giving you meaningful spans for free.
  • Granularity is a Goldilocks problem: Ablations show that reweighting whole trajectories treats good and bad steps alike, while slicing spans too finely (down to single tokens) loses local context and degrades accuracy. Mid-sized spans hit the sweet spot.
  • Dense rewards and robust losses are synergistic: Applying span-level DRO to standard PPO (without token-wise rewards) flops on hard math (14.2% vs. 22.4% on MATH-500). Token rewards tell the model where the local errors are; span-DRO forces the optimizer to actually care about fixing the hardest ones.
  • Dynamic beats static: Simply up-weighting the top quantile of high-loss spans with a fixed rule underperforms DRTO. The principled geometry of DRO adapts smoothly as training progresses.

Key Results

Across both domains, DRTO consistently outperforms standard RTO, PPO, and DPO under distribution shifts while preserving strong in-distribution accuracy (~80% when trained and tested directly on GSM8K).

Figure 1: Performance of five RLHF fine-tuning methods on math and coding benchmarks under distribution shift. DRTO improves over standard RTO on most benchmarks.
  • Math Gains: $\chi^2$-DRTO is the standout performer, beating standard RTO across all five benchmarks—including +5.5 percentage points on GSM8K (78.7%), +5.1 on GSM-CoT (79.5%), and +4.4 on the notoriously tough MATH-500 (22.4%). KL-DRTO takes the crown on the Spanish shift, GSM-ES (67.6%, +1.6 points).
  • Coding Gains: On Qwen3-8B, $\chi^2$-DRTO achieves the highest HumanEval score (88.41%) and jumps +8.40 points over RTO on MBPP (69.00%). Meanwhile, KL-DRTO shines brightest on MBPP (70.20%, +9.60 points) and LiveCodeBench (40.54%, +2.70 points).
  • Dirt-Cheap Overhead: Unlike recent heavy-duty RL baselines like DAPO (3.59x slower than RTO) and FlowRL (4.86x slower), $\chi^2$-DRTO and KL-DRTO add minimal math to the actor update, running in just 1.16x and 1.17x the training time of standard RTO.

Limitations and Future Work

The authors note that their experiments are limited to 8B-parameter models (Llama3-8B and Qwen3-8B) and single-turn, single-response generation. Furthermore, while the ambiguity sets guarantee robustness over observed span losses inside a minibatch, whether that translates to arbitrary real-world prompt shifts is purely an empirical win rather than a theoretical guarantee—and performance depends on tuning span thresholds and ambiguity radii. Finally, DRTO targets natural distribution shifts, not adversarial jailbreaks, and still inherits the baseline rollout costs of on-policy RL. Scaling up to larger models, multi-turn chats, open-ended human preferences, and multi-reward setups are left for future exploration.

Summary updated

Abstract

Large Language Models (LLMs) tend to respond correctly to prompts that align well with the data they were trained and fine-tuned on. Yet, small shifts in wording, format, or language can trigger surprisingly large failures, especially on multi-step reasoning problems. To address this problem, we propose a Distributionally Robust Token Optimization (DRTO) approach, which combines token-level Reinforcement Learning from Human Feedback (RLHF) with Distributionally Robust Optimization (DRO). DRTO constructs $f$-divergence ambiguity sets over span-level actor losses, providing a principled way to emphasize difficult response segments during policy optimization. Empirically, DRTO enhances consistency under natural distribution shifts in multiple reasoning benchmarks among different tasks, achieving accuracy of +4.4 percentage points on MATH-500 and +2.7 percentage points on LiveCodeBench over standard RTO. Our code is available at https://github.com/noc-lab/DRTO.
BibTeX
@inproceedings{jin2026distributionally,
  author = {Yeping Jin and Jiaming Hu and Ioannis Ch. Paschalidis},
  title = {{Distributionally Robust Token Optimization in RLHF}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=9zSXz3TUrv},
}
Figure