NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Code Mixologist : A Practitioner's Guide to Building Code-Mixed LLMs

Himanshu Gupta, Pratik Jayarao, Chaitanya Dwivedi, Neeraj VarshneyarXiv 2026

TL;DR

While Large Language Models (LLMs) excel at many multilingual tasks, they systematically degrade when processing code-mixing and code-switching (CSW)—the fluid practice of blending multiple languages within a single conversation or sentence. This survey paper provides a comprehensive taxonomy and an operational "playbook" that guides practitioners through data generation, prompting, modeling, and evaluation strategies to build robust, mix-aware LLMs.

What Problem Does This Paper Address?

Code-mixing and code-switching are the norm for millions of multilingual speakers worldwide on social media and messaging platforms (e.g., mixing Hindi and English into "Hinglish"). However, modern LLMs are predominantly trained on massive monolingual corpora.

When confronted with mixed-language inputs, even state-of-the-art foundational models suffer from severe pathologies:

  • Language Confusion: Unexpectedly reverting entirely to a dominant language like English.
  • Cultural Hallucination: Misinterpreting regional nuances and context.
  • Safety Vulnerabilities: Malicious actors can easily "jailbreak" English-aligned safety guardrails using code-mixed prompts, exploiting a phenomenon known as lexical dilution.

The authors address the lack of a unified framework for handling CSW in the LLM lifecycle, moving past the fragmented, task-specific approaches of the pre-LLM era.

Figure 1: A comprehensive framework for addressing code-mixing in the LLM era, spanning data, modeling, prompting, and evaluation to build more robust and safe multilingual systems.

Methods

As a comprehensive survey and practitioner's guide, the paper synthesizes state-of-the-art techniques across three core areas of the LLM lifecycle:

  1. Prompting and In-Context Learning (ICL): Strategies like In-Context Mixing (ICM) and Code-Switching In-Context Learning (CSICL) use mixed-language examples as "cognitive bridges" to align internal representations. The authors also highlight explicit syntactic constraints (e.g., instructing the model to only switch languages at noun phrases) to prevent unnatural token-level flickering.
  2. Large-Scale Data Generation: The paper outlines pipelines ranging from cheap baselines like Alignment-Guided Substitution (swapping words via phrase-alignment tools) to Filter-Then-Finetune pipelines and GLOSS-style adapters that transfer synthesis capabilities to unseen language pairs.
  3. Training and Modeling: The authors review structural interventions including Boundary-Aware Masking (e.g., SWITCHMLM, which targets gradient updates at language switch points) and specialized architectures like RESBERT and CMLFormer that preserve language-id signals.

Datasets

The paper catalogs and categorizes existing benchmarks into a recommended three-tier evaluation suite:

  • Foundational Syntax & Understanding: Benchmarks like LinCE, GLUECoS, and COMI-LINGUA for shallow tagging, part-of-speech (POS) tagging, and Natural Language Inference (NLI).
  • Reasoning, Knowledge, & Generation: Evaluation suites like CodeMixEval, Lost in the Mix, ENKOQA (for cultural retrieval), and CS-Sum (for dialogue summarization) that isolate the performance drop caused by switching languages.
  • Diagnostic Probes: Minimal-pair evaluations and synthetic NLI probes designed to test if models respect strict linguistic constraints (e.g., Poplack's Equivalence Constraint).

Key Insights and Ideas

  • Code-Mixing as a Multilingual Unlock: Surprisingly, code-mixing isn't just a target task; it can be used as a prompting mechanism. Injecting target-language words into English few-shot exemplars helps the model bridge semantic gaps and improves downstream performance for low-resource languages.
  • The Tokenizer Bottleneck: For non-Latin scripts (e.g., Hindi, Arabic), tokenizers often fragment words into meaningless sub-tokens. Transliterating (Romanizing) the text in the prompt drastically increases lexical overlap with the model's English-centric pre-training, unlocking latent capabilities.
  • Quality Beats Quantity in Data Gen: Massive synthetic data dumps often contain unnatural mixing. Training on a smaller, quality-filtered "silver" dataset screened strictly for perplexity and switch density significantly outperforms training on full, noisy synthetic corpora.
  • The Instruction Tuning Blindspot: When instruction-tuning models for CSW, practitioners should not code-mix the instructions themselves. Keeping the task template in a high-resource language (like English) while code-mixing only the input/output content prevents the model from misunderstanding the task definition.

Key Results

Because this is a survey paper, it highlights quantitative milestones from the literature it reviews:

  • Parameter Efficiency: Parameter-efficient specialization techniques like PRO-CS (instance-based prompt composition) achieve performance parity with full fine-tuning while updating less than 0.18% of total parameters.
  • The "Code-Mixing Gap": The paper formalizes the need to explicitly report the performance delta between code-mixed inputs and matched monolingual inputs of the same intent, noting that absolute accuracy scores on standard benchmarks often hide systematic structural failures.

Limitations and Future Work

The authors note several limitations in current research:

  • English Centricity: The vast majority of existing CSW literature remains heavily skewed toward English-paired mixing (e.g., Hinglish, Spanglish), leaving intra-family or non-English pairs understudied.
  • Modality Constraints: The survey focuses strictly on text, omitting speech-to-speech and multimodal code-switching settings.

Grand Challenges for Future Research:

  1. Reforming Evaluation: Moving away from surface-level n-gram metrics (BLEU/ROUGE)—which penalize valid code-mixed variations and reward monolingual copying—toward calibrated LLM-as-a-Judge protocols and structural indices (like the Code Mixing Index).
  2. RL and Long-Context Modeling: Utilizing Reinforcement Learning from AI Feedback (RLAIF) to optimize for naturalness and multi-turn consistency in long dialogues.
  3. Dynamic Safety Guardrails: Developing mix-aware safety filters capable of detecting adversarial jailbreaks that exploit lexical dilution.

Summary updated

BibTeX
@misc{gupta2026code,
  author = {Himanshu Gupta and Pratik Jayarao and Chaitanya Dwivedi and Neeraj Varshney},
  title = {{Code Mixologist : A Practitioner's Guide to Building Code-Mixed LLMs}},
  year = {2026},
  eprint = {2602.11181},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.11181},
}
Figure