A Semi-supervised Approach to Generate the Code-Mixed Text using Pre-trained Encoder and Transfer Learning

Deepak Gupta, Asif Ekbal, Pushpak BhattacharyyaEMNLP 2020

Introduction

In multilingual societies, code-mixing—the practice of alternating between two or more languages within a single conversation or sentence—is a ubiquitous phenomenon, particularly in informal digital communication. Despite its prevalence, Natural Language Processing (NLP) systems often struggle with code-mixed text due to a severe "data drought." Most state-of-the-art models are trained on monolingual corpora, leading to significant performance degradation when encountering blended languages like "Hinglish" (Hindi-English) or "Spanglish" (Spanish-English). Manually annotating code-mixed data is prohibitively expensive and lacks scalability across the vast array of global language pairs.

To address this challenge, researchers from IIT Patna have proposed a semi-supervised framework designed to generate high-quality, fluent code-mixed text from standard monolingual sentences. By leveraging linguistic theories, pre-trained cross-lingual models, and transfer learning from neural machine translation, the approach effectively bridges the gap between monolingual training and multilingual reality.

Methodology

The proposed framework utilizes a multi-stage pipeline that operates without requiring initial labeled code-mixed data.

1. Synthetic Data Generation

The process begins with the creation of a synthetic "starter" dataset based on the Matrix Language Frame (MLF) theory. Using parallel corpora (e.g., English and its Hindi translation), the system identifies specific linguistic units such as Noun Phrases, Adjectives, and Named Entities. These units are then swapped from the source language into the target language's grammatical structure, creating a linguistically grounded foundation for code-mixing that is more natural than random word replacement.

2. Feature-Rich Encoder and Gated Fusion

The core architecture employs a Bi-LSTM encoder enhanced by two critical information streams:

  • Linguistic Features: Explicit tags for Part-of-Speech (PoS) and Named Entity Recognition (NER) provide structural context.
  • Pre-trained XLM Features: The model integrates representations from a Cross-lingual Language Model (XLM) to capture deep inter-language relationships.
The architecture of the proposed Code-Mixed Sentence Generation Model, highlighting the Gated Feature Fusion (GFF) and XLM integration.

A Gated Feature Fusion (GFF) module dynamically weighs the contributions of the LSTM-based features and the pre-trained XLM features at each time step, ensuring the model utilizes the most relevant information for generating fluent text.

3. Transfer Learning and Decoding

A key innovation is the use of a Transfer Learning "Warm Start." The generator is initialized with weights from a pre-trained Neural Machine Translation (NMT) model. Since NMT models already understand the mapping between language pairs, this initialization provides a significant head start in fluency. Finally, a Pointer-Generator Decoder is used to allow the model to accurately copy technical terms or names directly from the source text.

Experimental Setup

The model was evaluated across eight diverse language pairs, including five Indic pairs (en-hi, en-bn, en-ml, en-ta, en-te) and three European pairs (en-fr, en-de, en-es). Data was sourced from the Europarl corpus for European languages and the WAT multilingual parallel corpus for Indic languages.

Results and Analysis

The proposed model consistently outperformed standard baselines, including Seq2Seq and basic Pointer-Generator models, across BLEU (B), ROUGE (R), and METEOR (M) metrics.

Performance comparison and ablation study results for European and Hindi language pairs.

Ablation Study

Ablation experiments highlighted the relative importance of each component. As shown in the results table, removing Transfer Learning resulted in the most substantial performance drop (up to 2.25 BLEU points), confirming that the NMT-based initialization is vital for capturing the nuances of code-mixing. The removal of GFF and XLM features also led to noticeable declines in performance, validating the multi-feature fusion approach.

Human Evaluation

Human judges rated the model's output on a scale of 1 to 5 for naturalness. The proposed model achieved a score of 3.26, a significant improvement over the Pointer-Generator baseline (2.34). While it still trails the "gold standard" synthetic data (4.19), the results demonstrate a marked step forward in generating human-like code-mixed text.

Conclusion

This research presents a robust semi-supervised framework for generating code-mixed text, effectively mitigating the data scarcity problem. By combining linguistic theory with advanced transfer learning techniques, the model achieves high fluency across diverse language families. Future work will explore fully unsupervised approaches to further reduce reliance on parallel corpora, potentially extending these benefits to even lower-resource languages.

Summary updated

BibTeX
@inproceedings{gupta2020semi,
  author = {Deepak Gupta and Asif Ekbal and Pushpak Bhattacharyya},
  title = {{A Semi-supervised Approach to Generate the Code-Mixed Text using Pre-trained Encoder and Transfer Learning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.findings-emnlp.206},
}
Figure