Can Large Language Models Understand, Reason About, and Generate Code-Switched Text?
Genta Indra Winata, David Anugraha, Patrick Amadeus Irawan, Anirban Das, Haneul Yoo, Paresh Dashore, Shreyas Kulkarni, Ruochen Zhang, Haruki Sakajo, Frederikus Hudi, Anaelia Ovalle, Syrielle Montariol, Felix Gaschi, Michael Anugraha, Rutuj Ravindra Puranik, Zawad Hayat Ahmed, Adril Putra Merin, Emmanuele Chersoni
TL;DR
This work introduces CodeMixQA, a comprehensive benchmark for evaluating large language models on code-switched text, including 16 language-pair variations and transliterated forms. It systematically studies understanding, reasoning, and generation under code-switching using three generation strategies: Random Switching, Selective Switching, and Grammar Forcing, and introduces two metrics, Code-Mixing Index (CMI) and Switch-Point Fraction (SPF). The authors analyze a broad set of models and include an automatic evaluation judge, revealing an average performance drop of approximately 11% under code-switching and a tradeoff between naturalness and semantic fidelity in generated outputs. The results highlight persistent challenges in reasoning and generation under multilingual mixing and offer actionable insights for building more robust, linguistically aware multilingual LLMs, with CodeMixQA released as open-source to spur further research.
Abstract
Code-switching is a pervasive phenomenon in multilingual communication, yet the robustness of large language models (LLMs) in mixed-language settings remains insufficiently understood. In this work, we present a comprehensive evaluation of LLM capabilities in understanding, reasoning over, and generating code-switched text. We introduce CodeMixQA a novel benchmark with high-quality human annotations, comprising 16 diverse parallel code-switched language-pair variants that span multiple geographic regions and code-switching patterns, and include both original scripts and their transliterated forms. Using this benchmark, we analyze the reasoning behavior of LLMs on code-switched question-answering tasks, shedding light on how models process and reason over mixed-language inputs. We further conduct a systematic evaluation of LLM-generated synthetic code-switched text, focusing on both naturalness and semantic fidelity, and uncover key limitations in current generation capabilities. Our findings reveal persistent challenges in both reasoning and generation under code-switching conditions and provide actionable insights for building more robust multilingual LLMs. We release the dataset and code as open source.
