Introduction
Large Language Models (LLMs) such as GPT-4o and Claude 3 have undergone extensive safety alignment to prevent the generation of harmful content. However, this alignment is often biased toward high-resource languages like English. While previous research has explored vulnerabilities in monolingual non-English prompts, real-world multilingual speakers frequently engage in code-switching—the practice of mixing multiple languages within a single utterance.
This paper introduces the Code-Switching Red-Teaming (CSRT) framework to investigate whether LLMs can maintain safety guardrails when faced with linguistically mixed inputs. The authors hypothesize that code-switching disrupts safety mechanisms by forcing models into "weaker" linguistic spaces while preserving their ability to understand the underlying harmful intent.
Methodology: The CSRT Framework
The CSRT framework automates the generation of adversarial queries through a three-step process:
- Translation: Harmful "seed" queries from the MultiJail dataset are translated into ten diverse languages, ranging from high-resource (e.g., Chinese) to low-resource (e.g., Javanese, Swahili).
- Synthesis: An LLM (GPT-4o) synthesizes these parallel translations into a single, coherent code-switched sentence.
- Evaluation: Ten state-of-the-art models are tested using metrics including Attack Success Rate (ASR), Refusal Rate (RR), and Comprehension (Cmp.).
The resulting CSRT dataset consists of 315 code-switched versions of MultiJail queries, covering categories like Hate Speech and Violent Crime across 10 languages.
Key Results and Scaling Trends
The study reveals that CSRT is a highly effective "jailbreak" method, achieving a 46.7% higher ASR than standard English queries. Models like Qwen 1.5 and Claude 3 showed high comprehension of code-switched text, which paradoxically made them more vulnerable to these attacks.
A critical finding is the relationship between linguistic complexity and safety failure. As shown in the figures below, the ASR increases significantly as more languages are introduced into a single query. Furthermore, leveraging low-resource languages (high resource unavailability) makes the attacks more potent, suggesting that safety alignment is less robust in these linguistic domains.
Discussion: The Safety Realignment Hypothesis
The authors propose the "Safety Realignment" hypothesis: safety alignment is tied to linguistic proficiency. By disrupting sentence structure via code-switching or using low-resource languages, the model's safety guardrails "misalign." Interestingly, models often understand the harmful intent perfectly (high comprehension) but fail to trigger a refusal, indicating that linguistic parsing is more robust than the safety filters meant to govern it.
Conclusion
CSRT demonstrates a significant vulnerability in current LLM safety alignment. The ability to automatically generate complex, multilingual attacks from simple English seeds poses a scalable threat. Future work must focus on multilingual safety fine-tuning that specifically addresses code-switching to ensure guardrails remain effective across all linguistic contexts.
Summary updated