CoMix: Guide Transformers to Code-Mix using POS structure and Phonetics

Gaurav Arora, Srujana Merugu, Vivek SembiumACL 2023

Introduction

In multilingual societies, language is rarely a monolithic entity. Instead, speakers frequently engage in "code-mixing"—the fluid blending of two or more languages within a single conversation or even a single sentence. A prominent example is "Hinglish," a mix of Hindi and English. While humans navigate these linguistic shifts with ease, modern AI models like BERT and BART often struggle to maintain coherence when languages interleave.

Researchers from Amazon have introduced CoMix, a novel pretraining framework designed to bridge this gap. By leveraging Part-of-Speech (POS) structures and phonetic signals, CoMix enables Transformer models to master the nuances of code-mixing, achieving state-of-the-art results on translation and Named Entity Recognition (NER) benchmarks.

The Challenges of Code-Mixed Text

The authors identify three primary hurdles that prevent standard multilingual models from effectively processing code-mixed data:

  1. Divergent Grammar: Languages like Hindi and English possess fundamentally different word orders (SOV vs. SVO). Models trained primarily on monolingual corpora lack the structural understanding required to "interleave" these grammars correctly.
  2. Mixing Diversity: There is no universal standard for code-mixing. The ratio of languages and the points at which a speaker switches can vary wildly based on context, region, and personal preference.
  3. Orthographic Chaos: Code-mixing is most prevalent in informal digital communication (e.g., WhatsApp, social media) where standardized spelling is often ignored. A single word like "kis" (meaning "which") might be written as "kys," "kise," or "kisss." Standard models treat these as distinct tokens, failing to recognize their semantic equivalence.
Figure 1: Examples of POS tagging and linguistic variations (phonetic, synonyms, case) in Hinglish sentences.

The CoMix Framework

To address these challenges, CoMix introduces three key architectural and procedural innovations:

Domain Knowledge-based Guided Attention (DKGA)

CoMix modifies the standard Transformer self-attention mechanism to incorporate linguistic domain knowledge. By utilizing POS tags, the model is "guided" to understand the functional equivalence between words in the embedded language (English) and the matrix language (Hindi). For instance, it learns that an English noun should occupy the same structural "slot" as its Hindi counterpart. This anchoring forces the model to learn the underlying grammatical scaffolding of code-mixed sentences rather than just memorizing word sequences.

Weakly Supervised Generation (WSG)

To combat the scarcity of high-quality code-mixed training data, the researchers employed a "nudge" technique during pretraining. WSG restricts the model's vocabulary search space to words that share matching POS tags in the alternate language. This effectively forces the model to practice code-mixing in a grammatically sensible manner, ensuring that generated text remains linguistically plausible.

Phonetic Integration

Recognizing that sound is often more consistent than spelling in informal text, CoMix incorporates a dual-channel encoder. In addition to the standard textual input, the model processes a phonetic sequence of the words. This allows the model to map various ad-hoc spellings (like "school" and "skool") to the same phonetic representation, significantly increasing its robustness to orthographic noise.

Figure 5: The CoMix architecture featuring parallel textual and phonetic embedding channels integrated into a Transformer block.

Evaluation and the PhoBLEU Metric

The models were pretrained using the Samanantar English-Hindi parallel corpus and evaluated across several benchmarks, including LINCE (translation and NER), SemEval-2020 (sentiment analysis), and GupShup H2H (summarization). Additionally, the authors introduced the Hinglish Out-of-Domain (HooD) dataset to test generalization across "Shopping" and "Open Domain" topics.

A significant contribution of this work is PhoBLEU, a new evaluation metric. Traditional BLEU scores often penalize valid code-mixed translations simply because the spelling differs from the reference text. PhoBLEU addresses this by comparing phonetic transcriptions, aligning much more closely with human perception of translation quality. The authors observed a +0.10 to 0.15 improvement in correlation with human judgment compared to standard metrics.

Key Results and Insights

CoMix demonstrated superior performance and efficiency:

  • State-of-the-Art Performance: CoMix set new records on the LINCE leaderboard, achieving 12.98 BLEU for translation and 83.07 F1 for NER.
  • Model Efficiency: Remarkably, CoMixBERT and CoMixBART outperformed much larger models, such as XLM-R Large, despite having up to 10x fewer parameters.
  • Robust Generalization: On the HooD dataset, CoMix showed strong zero-shot capabilities, indicating that its learned linguistic logic extends beyond its training data.

Conclusion

CoMix proves that incorporating linguistic structure and phonetic awareness is essential for mastering the complexities of code-mixed language. While currently optimized for English-Indic pairs, the framework provides a blueprint for improving multilingual AI across diverse global dialects. Future work will focus on scaling these techniques to more low-resource languages and further refining phonetic evaluation methods.

Summary updated

BibTeX
@inproceedings{arora2023comix,
  author = {Gaurav Arora and Srujana Merugu and Vivek Sembium},
  title = {{CoMix: Guide Transformers to Code-Mix using POS structure and Phonetics}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.506},
}
Figure