Bhasha: word-level language ID for code-mixed Indian-language text
Newer version: Bhasha v2 — much better on spoken Tamil (CoLI Tamil .72 → .94) and better on every other independent test set except native-script and romanised single-language sentences, which stay within 0.005.
📖 Write-up: My Model Thought Tamil Was Telugu (Towards AI) · Summary and FAQ · By Arun Prabhakaran · @LatentAILabs
Bhasha (bhasha-lid-indic) tags every word of a message with its language: Hindi, Bengali, Tamil, Telugu,
Marathi, Gujarati, Kannada, Malayalam, Punjabi, Urdu, Odia or English, plus name and other. It is built for the
way people actually type: Tamil, Hindi or Kannada in Roman letters ("padam semma mass"), mixed with English in the
same sentence, and native script too. It is a 278M-parameter XLM-RoBERTa-base token classifier, Apache-2.0.
I found no licensed, released word-level model for romanised Tamil, Malayalam or Kannada mixed with English. Two unlicensed checkpoints exist (a 2022 shared-task Kannada–English DistilBERT and a Malayalam–English XLM-R with no card), and MIT models such as MixLID cover these languages only in native script. On real YouTube comments the released Hinglish and Indic word-level models (muril-hinglish-lid, hing-bert-lid, IndicTriMix) score .28–.44; Bhasha scores .84–.95 on Malayalam and Kannada.
Results
Word-level macro-F1 over {Indic language, English}. name, other and mixed words (an English stem with an Indic
ending) are left out of scoring. Every set was scored once with the frozen model; none of them was used for training.
Human-labelled sets (labels written by people; CoLI by native speakers; roman-script YouTube comments unless noted):
| Set | Bhasha | Bhasha, expected language given | GlotLID v3 per word + English lexicon |
|---|---|---|---|
| CoLI-Dravidian 2024, Kannada + English | .903 | .936 | .586 |
| CoLI-Dravidian 2024, Malayalam + English | .911 | .922 | .680 |
| CoLI-Dravidian 2024, Tamil + English | .723 | .754 | .561 |
| CoLI-Kanglish (ICON 2022), Kannada + English | .840 | .869 | .494 |
| WoLLaI, Malayalam + English (cleaner text, full sentences) | .952 | .968 | .931 |
| COMI-LINGUA, Hindi + English | .896 | – | .857 (muril-hinglish-lid) |
Released models on the same sets (scored once, same scoring; Bhasha without / with langs):
| Set | Bhasha | distilka (Kanglish 2022 winner) | Malayalam–English XLM-R (Anjana2002) | MixLID (native-script only) |
|---|---|---|---|---|
| CoLI Kannada | .903 / .936 | .954 | – | .491 |
| CoLI Malayalam | .911 / .922 | – | .682 | .447 |
| CoLI Tamil | .723 / .754 | – | – | .437 |
| WoLLaI Malayalam | .952 / .968 | – | .952 | .469 |
| Our 425 real comments (ta / ml / kn) | .873 / .888 / .888 | kn .724 | ml .638 | .786 / .704 / .654 |
| Native-script sentences, 11 languages | .9956 | – | – | .9916 |
distilka beats Bhasha on CoLI Kannada, from the same shared-task series as its training data; on independent Kannada comments Bhasha leads (.888 vs .724). distilka and the Malayalam model state no licence. MixLID was run as its own helper code runs it (plain Transformers, no remote code); each word takes its first sub-token's label.
The CoLI files have one word per row and no sentence boundaries, so they were scored in contiguous 12-word windows; scores on whole messages are likely a little higher.
Our own real set: 425 CC-BY YouTube comments from DravidianCodeMix (150 Tamil, 150 Malayalam, 125 Kannada), labelled word by word by two Claude passes and Gemini, 2-of-3 vote. These labels are LLM-reviewed, not human-verified.
| Pair | Bhasha | GlotLID per word + lexicon | GlotLID on the sentence + lexicon | Best released Hinglish/Indic word-level model |
|---|---|---|---|---|
| Tamil + English | .873 | .778 | .812 | .443 (muril-hinglish-lid) |
| Malayalam + English | .888 | .746 | .832 | .430 |
| Kannada + English | .888 | .640 | .783 | .432 |
Before scoring we set ourselves a bar for each pair: the better of GlotLID-per-word + 0.10 and GlotLID-on-sentence. Malayalam and Kannada clear it; Tamil misses it by .005 (.873 vs .878). This bar is ours, not an external benchmark.
Other checks
| Check | Bhasha | Comparison |
|---|---|---|
| Main language of each message (425 real comments) | .706 macro-F1 | GlotLID v3 .528, IndicLID-FTR .231 |
| Native script, 11 languages, sentence level (Bhasha-Abhijnaanam) | .9956 | GlotLID v3 .9958 |
| Romanised sentences, 11 languages (Bhasha-Abhijnaanam) | .907 | GlotLID v3 .994 (may have seen this data) |
| LinCE Hindi + English (dev) | .922 | muril-hinglish-lid .952 (trained on real Hinglish). LinCE was a development check during training, so it is not independent |
| IndicTriMix English + Hindi + Bengali | .968 | – |
| IndicTriMix English + Hindi + Gujarati | .678 | Hindi words inside Gujarati mixing are weak |
Known weaknesses
- Spoken Tamil. Training Tamil is news Tamil, converted to Roman letters, and spoken Tamil uses different words.
On human-labelled Tamil comments, about a third of Tamil words are tagged Telugu. Giving the expected
language (
langs=["ta"]) stops the Telugu errors, but many of those words then come out as English. A v2 trained on real chat text is planned. - Telugu pull. Other South Indian words drift to Telugu too (5–9% of Malayalam and Kannada words). If you know the
language pair, pass
langs. - No real code-mixed test for Telugu, Marathi, Punjabi, Urdu or Odia: only native-script and romanised single-language sentences were tested for these. Bengali and Gujarati were tested in code-mixed text only alongside Hindi and English (IndicTriMix: .968 and .678).
- English words inside Hindi sentences are sometimes tagged Hindi ("call", "meeting" in a long Hinglish sentence); English F1 on COMI-LINGUA is .836 against .956 for Hindi.
- Names are weak (name F1 .23–.56). Treat
nameas a hint. - Hindi vs Urdu in Roman letters often cannot be told apart; the wrapper returns
hi/urwhen it is unsure. - Short messages (one or two words) carry little context; single-word accuracy is much lower than in a sentence.
Use
# pip install transformers torch huggingface_hub
import os, sys
from huggingface_hub import hf_hub_download
sys.path.insert(0, os.path.dirname(hf_hub_download("LatentAILabs/bhasha-lid-indic", "lid_wrapper.py")))
from lid_wrapper import LID
lid = LID("LatentAILabs/bhasha-lid-indic")
lid("ನಾಳೆ meeting ಇದೆ")
# {"words": [("ನಾಳೆ", "kn"), ("meeting", "en"), ("ಇದೆ", "kn")], "main": "kn", "script": "mixed", "mixed": True, ...}
lid("bro naan nalaiku office varala", langs=["ta"]) # Tamil + English: pass langs (see Known weaknesses)
# {"words": [("bro", "en"), ("naan", "ta"), ("nalaiku", "ta"), ("office", "en"), ("varala", "ta")], "main": "ta", ...}
lid.tag(["kal", "meeting", "hai"]) # list of words -> list of labels
Labels: hi bn ta te mr gu kn ml pa ur or en name other, plus hi/ur from the wrapper. The raw model is a standard
XLMRobertaForTokenClassification; label the first sub-token of each word.
Training data
Training rows were built by code from public text: no hand labels and no LLM-written text.
- Native sentences from IndicCorp v2 (CC0) for the 11 languages and English.
- Romanised spellings from Aksharantar (CC-BY 4.0), the IndicXlit transliteration model (MIT) and simple rules, weighted by how often each spelling appears in romanised web text (FineWeb-2, ODC-By; word counts only).
- Names from Wikidata (CC0).
- 1.65M rows: romanised, mixed with English spans, native, native mixed, mixed script and English, plus chat-style noise ("nhi", "superrr", emoji, @mentions). Rows overlapping any evaluation set were removed.
- XLM-RoBERTa-base, 1 epoch, lr 3e-5, batch 64, one L4 GPU (about an hour).
Evaluation data credits
CoLI-Dravidian 2024 (FIRE 2024 shared task) and CoLI-Kanglish (ICON 2022) were used for evaluation only and are not redistributed. WoLLaI Mal-Eng (Pondicherry University, CC BY 4.0, DOI 10.17632/tzrcrrwz4n.1). COMI-LINGUA, LinCE, IndicTriMix, Bhasha-Abhijnaanam (CC0) and DravidianCodeMix (CC-BY 4.0) were also used for evaluation only.
License
Apache-2.0. Copyright 2026 Arun Prabhakaran. Fine-tuned from FacebookAI/xlm-roberta-base (MIT); see LICENSE and NOTICE.
More from the author
Built by Arun Prabhakaran (Latent AI Labs). Open models for Indian languages:
- Yama: zero-shot text classifier
- Chitragupta: PII detection and redaction
- Nandi: complaint routing
Write-up: My Model Thought Tamil Was Telugu · Summary and FAQ: https://latentailabs.github.io/bhasha-language-id/
- Articles and FAQs: latentailabs.github.io
- Medium: @arunp0
- YouTube: @LatentAILabs — how AI works, measured on real GPUs
- GitHub: arunp0 · LinkedIn: arunp0