My Model Thought Tamil Was Telugu, Part 2: How 51,000 YouTube Comments Fixed It
From the publisher’s feed, collected in the ZeroLabs newsroom.
A rule labeller that failed, an open-weights LLM labeller that passed, and a leak I found in my test dataBy Arun Prabhakaran · @LatentAILabs“padam semma mass, konjam vera level” is a Tamil comment I wrote myself (“the film is awesome, next level”), typed in English letters the way a lot of people actually comment online. Here is what my language-ID model, Bhasha, made of it:v1: padam/te semma/te mass/en konjam/te vera/en level/en -> main language: Teluguv2: padam/ta semma/ta mass/en konjam/ta vera/ta level/en -> main language: TamilBhasha is a small open-source model (278M parameters, Apache-2.0, runs on a CPU) that labels each word of a message with its language: one of 11 Indian languages, English, a name, or “other”. In Part 1 I tested it on CoLI-Dravidian 2024, a set of Tamil YouTube comments that people labelled word by word. It scored 0.72 (word-level macro-F1 over Tamil and English). Of the 8,064 Tamil words in that set, it called 36.4% Telugu and only 36.3% Tamil.Bhasha v2 is now public, and on the same test it scores 0.94. Getting there took a labeller I had to throw away, three attempts at a second one, and a leak in my test data that I only found after v2 was trained.Parts of this article were drafted with AI assistants; I checked every number against the model card and the evaluation logs.Why v1 got it wrongv1 never saw a real comment. I built its 1.65 million training sentences by code: news and web sentences in each language, converted to English letters and mixed with English words. Written Tamil and spoken Tamil are very different, and romanised news Tamil looks nothing like “padam semma mass”.In Part 1 I tried the cheap fix first: tell the model which language to expect, so Telugu is off the table. It helped only a little (0.723 to 0.754). About a quarter of the Tamil words (2,188 of 8,064) came out as “English” instead. The model didn’t recognise them as Tamil at all, so the fix had to come from training data.The planBefore building anything, I wrote down what I would do and when I would stop. I would take real comments from the training split of DravidianCodeMix (CC-BY-4.0), a public collection of Tamil, Malayalam and Kannada YouTube comments. I first pulled out 300 of them (the “dev 300”) to check label quality and pick a checkpoint. After removing those and any exact or near-duplicates of the test sets, 51,071 were left for training: 34,633 Tamil, 10,975 Malayalam and 5,463 Kannada. If the word labels on the new comments were wrong more than 10% of the time, I would stop. And I would ship v2 only if CoLI Tamil improved by at least 0.03 while no other independent human-labelled test dropped by more than 0.01.The plan changed several times along the way, always before I looked at any test score. I’ll point out the big changes when we get to them.One thing to know up front: I had no human labels for the new comments. The dev 300, and later a fresh 150, were labelled by three LLM passes (two from Claude, one from Gemini), and I kept the 2-of-3 vote. The three agreed on 93% to 98% of words, depending on the language. Two of the three votes are Claude, so when the two Claude passes agree they decide the label. Those labels decided the gates and picked the checkpoint, so a proprietary model shaped v2 indirectly, even though none of its output is in the training data. The human-labelled test sets were never used for training, prompts or tuning.Attempt 1: a rule, and why I threw it away51,071 comments is too many to label by hand, so I started with a rule. Emoji, numbers and punctuation are other. A word in Tamil script is Tamil. A word in English letters is English if it's common in English, otherwise it takes the comment's language.On the dev 300, the rule got 12.0% of words wrong, mostly English loan words labelled as the Indian language. I adjusted it once and got 9.6%, just under the line (Kannada was still at 12.5%). I started a pilot training run.Then a second model, which I had asked to poke holes in my plan, caught what I had missed: I’d tuned the rule on the same 300 comments I was measuring it on, so of course it looked fine. I labelled 150 fresh comments the same way and measured the frozen rule once. 11.6% wrong: Tamil 8.5%, Malayalam 12.3%, Kannada 14.0%. I killed the pilot run before it finished and never looked at its score.That was the first change to the plan: the labeller would be an LLM.Attempt 2: an open-weights LLM as labellerMy release rules say nothing in the training data can come from a proprietary model, so the labeller had to be open weights. I used Gemma 4 26B-A4B (Apache-2.0, pinned revision) on vLLM 0.32.0, on a Colab GPU, at temperature 0 with thinking turned off. It followed the same written labelling guide the three LLM passes had used, which, unlike the rule, includes a name label.It took three tries.20 comments per request. On the fresh 150 it got 9.4% of words wrong, but only 135 of the 150 comments came back with usable labels. That passed my gate as I had written it, so I ran the full pool. Some requests kept generating and never stopped, and only 60% of the comments came back. Retries took about 100 seconds each, and at temperature 0 they were likely to fail the same way again. I had been holding the labels in memory, so when I stopped the session to cap the cost, every one of them was gone, along with about 11 compute units.5 comments per request, with the output length capped and every batch written to disk as soon as it finished. This time I required all 150 fresh comments to come back. 139 did. I looked at the 11 failures and every one was the same: the model had merged two words or split one, so it returned one label too many or too few.Numbered words. Instead of a plain list, each comment went in as {"1": "padam", "2": "semma", ...}, and the reply had to give a label for each number. 150 of 150 came back, with 7.5% word error (Tamil 7.3%, Malayalam 8.7%, Kannada 6.6%).One caveat: I scored the labeller three times on the same 150 comments, not once. I also only added the “all 150 must come back” rule after the first try had passed without it. What changed between tries was the request format, not anything tuned against those labels, but the 7.5% is a little less clean than a single shot would be.Labelling cost about 18 Colab compute units against my estimate of 5 to 6, and the lost first run was most of the difference. Training and scoring added about 2.5 more.Trainingv2 is the v1 recipe with the new comments added: the same 1.65 million code-built rows, plus the 51,071 Gemma-labelled comments shown twice (a guess, not tuned). One epoch of XLM-RoBERTa-base, about an hour on one L4 GPU, with the checkpoint picked on the dev 300.The second change to the plan: I had also meant to add chat-style text written by open models, including Telugu. I postponed it to keep costs down, so v2’s new text is Tamil, Malayalam and Kannada only.On the dev 300, Tamil went from 0.846 to 0.970, Malayalam from 0.863 to 0.952 and Kannada from 0.865 to 0.949. Those comments come from the same collection as the training text, so all this told me was that nothing had broken.Results on the human-labelled testsI scored v2 once on each test. The CoLI files have one word per row and no sentence breaks, so I score them in 12-word windows, the same way as for v1. Words people labelled name or other are left out of the score.v2 passed the ship rule, and it still passes if you leave out CoLI Malayalam. Tamil is where the change is: +0.21 is far bigger than run-to-run noise, while the smaller moves are not. The other independent tests moved up by 0.005 to 0.034 (I leave CoLI Malayalam out of this for the reason in the next section). These come from a single training run, so I read the small moves (Kanglish, WoLLaI, and Hindi–English on COMI-LINGUA at 0.896 to 0.901) as “no worse”, not as wins. Sentences in native script (0.9956 to 0.9950) and romanised sentences in a single language (0.907 to 0.903) stayed within 0.005. That small romanised dip is almost all Urdu, which v2 calls Hindi more often (Urdu F1 0.621 to 0.565); in English letters the two are often written the same way.Here is where the same 8,064 Tamil words went:Telugu dropped from 36% of Tamil words to under 1%. One error went up: v2 calls 3.0% of Tamil words a name, up from 2.0%. The same shift lifted name F1 on CoLI Tamil from 0.35 to 0.67, so v2 finds more real names but also mistakes more ordinary words for names.Two caveats. CoLI and DravidianCodeMix are both YouTube comments in the same languages, so part of the Tamil gain is simply the model seeing this kind of text for the first time. I can’t separate “learned spoken Tamil” from “learned YouTube comments”. And I never trained a model on the rule’s labels, so I can’t tell you how much of the gain needed the better labels. That stays untested.The leak I found after the factAfter v2 was ready, the same reviewer model asked a fair question. CoLI and DravidianCodeMix are both collections of Dravidian-language YouTube comments, so could test comments be sitting in my new training text? My dedup only removed comments that were exact or near copies of test text (5-word-run overlap, measured as Jaccard similarity, above 0.6). But each comment was compared with a whole 12-word test window. A 6-word comment has only two 5-word runs against the window’s eight, so even a word-for-word copy inside a window could never reach 0.6.So I checked every 5-word run in the test windows against v2’s new training comments. In CoLI Malayalam, 24% of 5-word runs also appeared in training; some of that test very likely comes from the same comments. CoLI Tamil had 1.9%. CoLI Kannada, Kanglish and WoLLaI had none.Then I re-scored both frozen models on only the windows that share no 5-word run with the training text:CoLI Tamil, 1,219 of 1,292 windows: v1 0.718, v2 0.935 (0.936 on the full set)CoLI Malayalam, 939 of 2,292 windows: v1 0.912, v2 0.967 (0.967 on the full set)On the clean windows the scores barely moved. For Tamil, where 94% of windows were clean, I’m comfortable with that. For Malayalam only 41% survived, and a 5-word check can’t catch comments from the same videos or the same people. So I treat CoLI Malayalam as not independent for v2, and the model card now says so.What is still weakdistilka, the model that won the 2022 Kanglish shared task, still beats v2 on CoLI Kannada (0.954 vs 0.937). Hindi words inside Gujarati–Hindi–English text are still poor: Hindi F1 of 0.32 there, 0.702 overall. For whole romanised sentences in one language, GlotLID is better (0.994 vs 0.903). The new training labels are about 7.5% wrong, and that’s measured against LLM labels, not human ones.There’s also a new risk I can’t measure: v2 saw about 69,000 Tamil comment rows (each comment twice) and no Telugu comments at all, so it may now be too quick to call informal romanised Telugu “Tamil”. The only Telugu test I have is 300 romanised single-language sentences, and there v2 is unchanged (F1 0.925 to 0.926; 1 of 300 called Tamil). But those are formal sentences, not chat, so the language v1 kept guessing, Telugu, is still one I can’t properly test. Neither can I test Marathi, Punjabi, Urdu or Odia. I found no real code-mixed test set for any of them.What I’d do differentlyI’d measure every gate on data I’d never touched, and decide in advance what happens if it fails. The rule looked fine on the comments I had tuned it on and failed on 150 fresh ones.I’d read an LLM labeller’s failures before trying a bigger model. Mine were all count mismatches, and a format change fixed them.And I’d check overlap with test sets at the phrase level from the start, not just whole comments. My dedup said the data was clean, and a quarter of CoLI Malayalam’s 5-word runs were in it anyway.Try it# pip install transformers torch huggingface_hubimport os, sysfrom huggingface_hub import hf_hub_download# lid_wrapper.py is a small helper in the model repo: it splits text into words and adds a summarysys.path.insert(0, os.path.dirname(hf_hub_download("arunp0/bhasha-lid-indic-v2", "lid_wrapper.py")))from lid_wrapper import LIDlid = LID("arunp0/bhasha-lid-indic-v2")lid("bro naan nalaiku office varala")# {'words': [('bro', 'en'), ('naan', 'ta'), ('nalaiku', 'ta'), ('office', 'en'), ('varala', 'ta')],# 'main': 'ta', 'script': 'roman', 'mixed': True, 'share': {'ta': 0.6, 'en': 0.4}}lid("ನಾಳೆ meeting ಇದೆ") # native script works too# {'words': [('ನಾಳೆ', 'kn'), ('meeting', 'en'), ('ಇದೆ', 'kn')], 'main': 'kn', 'script': 'mixed', ...}v2 runs fine on a laptop CPU; you don’t need a GPU for a few messages.Bhasha v2: huggingface.co/arunp0/bhasha-lid-indic-v2Bhasha v1: huggingface.co/arunp0/bhasha-lid-indicPart 1: My Model Thought Tamil Was TeluguIf you speak Telugu, Marathi, Punjabi, Urdu or Odia and Bhasha gets your code-mixed text wrong, please open a discussion on the model page. Those are the languages where I most need real examples.Bhasha is an independent personal release by Arun Prabhakaran, licensed Apache-2.0. New training data: DravidianCodeMix (CC BY 4.0), with word labels by Gemma 4 26B-A4B-it (Apache-2.0). Evaluation data: CoLI-Dravidian 2024 (FIRE 2024 shared task); CoLI-Kanglish (ICON 2022 shared task); WoLLaI Mal-Eng (Pondicherry University, CC BY 4.0); COMI-LINGUA.My Model Thought Tamil Was Telugu, Part 2: How 51,000 YouTube Comments Fixed It was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.