Introduction
Code-switching—the practice of alternating between two or more languages in a single conversation—is a linguistic norm for millions of bilingual speakers on social media. However, developing sentiment analysis tools for languages like Hinglish (Hindi-English) or Spanglish (Spanish-English) is hindered by a severe lack of annotated data. While supervised learning requires thousands of expensive human-labeled examples, this research proposes an unsupervised framework that learns to understand code-switched sentiment entirely on its own.
Methodology: The Self-Training Loop
The researchers developed an Unsupervised Self-Training Algorithm that iteratively improves a model's understanding of code-switched text without manual labels. The process begins with a "TweetEval" model (RoBERTa-base) pre-trained on 60 million English tweets and follows a structured iterative cycle.
The Iterative Process
- Initialization: The English model makes initial "zero-shot" predictions on the unlabeled code-switched dataset.
- Selection: The algorithm selects the $N$ most confident predictions (based on softmax scores) to serve as "pseudo-labels."
- Fine-Tuning: The model is fine-tuned for one epoch on these pseudo-labels.
- Iteration: The model predicts labels for the remaining data, selects the next most confident batch, and repeats until the entire dataset is processed.
Two selection strategies were compared: Vanilla Selection (equal positive/negative samples) and Ratio Selection (estimating the underlying class distribution from a tiny 50-sentence sample to guide pseudo-label selection).
Experimental Results
The framework was tested on four distinct code-mixed datasets: Hinglish, Spanglish, Tanglish (Tamil-English), and Malayalam-English. The results show that the unsupervised model performs remarkably well, often coming within 1–7% of fully supervised baselines.
| Language | Unsupervised F1 (Best) | Supervised F1 | Gap |
|---|---|---|---|
| Hinglish | 0.84 | 0.91 | 7% |
| Spanglish | 0.77 | 0.78 | 1% |
| Tanglish | 0.79 | 0.83 | 4% |
| Malayalam | 0.83 | 0.90 | 7% |
Key Insights
- Handling Imbalance: Real-world data is often imbalanced. The "Ratio Selection" strategy was vital for the highly imbalanced Dravidian datasets (Tanglish and Malayalam), boosting F1 scores by over 10% compared to the vanilla approach.
- Emergent Understanding: By analyzing "Hindi Token Ratios," the authors found that while the initial English model struggled with high-Hindi-content sentences, the self-training process allowed it to "learn" the sentiment of Hindi words by seeing them co-occur with English sentiment markers.
- Domain Alignment: The initial English model performed better on Hinglish and Spanglish (Twitter data) than on Tanglish and Malayalam (YouTube comments), suggesting that platform style is a critical factor in zero-shot transfer.
Limitations and Future Work
While successful, the current study is limited to binary classification (positive vs. negative) and Latin scripts. Future work could expand this to multi-class sentiment analysis (including neutral), handle mixed-script data (e.g., Devanagari and Latin), and incorporate active learning to improve the selection of pseudo-labels by querying humans for the most uncertain samples.
Summary updated