Introduction
Code-switching (CS)—the alternating use of two or more languages in a single conversation—is a prevalent linguistic phenomenon among multilingual populations. Despite its ubiquity, developing robust AI models for CS text remains a significant challenge due to the scarcity of high-quality, "clean" conversational datasets. While social media platforms provide vast amounts of CS data, these sources are often noisy, heavily transliterated, and lack the structural integrity required for training sophisticated conversational agents. This paper introduces a novel approach, Translation for Code-Switching (TCS), which treats CS generation as a sequence transduction task, leveraging monolingual and parallel corpora to overcome data scarcity.
Methodology: TCS Architecture and Curriculum
The core innovation of this work is reframing CS generation as a translation task: specifically, translating a monolingual "matrix" language (Hindi) into a code-switched variant (Hindi-English).
Model Architecture
The TCS model utilizes a 3-layer Transformer architecture designed with both private and shared components. Private encoders and decoders are dedicated to the source (Hindi) and target (English/CS) languages, while a shared middle layer captures language-agnostic semantic representations. This structure allows the model to effectively map concepts across languages while maintaining language-specific syntactic nuances.
Training Curriculum
To optimize performance, the authors employ a multi-stage training curriculum:
- Denoising Autoencoding (DAE): The model learns to reconstruct original sentences from corrupted versions, establishing a baseline understanding of language structure.
- Backtranslation (BT): By translating between languages and back again, the model generates "pseudo-parallel" data, enhancing its ability to handle cross-lingual mappings.
- Synthetic Pretraining: The model is primed with synthetic CS data generated via two methods: LEX (word-level dictionary replacement) and EMT (clause-level replacement, such as noun phrases).
- Supervised Fine-tuning: The final stage involves tuning the model on a small set of high-quality, real-world CS data.
Datasets and Evaluation
The study introduces All-CS, a new benchmark dataset comprising Movie-CS (derived from Bollywood scripts) and Treebank-CS (crowdsourced CS variants of monolingual Hindi sentences). These are supplemented by the IIT Bombay English-Hindi corpus and conversational data from OpenSubtitles.
Key Results and Insights
The TCS model demonstrates a significant leap in performance over existing generative baselines like VACS and SeqGAN.
Performance Metrics
- Perplexity: Language models trained on TCS-generated data achieved a perplexity of 254.37, a substantial improvement over the 332 baseline.
- BLEU Scores: The supervised TCS model reached a BLEU score of 43.15, compared to just 19.18 for the baseline.
- Human Evaluation: Linguistic experts rated TCS-generated text nearly as high as human-authored CS text in terms of naturalness and semantic accuracy.
Data Efficiency
A critical finding of the study is the diminishing returns of parallel CS data. As shown in the performance scaling analysis, the benefits of additional parallel lines begin to plateau after approximately 5,000 lines. This suggests that the TCS framework is particularly well-suited for low-resource scenarios where large-scale parallel CS data is unavailable.
Conclusion
By treating code-switching as a translation task, the TCS model effectively bridges the gap between monolingual resources and code-switched generation. The combination of shared-private architectures and a strategic training curriculum allows for the production of high-quality, linguistically plausible CS text even with limited real-world data. Future research will focus on extending this methodology to other language pairs and exploring more complex linguistic constraints.
Summary updated