Towards Context-Aware End-to-End Code-Switching Speech Recognition

Zimeng Qiu, Yiyuan Li, Xinjian Li, Florian Metze, William M. Campbell

Introduction

Researchers from Amazon and Carnegie Mellon University have introduced HARD (Hierarchical Attention-based Recurrent Decoder), a novel end-to-end architecture designed to address the complexities of "code-switching"—the linguistic phenomenon where speakers alternate between two or more languages within a single conversation. By implementing a two-level hierarchical LSTM and leveraging multi-task learning for language identification, the HARD model significantly reduces error rates and maintains linguistic context more effectively than standard speech recognition baselines.

The Challenge of Code-Switching in ASR

Code-switching (CS) presents a significant hurdle for Automatic Speech Recognition (ASR) systems. When a speaker transitions between languages, such as Mandarin and English, mid-sentence, standard models often fail to maintain the correct linguistic state.

The popular Listen, Attend and Spell (LAS) framework typically employs a flat decoder that predicts characters based primarily on the immediate preceding character. This limited temporal window leads to two primary issues:

  1. Phonetic Hallucinations: Without long-term context, the model may produce phonetically similar but linguistically incorrect sequences (e.g., "forr tweee" instead of "four three") because it loses track of the current language "mode."
  2. Switching Errors: The model struggles to identify the precise moment of transition between languages, often resulting in nonsensical mixed-language tokens.

The HARD Architecture

To overcome these limitations, the authors developed the Hierarchical Attention-based Recurrent Decoder (HARD). Unlike traditional decoders with a single LSTM layer, HARD utilizes a dual-layer structure to capture both fine-grained and coarse-grained dependencies.

The HARD architecture featuring hierarchical LSTMs and multi-task learning for LID.

Hierarchical Decoding

  • Character LSTM ($LSTM_1$): This layer manages fine-grained, character-by-character generation.
  • Sub-sequence LSTM ($LSTM_2$): Positioned above the character layer, it encodes the history of entire sub-sequences (roughly corresponding to words or phrases). This allows the model to carry historical context across the entire utterance, stabilizing the language mode.

Multi-Task Learning (MTL)

To further refine performance, the model employs Multi-Task Learning (MTL). In addition to predicting the next character, the system is trained to predict a Language Identification (LID) tag for every token. This auxiliary task forces the shared layers to learn the underlying structure of language transitions. The training process utilizes Gumbel-softmax sampling to maintain differentiability while handling categorical character predictions.

Experimental Setup and Datasets

The model was evaluated using the SEAME dataset, a prominent corpus of spontaneous Mandarin-English code-switching speech recorded in Singapore and Malaysia. The dataset consists of approximately 129,000 training utterances, featuring a complex mix of Mandarin characters and English tokens that reflect real-world conversational patterns in Southeast Asia.

Key Results and Insights

The MTL-HARD model (combining the hierarchical decoder with multi-task learning) demonstrated consistent improvements over the baseline LAS model across multiple metrics.

Comparison of error rates (MER and CER) across different model configurations.

As shown in the results table, the HARD + LID configuration achieved the best performance:

  • Character Error Rate (CER): Reduced from 29.91% (LAS) to 26.56%.
  • Mixed Error Rate (MER): Reduced from 38.99% to 34.50%.

Analysis

  • Contextual Stability: The hierarchical layer ($LSTM_2$) allows the model to "remember" the current language phase. If an English phrase begins, the model is significantly more likely to complete it correctly rather than drifting back into Mandarin mid-word.
  • LID as a Guide: Language Identification acts as a compass. By predicting the language tag, the model narrows the search space for the next character, effectively pruning linguistically impossible candidates.
  • Character vs. BPE: Interestingly, the researchers found that pure character-level models outperformed Byte-Pair Encoding (BPE). The imbalance between Mandarin characters and English subwords in code-switching data appears to favor the granularity of a character-based approach over standard subword units.

Conclusion and Future Work

While the HARD architecture represents a significant step forward in context-aware ASR, several avenues for future research remain. The authors suggest that incorporating monolingual pre-training on massive English and Mandarin datasets could improve the recognition of rare words. Additionally, integrating a dedicated code-switching Language Model (LM) for output rescoring could further refine linguistic transitions and address remaining out-of-vocabulary challenges.

Summary updated

BibTeX
@inproceedings{qiu2020towards,
  author = {Zimeng Qiu and Yiyuan Li and Xinjian Li and Florian Metze and William M. Campbell},
  title = {{Towards Context-Aware End-to-End Code-Switching Speech Recognition}},
  booktitle = {Interspeech},
  year = {2020},
  doi = {10.21437/interspeech.2020-1980},
}
Figure