Abstract
While recent benchmarks have spurred a lot of new work on improving the generalization of pretrained multilingual language models on multilingual tasks, techniques to improve code-switched natural language understanding tasks have been far less explored. In this work, we propose the use of bilingual intermediate pretraining as a reliable technique to derive large and consistent performance gains on three different NLP tasks using code-switched text. We achieve substantial absolute improvements of 7.87%, 20.15%, and 10.99%, on the mean accuracies and F1 scores over previous state-of-the-art systems for Hindi-English Natural Language Inference (NLI), Question Answering (QA) tasks, and Spanish-English Sentiment Analysis (SA) respectively. We show consistent performance gains on four different code-switched language-pairs (Hindi-English, Spanish-English, Tamil-English and Malayalam-English) for SA. We also present a code-switched masked language modelling (MLM) pretraining technique that consistently benefits SA compared to standard MLM pretraining using real code-switched text.
Introduction
Large-scale multilingual models like mBERT and XLM-R have revolutionized NLP, yet they often struggle with code-switched text—sentences where speakers mix multiple languages (e.g., "Hinglish"). These models are primarily trained on monolingual corpora like Wikipedia, leaving them ill-equipped for the unique grammatical and vocabulary shifts found in code-switching. High-quality labeled code-switched data is notoriously scarce, and previous attempts to bridge this gap via massive "pre-pretraining" on social media data are computationally expensive. This research explores a more data-efficient approach: bilingual intermediate-task training.
Methodology
The proposed approach utilizes a three-stage pipeline:
- Pretrained Model Initialization: Starting with standard multilingual models (mBERT or XLM-R).
- Bilingual Intermediate-Task Training: The model is fine-tuned on a related task (e.g., NLI or QA) using a bilingual dataset. This dataset combines English data with its translated or transliterated counterpart in the target language (e.g., Hindi). Crucially, training on both languages simultaneously helps the model align representations across languages.
- Target Task Fine-tuning: The model is finally fine-tuned on the specific code-switched dataset.
Additionally, the researchers introduced Code-Switched Masked Language Modeling (MLM). Unlike standard MLM, this technique specifically masks words at "switching boundaries"—the points where the language transitions—forcing the model to learn the structural relationships between the two languages.
Results and Analysis
Natural Language Inference and Question Answering
The researchers evaluated their methods on the GLUECoS benchmark for Hindi-English tasks. The results demonstrate that bilingual intermediate training significantly outperforms standard baselines and previous state-of-the-art (SOTA) methods.
As shown in Figure 1, the multi-task bilingual training approach achieved a 20.15% absolute improvement in F1 score for QA and a 7.87% improvement in mean accuracy for NLI compared to previous benchmarks.
Sentiment Analysis
The effectiveness of the approach was further validated across four language pairs for Sentiment Analysis: Spanish-English (ES-EN), Hindi-English (HI-EN), Tamil-English (TA-EN), and Malayalam-English (ML-EN).
Figure 2 highlights that the bilingual multi-task models consistently outperform baselines. Notably, the ES-EN system achieved an F1 of 70.33, a significant gain over the baseline. The research also found that the specialized Code-Switched MLM objective was particularly beneficial for Sentiment Analysis, as it focuses on the informative transition points in social media-style text.
Key Insights
- Simultaneous Training: Training on English and the target language simultaneously is more effective than sequential training, as it better aligns the model's internal representation space.
- Data Efficiency: The best-performing models outperformed previous SOTA systems that used up to 100 times more data, emphasizing that the relevance of the intermediate task is more critical than raw data volume.
- Boundary Sensitivity: Masking words at language switching boundaries provides a strong signal for the model to understand the syntax of code-switching.
Conclusion and Future Work
Bilingual intermediate-task training provides a robust and efficient pathway for improving code-switched NLU. While highly effective, the method's performance is currently bounded by the quality of translation and transliteration tools. Future work will explore task-adaptive pretraining to further close the gap between intermediate tasks and the nuances of real-world code-switched communication.
Summary updated