Research
Code-switching breaks speech recognition. Here is how to fix it
Bilingual speakers mix languages mid-sentence constantly. Why monolingual ASR fails on it, and how to specify and collect code-switched training data.
Key takeaways
- Code-switching is normal bilingual speech, not an edge case. In urban Pakistan, Urdu-English mixing is the default register.
- Monolingual ASR handles it badly: the language-ID layer flips mid-utterance, or foreign words are forced into the wrong phoneme inventory.
- It must be a specified quota parameter — a target switch rate — not something you hope appears naturally.
- Transcription needs a documented tagging convention so switch points remain recoverable for training.
What code-switching actually is
Code-switching is alternating between two or more languages within a single conversation, often within a single sentence. “Meeting kal reschedule ho gayi hai, but I'll send the update” is entirely ordinary speech for a bilingual professional in Karachi or Lahore.
It is not error, laziness or incomplete language acquisition. It is a systematic, rule-governed register used by the majority of bilingual speakers worldwide — and any model deployed to them will encounter it constantly.
Why monolingual ASR fails
Three failure modes recur. The language-identification layer flips mid-utterance and the decoder switches acoustic models mid-word, producing garbage at the boundary. Or the model forces English words through the phoneme inventory and language model of the matrix language, producing confident nonsense. Or the language model, trained on monolingual text, assigns near-zero probability to the mixed sequence and the decoder discards the correct hypothesis.
The result is that accuracy degrades most on exactly the utterances that are most natural for your users.
Specify a switch rate, do not hope for one
The critical move is treating code-switching as a quota parameter. Set an explicit target: for example, 30–40% of collected utterances should contain at least one content word from the embedded language, with switches distributed across the utterance rather than clustered at boundaries.
Then design prompts and recruitment to hit it. Left to chance, collection under-represents switching, because contributors in a recording context tend to shift toward a more formal, more monolingual register than they use naturally.
Transcription conventions matter
Code-switched audio is only useful if the transcript preserves the switch points recoverably. That requires a documented convention agreed before collection begins: which script each language is rendered in, whether embedded words are transliterated or kept in their native script, and how language tags are marked.
Consistency matters far more than which convention you choose. An inconsistently tagged code-switched corpus is close to useless for training, and inconsistency is what you get by default when the convention is not written down and enforced in QA.
Elicitation without artificiality
The practical difficulty is that people code-switch less when they know they are being recorded. Reading prompts aloud produces almost none of it.
What works: two-party conversation between people who habitually switch with each other, topics drawn from domains where the embedded language dominates the vocabulary — technology, workplace, medicine, finance — and long enough sessions that participants relax past their initial formality. Role-play scenarios grounded in real tasks also work well.
Related pages on this site
Answers
Frequently asked questions
Alternating between two or more languages within a single utterance or conversation — for example mixing Urdu and English mid-sentence. It is standard bilingual speech, and ASR models trained on monolingual data typically degrade sharply on it.
Set an explicit target switch rate as a quota parameter, recruit speakers who habitually switch with one another, use spontaneous two-party conversation rather than read prompts, choose topics where the embedded language naturally dominates, and agree a documented transcription convention before collection starts.
Better than monolingual ones, but not reliably. Multilingual pretraining helps with the acoustic side; the language model and decoding path still tend to assume a single language per utterance. Explicit code-switched training data remains the reliable fix.
Voice agent failing on mixed-language speech?
It is almost certainly a training data gap rather than a model limitation. We collect code-switched data across Asian languages. Let us scope what closes it.
Average first response: under 6 business hours. NDAs signed same day.