Introduction
Code-mixing—the practice of alternating between two or more languages in a single conversation—is a common linguistic phenomenon among multilingual speakers worldwide. While Large Language Models (LLMs) have demonstrated remarkable proficiency in monolingual tasks, their ability to handle the structural and semantic complexities of mixed-language input remains a significant challenge. To address this gap, researchers have introduced CodeMixBench, a comprehensive benchmark designed to evaluate LLMs across 18 languages and 8 diverse tasks.
The Challenge of Code-Mixing
Traditional NLP benchmarks for code-mixing, such as LinCE or GLUECoS, are often limited in scope, covering only a few language pairs and focusing on basic tasks like part-of-speech (POS) tagging. They fail to assess the advanced reasoning capabilities—such as mathematical problem-solving and knowledge retrieval—that characterize modern LLMs. Furthermore, the scarcity of high-quality, human-annotated code-mixed data has hindered the development of robust evaluation frameworks. CodeMixBench aims to fill this void by providing a massive, high-quality dataset for testing the "reasoning" limits of multilingual models.
The CodeMixBench Pipeline
To overcome data scarcity, the authors developed a sophisticated three-phase pipeline to synthesize and validate code-mixed data at scale:
- Parallel Corpus Construction: Parallel sentences were collected or translated across 12 languages for core reasoning tasks like MMLU (knowledge) and GSM8K (math).
- Instruction Synthesis: Leveraging GPT-4 Turbo, the pipeline performs word substitution guided by the Equivalence Constraint theory. This linguistic theory suggests that code-switching occurs most naturally at points where the grammatical structures of the two languages align.
- Rigorous Filtering: Quality is maintained through three layers of filtering: word-level checks (ensuring sufficient mixing intensity), semantic consistency (using LaBSE embeddings to preserve meaning), and model-aligned naturalness ratings from GPT-4.
Benchmark Composition
CodeMixBench is a hybrid dataset comprising 22 newly synthesized datasets and 30 curated open-source datasets. It spans 18 languages from 7 distinct language families (including Germanic, Romance, Sino-Tibetan, and Indo-Aryan) and covers 8 tasks:
- LLM-Centric Tasks: Knowledge Reasoning (CM-MMLU), Math (CM-GSM8K), and Truthfulness (CM-TruthfulQA).
- Traditional NLP Tasks: Language Identification (LID), POS tagging, Named Entity Recognition (NER), Sentiment Analysis (SA), and Machine Translation (MT).
Key Findings and Performance Analysis
The evaluation revealed several critical insights into how current LLMs process code-mixed text:
- Linguistic Proximity: Models perform significantly better when mixing languages within the same family (e.g., Spanish-English) compared to cross-family mixtures (e.g., Chinese-English). Structural similarity appears to facilitate the model's ability to "bridge" the language gap.
- The Few-Shot Hurdle: Interestingly, low-shot prompting (1-2 examples) often degrades performance on code-mixed reasoning tasks. The added complexity of mixed input seems to initially interfere with the model's in-context learning capabilities.
- Scaling and Robustness: While larger models like GPT-4o and LLaMA3-70B are more resilient to code-mixing, they still exhibit a performance "tax" compared to their English-only performance.
GPT-4o emerged as the top performer in comprehensive knowledge reasoning, while GPT-4 Turbo led in mathematical reasoning and truthfulness. A notable leap was observed in the LLaMA series, with LLaMA3-70B outperforming its predecessor, LLaMA2-70B, by over 25 points on the CM-MMLU benchmark.
Despite these successes, a clear performance gap remains. For high-resource pairs like Chinese-English, the accuracy drop on MMLU is approximately 2.6 points. However, for low-resource mixtures like Marathi-English or Nepali-English, the performance drop can reach nearly 15 points, highlighting the urgent need for more diverse training data in these areas.
Conclusion
CodeMixBench provides a vital tool for assessing the multilingual robustness of LLMs. While top-tier models are making strides, the "code-mixing tax" remains significant, especially for low-resource languages. Future research will focus on mitigating biases in code-mixed scenarios and refining synthesis techniques to handle more complex linguistic structures beyond simple word substitution.
Summary updated