Skip to main content

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)

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:
The lang list must be the same length as inp. Use None for audios where you don’t know the language or want no conditioning.

Without Language Conditioning

You can omit language IDs, but quality may degrade:

When to Use Language Conditioning

When transcribing audio where you know the language in advance:
When processing datasets with language labels:
Applications targeting specific languages:

❌ When Not to Use

Language conditioning has no effect on CTC models:
For audio with multiple languages, language conditioning may hurt:
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

  1. Low-resource languages: Conditioning helps the model focus on the right character set and phonology
  2. Script-specific languages: Chinese, Arabic, Hindi benefit significantly
  3. 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:
Code reference: /src/omnilingual_asr/models/inference/pipeline.py:596-609

Training with Language Conditioning

During training, language IDs are automatically included from dataset metadata:
Code reference: /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

When using LLM models and you know the language, always provide it:
Don’t guess - use None if uncertain:
Check against supported languages before use:
Group same-language audio for potentially better batching:

Troubleshooting

Error when using unsupported language ID:
If you accidentally use the wrong language, transcription quality degrades. Always validate:
Fix: