Voice assistants in India rarely operate in a single, clean language. A user may ask, “Kal ka weather kya hai?” switch to English for a technical term, and then return to Hindi in the same sentence. This behaviour—called code switching—is central to building useful speech interfaces for multilingual users. Code switching voice assistants must recognise mixed-language speech, infer intent across language boundaries, generate an appropriate response, and do so reliably on mobile networks and low-cost devices.
For AI product teams, code switching is not merely a translation problem. It affects automatic speech recognition (ASR), natural-language understanding (NLU), dialogue management, text-to-speech (TTS), safety, evaluation, and user trust. This guide explains the architecture, data requirements, technical trade-offs, and India-specific deployment considerations.
What is code switching in voice assistants?
Code switching is the use of two or more languages or language varieties within a conversation, sentence, or phrase. In India, common examples include:
- Hinglish: “Mujhe nearest pharmacy ka route batao.”
- Tanglish: Tamil grammar with English words such as “meeting” or “appointment”.
- Kanglish: Kannada and English mixed in a single request.
- Telugu-English or Marathi-English: Regional-language syntax combined with English nouns, brand names, and technical terms.
Code mixing often happens because speakers choose the word that is most familiar, precise, socially appropriate, or easy to pronounce. Product names, internet terminology, medical vocabulary, and workplace language are especially likely to remain in English.
A monolingual ASR system may transcribe these utterances incorrectly, while a language-identification system that assigns one language to the entire audio stream may fail to detect rapid switches. The assistant therefore needs language identification at the utterance, segment, or token level, depending on the application.
Why code switching voice assistants are difficult to build
Mixed-language ASR errors
Traditional ASR pipelines often assume that the language is known before decoding. A Hindi model may map English words to phonetically similar Hindi words, while an English model may mishandle Indian-language pronunciation and grammar. Code-switched speech creates additional problems:
- English words pronounced with regional phonology
- Indian-language words spoken with English prosody
- Proper nouns, acronyms, and brand names
- Multiple scripts represented in one transcript
- Informal contractions and colloquial vocabulary
- Background noise, reverberation, and low-quality microphones
The system must jointly estimate the acoustic signal, language identity, words, and punctuation. Word-level language tags can improve downstream routing, but they also increase annotation and modelling complexity.
NLU must work across language boundaries
Even a perfect transcript does not guarantee correct intent detection. Consider “UPI se electricity bill pay karna hai.” The key intent is bill payment, but the language structure is mixed. An NLU model should identify the action, payment method, and bill category without requiring the user to restate the request in one language.
For production systems, intent classification and slot filling should be evaluated separately. A model may recognise the intent but extract the wrong merchant, date, location, or account identifier. Entity normalisation is particularly important for names and addresses, which may be spoken in a regional language but stored in English or a transliterated form.
Response language is a product decision
The assistant must decide how to respond. Options include:
- Mirror the user’s dominant language
- Respond in the language selected in settings
- Use a stable bilingual style
- Ask a clarification question when confidence is low
- Provide a short spoken response and a multilingual text display
Mirroring every switch can sound unnatural or cause TTS instability. In many applications, a better policy is to preserve the user’s preferred language while retaining widely understood terms such as product names or technical labels.
Reference architecture for a code switching voice assistant
A robust system commonly contains the following stages:
1. Audio capture and voice activity detection: Detect speech while handling interruptions, silence, and background sound.
2. Language identification: Estimate language probabilities globally and at segment or token level.
3. Multilingual ASR: Decode speech using a multilingual or jointly trained code-switching model.
4. Text normalisation: Standardise numbers, dates, abbreviations, currencies, and transliterated words.
5. NLU: Perform intent classification, entity extraction, sentiment or urgency detection, and policy checks.
6. Dialogue manager: Track context, resolve references, manage confirmations, and select the response language.
7. Response generation: Produce controlled text, templates, or retrieval-grounded answers.
8. Multilingual TTS: Render the response with suitable pronunciation, voice, prosody, and language switching.
9. Observability: Log latency, confidence, fallback events, language distribution, and user corrections.
A practical design should expose confidence scores at each stage. If ASR confidence is low but intent confidence is high, the assistant may confirm the critical entity rather than repeat the entire request. For payments, healthcare, and identity workflows, confirmation thresholds should be stricter than for general information queries.
Training data: the most important investment
Code switching performance is usually limited by data quality rather than model size. Teams should build a dataset that reflects real conversations, not artificially concatenated sentences alone.
Useful data categories include:
- Natural code-switched speech from target regions
- Multiple age groups, genders, accents, and speaking styles
- Urban, rural, and semi-urban environments
- Smartphone microphones, call audio, and smart speakers
- Domain terms such as banking, agriculture, education, healthcare, and commerce
- Proper nouns, local place names, and Indian English pronunciation
- Disfluencies, repetitions, interruptions, and incomplete requests
- Consent-based recordings with clear annotation policies
Annotations may include transcript text, language tags, speaker turns, named entities, intent, slots, confidence, and acoustic conditions. For token-level language labels, define rules for borrowed words and ambiguous terms before annotation begins. A word that is historically English but commonly integrated into Hindi may not need to be treated as a meaningful language switch in every application.
Synthetic augmentation can help with coverage. Teams can vary code-switch points, acoustic noise, speaking rate, and pronunciation. However, synthetic data should supplement—not replace—naturally occurring speech. Artificially generated switching patterns may be grammatically improbable and can produce misleading benchmark results.
For India-focused products, partnerships with linguists, community organisations, universities, and responsible data-collection vendors can improve representation. Consent, compensation, anonymisation, and deletion workflows should be documented from the beginning.
Modelling approaches
Multilingual foundation models
Large multilingual speech models can provide strong zero-shot or few-shot performance across languages. They reduce the need to maintain one completely separate ASR system per language, but may still underperform on low-resource Indian languages, local accents, and domain vocabulary. Fine-tuning with representative code-switched audio is often necessary.
Language-specific experts with routing
An alternative is a mixture-of-experts architecture. A lightweight language-identification module routes segments to specialist ASR or NLU models. This can improve accuracy for well-supported languages, but rapid switching and routing errors can create boundary artefacts. It also increases operational complexity.
Shared encoder, language-aware decoder
A shared acoustic encoder with language-conditioned decoding can balance parameter efficiency and specialisation. The decoder may receive language embeddings, speaker context, domain vocabulary, or a code-switching constraint. This approach is useful when a company supports several Indian languages but has limited infrastructure.
Transliteration-aware NLU
Users may speak a regional language while the system represents it in Latin script. NLU should be robust to transliteration variation—for example, different spellings of the same Hindi or Tamil word in Roman script. Character-level, subword, phonetic, and byte-level representations can reduce sensitivity to spelling variation. Normalisation should preserve the original transcript for auditability while creating a canonical form for intent processing.
Evaluation metrics that matter
Word Error Rate (WER) alone is insufficient. A system can produce a transcript with a modest WER but still fail on the one entity that determines the action.
Track at least:
- WER and Character Error Rate: Overall transcription quality
- Language Identification Accuracy: Segment-level and token-level performance
- Code-switch boundary F1: Accuracy of detected switching points
- Intent accuracy or macro-F1: Performance across balanced intent classes
- Slot F1: Correct extraction of dates, names, amounts, and locations
- Entity-critical error rate: Failures on high-risk fields
- Task completion rate: Whether users successfully complete the workflow
- False confirmation rate: Incorrectly confirming an interpreted request
- End-to-end latency: Capture-to-response time under real network conditions
- Fallback and repetition rate: How often users must repeat themselves
Benchmarks should be stratified by language pair, code-switch density, accent, noise level, device, and network. Report confidence intervals and test on a held-out speaker set to avoid speaker memorisation. Human evaluation remains valuable for naturalness, politeness, pronunciation, and whether the response language feels appropriate.
Designing the dialogue experience
Good code switching support is not only a model feature; it is a dialogue design problem.
Let users speak naturally
Avoid forcing users to select a language before every interaction. Persistent preferences are useful, but the system should still adapt when the user changes language. A simple phrase such as “Aap Hindi mein baat kar sakte hain” can make capability clear without adding friction.
Confirm only what is risky
For low-risk requests, silent correction may be acceptable. For financial transfers, medicine names, addresses, or government-service forms, confirm the critical fields in the user’s preferred language. Keep confirmations concise and use both spoken and visual channels where possible.
Handle uncertainty transparently
Instead of inventing an answer, say that the assistant did not understand a specific word and ask the user to repeat it. Provide alternatives when possible: “Did you mean Bengaluru or Belagavi?” This is safer than silently normalising an uncertain place name.
Support interruption and repair
Indian conversational speech often includes mid-sentence corrections. The assistant should support barge-in, revise hypotheses, and preserve context. If the user says, “No, not tomorrow—Saturday,” the dialogue manager must update the date rather than create a new unrelated request.
India-specific deployment considerations
India’s language diversity makes regional coverage a strategic and technical issue. Prioritise languages based on user demand, task value, available data, and the consequences of failure—not simply population size. A phased launch can begin with one or two high-value language pairs, followed by carefully measured expansion.
Latency and cost also matter. Many users rely on mobile networks with variable bandwidth. Consider streaming ASR, on-device voice activity detection, quantised models, edge inference for sensitive steps, and graceful degradation when connectivity is poor. Cache static prompts and use short response templates for routine tasks.
Privacy is critical when voice data may include biometric characteristics, financial information, health details, or personal identifiers. Apply data minimisation, encryption in transit and at rest, access controls, retention limits, and explicit consent. Align operations with India’s Digital Personal Data Protection Act, 2023, contractual requirements, sectoral rules, and applicable platform policies. Do not retain raw audio by default when derived features or redacted transcripts are sufficient.
Accessibility should be part of the design. Consider users with speech impairments, hearing loss, low literacy, older devices, and limited digital experience. Offer text alternatives, adjustable playback speed, keypad fallbacks, and human escalation for high-impact services.
Common failure modes and fixes
- Failure: Treating code switching as translation. Translation after monolingual ASR cannot recover words that were misrecognised. Fix: Train or adapt ASR on mixed-language speech.
- Failure: Evaluating only clean studio audio. Real users speak in traffic, kitchens, shops, and shared spaces. Fix: Build noise- and device-stratified test sets.
- Failure: Ignoring transliteration. Latin-script input varies dramatically. Fix: Use phonetic and subword normalisation with language-aware lexicons.
- Failure: Optimising WER while missing entities. A small number error can trigger a wrong payment or destination. Fix: Track entity-critical errors and require confirmation.
- Failure: Using one voice for every language without adaptation. Pronunciation and prosody can reduce trust. Fix: Validate TTS with native speakers and domain experts.
- Failure: Overusing automatic language mirroring. Frequent switches can make responses confusing. Fix: Combine detected language with user preference, context, and confidence.
- Failure: Collecting data without governance. Voice datasets can create privacy and representation risks. Fix: Document consent, annotation, retention, access, and deletion procedures.
A practical roadmap for startups
1. Define the top tasks and language pairs using real user research.
2. Establish a taxonomy for intents, entities, language tags, and failure severity.
3. Launch a data pilot with consented, diverse, naturally occurring speech.
4. Benchmark an off-the-shelf multilingual model before custom training.
5. Add domain lexicons, transliteration handling, and entity confirmation.
6. Test the complete pipeline—not ASR in isolation—with real devices and networks.
7. Release to a limited cohort and monitor correction, abandonment, and escalation rates.
8. Expand languages only after measuring safety, latency, and task completion.
For Indian AI startups, grant funding can support data collection, language technology research, edge optimisation, safety evaluation, and pilots with public-interest use cases. A clear proposal should explain the underserved users, technical novelty, dataset governance, measurable outcomes, and deployment plan.
Frequently asked questions
What is the difference between code switching and code mixing?
The terms overlap. Code switching often refers to changing languages across sentences or conversational segments, while code mixing commonly describes mixing words or phrases within a sentence. In voice AI, both create similar ASR and NLU requirements.
Can one multilingual model support all Indian languages?
A single model may provide broad coverage, but performance will vary by language, accent, domain, and data availability. Fine-tuning, language-specific lexicons, and targeted evaluation are usually needed for reliable production performance.
Should a voice assistant always respond in the same mixed language?
Not necessarily. The best response policy considers the user’s preference, detected language, context, confidence, and task risk. Stable, understandable responses are generally better than mechanically mirroring every switch.
How can startups measure success?
Measure end-to-end task completion, slot accuracy, critical-entity errors, latency, fallback rate, and user satisfaction by language pair and demographic segment. WER should be treated as one diagnostic metric, not the only product KPI.
Apply for AI Grants India
Are you an Indian AI founder building code switching voice assistants or multilingual speech technology? Apply through AI Grants India to explore support for research, responsible datasets, product pilots, and scalable deployment.