← Latest papers
💬 NLP

Loanword or Switch? The Annotation Boundary, Not the Model, Drives Kazakh-Russian Code-Switching Identification

This paper argues that the primary challenge in identifying Kazakh-Russian code-switching is not the choice of language identification model, but rather the annotation boundary distinguishing integrated loanwords from actual code-switching, a distinction clarified by a newly released document-level gold dataset and a filter-first cascade approach.

Original authors: Bogdan Savelyev

Published 2026-08-04
📖 5 min read🧠 Deep dive

Original authors: Bogdan Savelyev

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Great Language Mix-Up: Why Computers Get Confused by Borrowed Words

Imagine you are trying to teach a robot to understand two different languages that happen to use the exact same alphabet, like two neighbors who speak different dialects but write with the same set of letters. This is the world of Natural Language Processing (NLP), a branch of computer science where machines try to read, write, and understand human speech. One of the robot's first jobs is Language Identification (LID): simply figuring out, "Is this sentence French or Spanish?" or "Is this Kazakh or Russian?"

Usually, this is easy. If a sentence is full of French words, the robot says "French." But things get tricky when people mix languages in a single message, a phenomenon called code-switching. This happens when someone starts a sentence in one language and finishes it in another, like saying, "I went to the bakery to buy khleb." In this scenario, the robot has to decide: Is this a messy mix of two languages, or is it just one language that happens to have borrowed a few words from the other? If the robot gets this wrong, it might think a pure message is a messy mix, or miss a real mix entirely. This matters because if a computer thinks a message is "mixed" when it's actually just one language, it might try to translate it or analyze its mood incorrectly, leading to confusion in everything from social media moderation to customer service bots.

The Paper's Story: It's Not the Robot's Fault, It's the Rulebook

In this paper, researcher Bogdan Savelyev tackles a specific headache involving Kazakh and Russian, two languages spoken by millions in Kazakhstan that both use the Cyrillic alphabet. The problem? Computers were screaming "MIXED!" at almost every Kazakh sentence they saw. Why? Because Kazakh has borrowed thousands of words from Russian over the years (like "quality" becoming kachestvo). To a computer looking only at letters, a Kazakh sentence with a Russian loanword looks exactly like a sentence that has switched languages.

The paper argues that the mistake wasn't that the computer models were too dumb; the mistake was in the rules we gave them. The researchers realized that the definition of "mixed" was too loose. They proposed a new, stricter rule: Integrated loanwords are still the original language. If a Kazakh sentence uses a Russian word but keeps Kazakh grammar and sentence structure, it is Kazakh, not mixed. Real "mixed" text only happens when the speaker actually switches grammatical structures, like finishing a whole clause in Russian and then starting a new one in Kazakh.

To prove this, the team built a "gold standard" dataset of over 3,000 messages, carefully labeled by humans who followed this new, strict rule. They then tested a bunch of different computer models against this new rulebook.

Here is what they found:

  • The "Letter Counting" Mistake: Simple tools that just check for Russian letters inside Kazakh text were terrible. They labeled almost everything as "mixed" because they couldn't tell the difference between a borrowed word and a real language switch.
  • The "Window" Trick: They tried a clever non-neural method called HeLI that looks at small "windows" of words (like looking at 2 or 3 words at a time) instead of the whole sentence at once. By stripping out the known borrowed words first and then checking these small windows, this method got much better at spotting real switches. It jumped from getting about 70% of the answers right to nearly 87%.
  • The Power of Context: The best performer was a large, modern AI model called XLM-R. Because this model reads the entire message at once and understands the context, it could naturally tell the difference between a borrowed word and a real switch. It achieved a score of 0.966 (out of 1.0), which is incredibly high.
  • The Real-World Impact: When they applied this smart filter to a massive pile of over 331,468 real social media posts, the results were shocking. Old, simple rules flagged nearly 28,000 posts as "mixed," but when a human checked a sample, only about 1.66% were actually mixed. The new, smart filter correctly identified only 4.9% of the total posts as mixed. This means the old rules were inflating the number of mixed messages by a huge margin, making it look like people were switching languages constantly when they were mostly just speaking Kazakh with some borrowed words.

The paper concludes that the bottleneck isn't the computer model itself; it's the annotation boundary—the line we draw between "borrowed word" and "language switch." Once we draw that line clearly, even simpler models can do a decent job, and advanced models can reach near-perfect accuracy. The author also released their data and tools so others can stop making the same mistake. They admit, however, that their human labels were done by a single person (not a team), so there is a small chance of human error, and the final results on the huge dataset are predictions, not a second human check. But the evidence is strong: if you want to understand code-switching, you have to teach your computer the difference between a loanword and a switch, not just count letters.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →