Introduction
Code-switching—the practice of alternating between two or more languages in a single conversation—is a natural phenomenon in multilingual societies. However, developing language models (LMs) capable of processing code-switched text is challenging due to the scarcity of high-quality, large-scale datasets. Traditional data augmentation methods often rely on rigid linguistic theories, such as the Equivalence Constraint, which fail to capture the diverse and often irregular patterns of real-world speech. Researchers from HKUST propose a novel, language-agnostic approach using a pointer-generator network to learn these switching patterns directly from data.
Methodology: The Pointer-Generator Approach
The core of the proposed method is a Pointer-Generator Network designed to create synthetic code-switching sentences from parallel monolingual data. Unlike standard Sequence-to-Sequence (Seq2Seq) models that generate words solely from a fixed vocabulary, this architecture utilizes a "soft gate" mechanism.
As shown in the figure above, the model takes concatenated parallel sentences (e.g., English and Mandarin) as input. At each decoding step, the gate $p_{gen}$ decides whether to generate a word from the vocabulary or copy a word directly from the input via the attention distribution. This allows the model to implicitly learn alignment, reordering, and switching constraints without hand-crafted rules. To further enhance performance, the authors incorporated syntactic information (Part-of-Speech tags) to help the model navigate complex grammatical transitions during a switch.
Experimental Setup and Datasets
The study utilized the SEAME Phase II corpus, a conversational Mandarin-English speech dataset from bilingual speakers in Singapore and Malaysia. To provide the necessary input for the generator, the researchers used Google NMT to translate the mixed SEAME sentences into pure English and pure Mandarin, creating a parallel monolingual training set.
Key Insights and Results
The Power of N-Best Diversity
A critical finding was that using the "3-best" generated sentences (the top three variations produced by the model) yielded better results than using only the single best sequence. This is because the 3-best results provide greater variance, which more accurately reflects the natural distribution of human speech.
As illustrated in the frequency distribution plots, the 3-best generation (blue dotted line) better approximates the "left-skewed" distribution of the original code-switching data (black line) compared to the 1-best generation (green dotted line). This diversity is essential for training robust language models.
Performance Gains
- Generation Quality: The pointer-generator outperformed a standard Seq2Seq model with attention by 3.58 BLEU points, indicating significantly higher accuracy in generating code-switched text.
- Perplexity Improvement: When the generated data was used to augment an LSTM language model, it achieved a 10% improvement in perplexity over the baseline.
- Surpassing Linguistic Theory: The data-driven approach outperformed traditional "equivalence constraint" methods by 5%, suggesting that neural networks are superior at capturing the nuances of code-switching than rigid linguistic rules.
- Mitigating OOV Issues: The copy mechanism effectively addressed the "Out-of-Vocabulary" (OOV) problem by allowing the model to pull words directly from the source text.
Conclusion
By leveraging a pointer-generator network to "copy and paste" between languages, this research provides a powerful, language-agnostic tool for data augmentation in low-resource code-switching scenarios. Future work may explore Reinforcement Learning to further refine the grammatical naturalness of generated sequences and investigate the impact of even larger volumes of parallel monolingual data.
Summary updated