TL;DR
This paper introduces X-Guard, a novel multilingual guard agent designed to enhance the safety of Large Language Models (LLMs) across diverse linguistic contexts. X-Guard addresses critical vulnerabilities in existing safety systems, particularly their English-centric design and susceptibility to sophisticated attacks like code-switching, by offering transparent and linguistically inclusive content moderation.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly integrated into sensitive domains, making robust safety mechanisms paramount. However, current LLM safety frameworks and guardrails exhibit significant vulnerabilities, especially in multilingual settings. These systems often struggle with low-resource languages and code-switching, largely due to their English-centric design and a scarcity of diverse cross-lingual training data. Furthermore, existing multilingual solutions, like Llama Guard-3, lack transparency in their decision-making processes, hindering trust and debugging. This paper aims to bridge this gap by developing a transparent, multilingual safety agent that can effectively moderate content across a wide range of languages and defend against advanced adversarial attacks.
Methods
The X-Guard agent employs a two-stage architecture. First, a custom-finetuned mBART-50 translation module handles language detection, routing, and translation of non-English inputs into English. This module is trained on a massive dataset of 5 million data points spanning 132 languages. Second, a safety evaluation module, based on a Qwen-2.5-Instruct 3B model, performs the actual safety assessment. This model is trained using a combination of supervised finetuning (SFT) and Reinforcement Learning from Human Feedback (RLHF) with Proximal Policy Optimization (GRPO). A key innovation is the use of a "jury of judges" methodology for data curation, where multiple LLMs are used to provide safety assessments and rationales, mitigating individual LLM biases.
Datasets
The paper introduces a comprehensive multilingual safety dataset spanning 132 languages with 5 million data points. This dataset was created by curating and enhancing multiple open-source safety datasets, including Salad-Bench and ALERT, and augmenting them with explicit evaluation rationales. The data was further expanded by translating existing responses into 132 languages using Google Cloud Translation. For training the X-Guard agent, a dataset of 100K SFT training data points and 76K GRPO training data points were used. An evaluation dataset of 65K data points across 132 languages was also utilized.
Key Insights and Ideas
- The "Curse of Multilinguality" is Real: Expanding translation models to cover a vast number of languages, especially with limited training data, can lead to performance degradation. This highlights the need for specialized approaches for low-resource languages.
- Transparency is Key for Trust: The paper emphasizes the importance of transparent decision-making in safety systems. X-Guard's inclusion of a
<think>tag for reasoning aims to provide users with insight into why a decision was made, fostering trust. - Jury of Judges Mitigates Bias: Relying on a single LLM for safety evaluation can embed its inherent biases. A jury approach, where multiple LLMs contribute to the decision, offers a more democratic and potentially less biased evaluation.
- Code-Switching is a Major Vulnerability: Sophisticated attacks that mix languages are a significant challenge for current safety systems. X-Guard's architecture is specifically designed to handle these "Sandwich Attacks."
Key Results
X-Guard demonstrates strong performance across multiple languages. The agent achieved an accuracy of 70.38% and an F1-score of 70.44% on a dataset of 65K evaluation samples spanning 132 languages. For English-only data, it achieved a high accuracy of 97.20%. Notably, X-Guard defended against Sandwich Attacks with 83% accuracy, significantly outperforming Llama-Guard-8B at 62%. The translation module also showed improvements in BLEU, chrF, and TER scores for both previously supported and new languages.
Limitations and Future Work
The authors acknowledge several limitations:
- Agentic Approach as Proof-of-Concept: The current agentic approach is a proof-of-concept and requires further calibration for production use.
- Translation Dependency: The safety evaluator's performance is heavily reliant on the translation module, making it a potential single point of failure.
- Curse of Multilinguality Impact: Performance degradation in multilingual contexts due to the translation model's limitations is a significant concern.
- Synthetic Data Biases: The use of LLM judges for data generation introduces model-specific biases.
- Reward Function Limitations: The current reward function focuses on structural integrity and correct labels, not the quality of reasoning.
- Computational Resources: The approach requires substantial computational resources.
- Single Decoder-Based LLM: The inability to train a single decoder-based LLM for multilingual classification is a limitation.
- Linguistic Artifacts: Reliance on Google Cloud Translation introduces potential linguistic artifacts and biases, limiting understanding of nuanced cultural contexts and slang.
Future work includes training larger models, exploring single models for multilingual classification, developing specialized translation modules for language families, creating culturally-aware safety evaluation modules, and conducting comprehensive human evaluation studies. The authors also plan to explore the TaCo approach for training a single LLM for multilingual content moderation.
Summary updated