Abstract
Code-switching—the fluid alternation between languages in a single discourse—presents a significant challenge for modern Text-to-Speech (TTS) and Automatic Speech Recognition (ASR) systems due to the scarcity of high-quality bilingual data. This paper introduces CS-LLM, a framework that leverages Large Language Models (LLMs) to perform high-fidelity code-switched speech tasks using only monolingual data. By employing a novel "Stitch-and-Switch" strategy, we construct synthetic code-switched training data from separate monolingual corpora. Our results demonstrate that CS-LLM significantly outperforms existing baselines in naturalness and speaker consistency, achieving a Mean Opinion Score (MOS) of 4.05 while maintaining high accuracy across both English and Mandarin.
Introduction
In our increasingly globalized world, code-switching is a ubiquitous linguistic phenomenon. However, developing speech systems capable of handling these transitions remains difficult. The primary obstacles include the extreme scarcity of natural code-switched audio data, the technical difficulty of maintaining consistent prosody and speaker identity across language boundaries, and the architectural complexity of traditional bilingual models.
Current state-of-the-art solutions often rely on complex adversarial training or separate encoders for different languages. CS-LLM addresses these issues by treating speech as a discrete sequence of tokens, allowing a pre-trained LLM to bridge language gaps using its inherent multilingual text knowledge.
Methodology
The CS-LLM architecture is built upon the LLaMA 3 8B backbone, adapted for speech processing through several key components.
Discrete Speech Representation
Rather than processing raw waveforms, CS-LLM utilizes a multilingual speech tokenizer. Based on an adapted HuBERT model, this tokenizer converts audio into discrete units. This transformation allows the LLM to treat speech generation and recognition as a standard sequence-to-sequence task, similar to text translation or completion.
The "Stitch-and-Switch" Strategy
The core innovation of this work is the data construction pipeline. To circumvent the lack of real-world code-switched data, we propose a method to synthesize it from monolingual English (LibriSpeech) and Mandarin (AISHELL-2) datasets.
As illustrated in Figure 4, the process involves:
- Alignment and Segmentation: Monolingual audio is force-aligned with its transcript to identify precise word boundaries.
- Sampling and Concatenation: Words from different languages and speakers are randomly selected and concatenated. We explored various structures, including Dual-link (switching once) and Triple-link (switching twice), to simulate diverse linguistic patterns.
System Architecture
The model utilizes Low-Rank Adaptation (LoRA) for efficient fine-tuning of the frozen LLaMA 3 weights. The output units from the LLM are processed by a de-tokenizer consisting of a speaker extractor, a duration predictor, and a neural vocoder to reconstruct high-fidelity audio.
Experimental Results
We evaluated CS-LLM on the ASCEND dataset, a spontaneous Chinese-English code-switching corpus, and the TIMIT dataset for speaker similarity.
Performance Metrics
CS-LLM achieved a Mean Opinion Score (MOS) of 4.05, a substantial improvement over VALL-E X (2.90) and SpeechGPT. In terms of transcription accuracy, the model reached a Word Error Rate (WER) of 9.11% for English and 7.89% for Mandarin.
Key Insights
- LLM Generalization: Pre-trained LLMs possess a latent ability to handle multilingual transitions. By providing a speech "vocabulary," the model generalizes code-switching patterns even from artificially stitched training data.
- Speaker Consistency: The model maintains high Speaker Cosine Similarity (SCS) scores (~0.84 for EN, ~0.91 for ZH), ensuring the voice identity remains stable during language transitions.
- Cross-Task Improvement: Interestingly, the inclusion of constructed code-switched data improved performance on standard monolingual ASR and TTS tasks, suggesting a synergistic effect between languages.
Conclusion
CS-LLM demonstrates that high-quality code-switched speech synthesis and recognition can be achieved without expensive, naturally occurring bilingual data. By leveraging the power of LLMs and a simple yet effective data construction strategy, we provide a scalable path forward for multilingual speech technology. Future work will focus on expanding the language pairs supported and further refining the prosodic flow at language boundaries.
Summary updated