Enhancing LLM Safety Through a Theoretical Minimax Game Lens

Yihe Deng, Yu Yang, Junkai Zhang, Wei Wang, Bo Li

TL;DR

The authors introduce DuoGuard, a novel minimax reinforcement learning framework where an adversarial data generator and a safety classifier co-evolve to produce high-quality, multilingual safety data. By formalizing this interaction as a game that converges to a Nash equilibrium, they train a compact 0.5B parameter guardrail model that outperforms state-of-the-art 8B models by over 10% while delivering a 2.5x to 4.5x speedup in inference time.

What Problem Does This Paper Address?

Large Language Models (LLMs) require "guardrail" models to intercept unsafe user inputs and toxic model responses before they cause harm.

Figure 1: Illustration of the use-case of a guardrail model for LLMs, which functions as moderation be- tween the user-LLM conversation.

However, building effective guardrails faces two major hurdles:

  1. Multilingual Data Scarcity: While English safety datasets are abundant, open-source safety data in other languages is critically scarce. This causes safety performance to plummet when models encounter non-English queries.
  2. Shortcut Learning and False Positives: Existing datasets lack "safe yet sensitive" corner cases (e.g., discussing a historical war or medical procedures). Consequently, guardrail models learn superficial shortcuts—like flagging any text containing the word "bomb" or "kill"—leading to high false-positive rates.

To deploy these safeguards efficiently in production, engineers need models that are small, fast, and robust across multiple languages.

Methods

The paper tackles this by framing synthetic data generation as a two-player minimax game between two models:

  • The Adversarial Generator ($G_\phi$): Tasked with generating nuanced, language-specific prompts that preserve a toxicity label but deliberately trick the classifier into making a mistake.
  • The Defensive Classifier ($C_\theta$): Tasked with correctly identifying the safety status of both the original seed data and the newly generated adversarial data.

The Co-Evolution Loop

Instead of using standard online Reinforcement Learning (like PPO), which can be unstable and computationally expensive, the authors leverage Direct Preference Optimization (DPO) to update the generator.

During each iteration:

  1. The generator produces new queries based on a seed dataset.
  2. The classifier evaluates them.
  3. Samples that successfully trick the classifier are labeled as preferred for the generator's DPO training, while samples the classifier gets right are dispreferred.
  4. The classifier is then retrained from scratch on the updated dataset containing these hard-to-classify misclassifications.

The authors provide a rigorous mathematical proof showing that this iterative optimization acts as a contractive map, guaranteeing linear convergence to a Nash equilibrium where the classifier becomes robust against all generated adversarial attacks.

Datasets

The framework initializes with a curated seed dataset compiled from over 20 open-source safety and toxicity datasets (including BeaverTail, ToxicChat, WildGuardMix, and multilingual sets like Aya Red-teaming). The initial seed data was highly imbalanced, with English making up 81.4% of the corpus.

For evaluation, the authors benchmarked performance across four languages (English, French, Spanish, and German) using six prominent safety datasets:

  • Multilingual Benchmarks: RTP-LX and XSafety.
  • Translated English Benchmarks: XSTest, ToxicChat, OpenAI Moderation, and Beavertails.

Key Insights and Ideas

  • Automatic Language Rebalancing: One of the most striking findings is how the minimax game naturally corrects for data scarcity. Because the base classifier was initially weak on low-resource languages (Spanish and German), the generator quickly realized that generating prompts in those languages was the easiest way to "win" (trick the classifier). As a result, the synthetic data distribution automatically shifted from 81.4% English down to just 13% English, naturally filling the multilingual data gap.
  • Weak-to-Strong Generalization: The authors discovered that data generated using a weaker 0.5B classifier could successfully be used to train a stronger 1.5B classifier, demonstrating excellent generalization across different model architectures.

Key Results

The resulting model, DuoGuard, achieves an unprecedented balance between accuracy and computational efficiency:

Figure 2: Overview of our main results. In the left subfigure, we demonstrate a consistent superior pefor- mance of average f1 score across 6 benchmarks in the four languages. In the right subfigure, we show that out model maintains thelowest inference cost while achieving superior average performance across languages.
  • Performance vs. Scale: The 0.5B DuoGuard model outperformed specialized guardrails of a similar scale (such as LlamaGuard3-1B and ShieldGemma-2B) by over 30% on average F1 scores.
  • Beating Larger Models: Remarkably, the 0.5B model surpassed the much larger LlamaGuard3 (8B) by roughly 10% across all tested languages.
  • Inference Speed: DuoGuard clocked an inference latency of just 16.47 ms/input, making it more than 2.5x faster than ShieldGemma (2B) and LlamaGuard3 (8B), rendering it highly practical for real-world, low-latency deployment.

Limitations and Future Work

  • Dependence on the Base Generator: The framework's success relies heavily on the quality and linguistic capabilities of the underlying generator LLM (the authors used an 8B Dolphin model). If the base LLM lacks deep alignment or fluency in a target language, the synthetic data quality will suffer.
  • Language Scope: The current study only validates the framework on four Western languages (English, French, Spanish, German). Future work is required to test its efficacy on low-resource or non-Latin script languages.
  • Nuanced Cultural Contexts: While the model excels at identifying explicit and adversarial unsafety, it does not yet fully capture deeply nuanced cultural or regional safety contexts.

Summary updated

Abstract

The rapid advancement of large language models (LLMs) necessitates effective mechanisms to ensure their responsible deployment by accurately distinguishing unsafe content from benign content. While substantial safety datasets are available in English, multilingual safety modeling remains underexplored due to limited open-source safety datasets in other languages. Even within English datasets, safe yet sensitive corner-case content is scarce, leading to shortcut learning by models and non-trivial false-positive rates. To mitigate these issues, we introduce a novel minimax reinforcement learning (RL) framework wherein a data generator and a classifier model co-evolve, facilitating the production of high-quality synthetic multilingual safety data. We theoretically formalize this interaction as a minimax game and rigorously demonstrate convergence to a Nash equilibrium. Empirical evaluations confirm that our synthetic data generation method significantly enhances the classifier model performance, enabling a substantially smaller model to surpass the state-of-the-art by nearly 10% on English benchmarks while achieving 4.5x faster inference speed. These results establish a scalable and efficient methodology for synthetic data generation, advancing the development of safer and more robust multilingual LLM deployments.
BibTeX
@inproceedings{deng2026enhancing,
  author = {Yihe Deng and Yu Yang and Junkai Zhang and Wei Wang and Bo Li},
  title = {{Enhancing LLM Safety Through a Theoretical Minimax Game Lens}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2026},
  url = {https://openreview.net/forum?id=WGBrHMcews},
}
Figure