Code-switching is the practice of mixing two or more languages within a single prompt or conversation. In normal human communication, it can be natural and useful. In AI security, however, it can change how a model parses instructions, separates context, or applies safety rules.
This matters because many models are tested most heavily in one language, often English. A prompt that looks harmless in one language may become clearer, more ambiguous, or harder to filter when another language is inserted. Attackers can use code-switching to bypass keyword-based filters, confuse refusal behavior, or hide harmful intent inside a mixed-language request. Defenders use multilingual testing, native-speaker evaluation, and robust prompt parsing to reduce these gaps. When a system also has tool access, code-switching can turn a weak response into an operational risk, not just a bad answer.


