Overview
Language conditioning allows LLM-based ASR models (wav2vec2_llama) to leverage language information during decoding, improving transcription accuracy. CTC models ignore language conditioning as they perform direct frame-level classification.
Language conditioning is only supported by LLM-based models (
omniASR_LLM_*). CTC models (omniASR_CTC_*) ignore the language parameter.Supported Languages
Omnilingual ASR supports 1,682 languages with their script variants. The complete list is defined in/src/omnilingual_asr/models/wav2vec2_llama/lang_ids.py:9-1682.
Language ID Format
Language IDs use the format:{language_code}_{script}
Examples:
eng_Latn- English (Latin script)arb_Arab- Modern Standard Arabic (Arabic script)cmn_Hans- Mandarin Chinese (Simplified)cmn_Hant- Mandarin Chinese (Traditional)uzb_Cyrl- Uzbek (Cyrillic script)uzb_Latn- Uzbek (Latin script)
Common Language IDs
Common Language IDs
Using Language Conditioning
Inference with Language IDs
Pass language IDs to the inference pipeline for better transcription:Mixed Language Batches
You can process different languages in the same batch:Without Language Conditioning
You can omit language IDs, but quality may degrade:When to Use Language Conditioning
✅ Recommended Use Cases
Known Language Corpus
Known Language Corpus
When transcribing audio where you know the language in advance:
Multilingual Datasets with Metadata
Multilingual Datasets with Metadata
When processing datasets with language labels:
Language-Specific Applications
Language-Specific Applications
Applications targeting specific languages:
❌ When Not to Use
CTC Models
CTC Models
Language conditioning has no effect on CTC models:
Code-Switching Audio
Code-Switching Audio
For audio with multiple languages, language conditioning may hurt:
Uncertain Language Labels
Uncertain Language Labels
If language labels are unreliable, avoid conditioning:
Performance Impact
Quality Improvements
Language conditioning typically provides:- 2-5% WER reduction on matched languages
- Better handling of rare words in that language
- Improved punctuation and capitalization (language-specific)
- Reduced hallucinations from incorrect language assumptions
When Quality Improves Most
- Low-resource languages: Conditioning helps the model focus on the right character set and phonology
- Script-specific languages: Chinese, Arabic, Hindi benefit significantly
- Ambiguous audio: Poor quality or accented speech
Language conditioning has minimal impact on high-quality English audio but can significantly improve low-resource language transcription.
Implementation Details
How Language Conditioning Works
For LLM models, the language ID is converted to a special token and prepended to the decoder:/src/omnilingual_asr/models/inference/pipeline.py:596-609
Training with Language Conditioning
During training, language IDs are automatically included from dataset metadata:/src/omnilingual_asr/datasets/storage/mixture_parquet_storage.py:54-59
Language Detection Integration
Integrate external language detection for unknown audio:Checking Supported Languages
Verify if a language is supported:Best Practices
Always Provide Language for LLM Models
Always Provide Language for LLM Models
When using LLM models and you know the language, always provide it:
Use None for Unknown Languages
Use None for Unknown Languages
Don’t guess - use
None if uncertain:Validate Language IDs
Validate Language IDs
Check against supported languages before use:
Batch by Language When Possible
Batch by Language When Possible
Group same-language audio for potentially better batching:
Troubleshooting
Language ID not in supported list
Language ID not in supported list
Error when using unsupported language ID:
Wrong language conditioning
Wrong language conditioning
If you accidentally use the wrong language, transcription quality degrades. Always validate:
Length mismatch error
Length mismatch error