/ Модель

Характеристики

Контекст
514 токенов
Параметры
305 млн
Лицензия
MIT
Архитектура
xlm-roberta · dense
Базовая модель
xlm-roberta-base
Опубликована
13 июл 2026

RoBERTo

Классификация текстаТекст → label7 профессий

Дообученная XLM-RoBERTa определяет, написан ли текст на боснийском, хорватском или сербском языке.

16скачиваний за 30 дней0лайковвеса обновлены12 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

RoBERTo — модель классификации текста, разработанная absltnull для различения боснийского, хорватского и сербского языков. Это дообученная XLM-RoBERTa-base с архитектурой Transformer для классификации последовательностей и 305,2 млн параметров. Модель принимает текст и возвращает одну из меток: bs, hr или sr. Контекст модели составляет 514 токенов по метаданным; в README указано, что при обучении использовались последовательности до 256 токенов.

Модель предназначена для определения языка в наборах данных и балансировки корпусов на боснийском, хорватском и сербском. В README заявлена точность свыше 91% на неоднозначных и однозначных примерах тестирования, однако близость этих языков создаёт ошибки, особенно при различении боснийского и хорватского текста без характерных языковых признаков. Обучающие данные взяты из rsateam/sr-bs-hr-language-id и размечены по источнику публикации. Модель распространяется по лицензии MIT.

Сценарии применения

  • определение боснийского языка в текстовом корпусе
  • различение хорватского и сербского текста
  • маркировка текстов на боснийском, хорватском и сербском
  • балансировка многоязычного датасета по языкам

Ограничения

Близкие боснийский и хорватский языки трудно различать, если в тексте нет характерных признаков; такие неоднозначные примеры снижают точность. Заявленная оценка получена на данных из конкретного датасета и не гарантирует такую же точность на других источниках и жанрах текста.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

RoBERTo Language Classifier

"I literally just took RoBERTa and made it sound like a common Croatian name. You know... Roberto."

Overview

absltnull presents RoBERTo, a small language classifier model made to accurately differentiate Bosnian, Croatian and Serbian text. Based on xlm-roberta-base, it has managed to score over 91% accuracy on data it has never seen before, beating other, broadly generalized models. I myself use RoBERTo to accurately label the HBS data found in my datasets, which will be used to balance the three languages, effectively preventing overtraining my models on a single preference language.

Architecture Details

  • Base model: xlm-roberta-base,
  • Type: Transformer-based classifier,
  • Context length: 512 tokens architecture, 256 used in training,
  • Output Classes: "sr", "bs", "hr"

Dataset Details

Dataset permanently borrowed from rsateam/sr-bs-hr-language-id for its simple yet brilliant idea on how to label these three closely related, yet subtly different languages: data sources. The dataset contains exactly 60k entries of equally split Bosnian, Croatian and Serbian text data extracted from Wikipedia, labeled by the source as the ground truth (e.g., Bosnian Wikipedia for BS, Croatian Wikipedia for HR, and Serbian Wikipedia for SR).

  • train: 42k entries,
  • validation: 9k entries,
  • test: 9k entries

Model Evaluation: The Good

The model has shown exceptional performance at labeling the three languages accurately, even on previously unseen data, reaching over 91% accuracy in unambiguous situations ("ambiguous" meaning where the languages are undistinguishable even by human annotators). It even beat two of the most widespread and most used language identification models by ~30 points, proving its worth in this narrow yet genuinely useful task.

Below is an accuracy graph of RoBERTo vs XLM-RoBERTa-Base vs FastText vs CLD2:

Model comparison image

Table version for easier reading:

ModelAccuracyMacro F1
FastText62.43%63.59%
CLD265.96%66.77%
XLM-RoBERTa-Base34.02%16.92%
RoBERTo91.58%91.64%

The Macro F1 and Accuracy scores are both worth noting here, as they both show completely different sides of the story.

Accuracy blindly shows only the raw "how many of the total questions did it get correct" score, which, as you know, can be guessed. Assuming a "cheating" model that knows nothing but tries to guess its way through, it only has 3 labels, so that's a 1/3 or 33% chance to "guess" the correct answer by sheer luck.

On the other hand, Macro F1 explicitly punishes prioritizing or "favoritizing" only one label out of the three, driving down the score if the model does so while "blindly guessing".

That's why XLM-RoBERTa's score is so low - it tried to randomly guess the languages, and it shows in both scores. The model got only 34% right (which is close to the 33% chance to guess by sheer luck) in raw Accuracy, but got only 17% when punished for guessing one language too often.

Now, onto FastText's and CLD2's scores.

FastText is a large language identification model developed by Meta, made to recognize 176 languages. Just like any other general LID model, it catastrophically fails with differentiating Bosnian, Croatian and Serbian as those are not its main focus. From the scores, we can tell it was not "randomly guessing" like XLM-RoBERTa, but it was wrong more than 37% of the time, bringing its accuracy closer to a coinflip (50/50 chance) than to an actual reliable source to tell these languages apart.

CLD2 is a language detection model (and C++ library) developed by Google, and is able to distinguish 80 different languages. NOTE: CLD2 does not have a "bs" (Bosnian) label, which makes this test a bit unfair, since it's not able to recognize Bosnian as a standalone language. As seen in the results, its Accuracy and Macro F1 scores are both noticeably higher than FastText's (about 3 points higher each, despite its disadvantage with Bosnian), but it is still only 15 points more accurate than a coinflip, which is extremely unreliable.

RoBERTo, on the other hand, absolutely nailed the task in both metrics, showing it hadn't memorized examples from training, but actually generalized on them. Macro F1 shows us that the model did not prioritize a single language when met with ambiguous scenarios, while Accuracy shows that it got most of the 9k questions right, with only 8.5% error (mostly from the ambiguous scenarios).

Model Evaluation: The Bad

Even though the model shows outstanding performance against general bases like CLD2 and FastText, it has its own flaws, which have to do with the "ambiguous" cases I've mentioned before.

In these cases, the input text does not show any bias toward any specific language, making the model (and most human native speakers) unsure of what to predict. These ambiguous cases happen mostly while trying to differ Bosnian from Croatian, as the input text can lack any "telltales" of the two languages. This makes some inputs a 50/50 chance of either being Bosnian or Croatian, which is not the model's fault, as even humans cannot tell them apart in these cases.

Below is an image of the "confusion matrix", which shows how often the model confuses the languages with each other (white, thin), along with how often it gets each language right (blue, bold):

The confusion matrix

Tables for easier reading:

Counts:

sr (predicted)bs (predicted)hr (predicted)
sr28829316
bs142643295
hr113292724

Percentages (normalized by row):

sr (predicted)bs (predicted)hr (predicted)
sr96.36%3.11%0.53%
bs0.47%89.53%9.99%
hr0.36%10.74%88.90%

As we can see:

  • In the Bosnian cases, it was mistaken for Croatian 295 times.
  • In the Croatian cases, it was mistaken for Bosnian 329 times.
  • Serbian was mistaken for another language only 109 times.
  • Another language was mistaken for Serbian even less, only 25 times.

Conclusion: The model has learned to differentiate other languages from Serbian really well, but Croatian and Bosnian get mixed in some cases.

How to use

Since this is basically just XLM-RoBERTa on Balkan steroids, you don't need much resources to run it, and it's blazingly fast via Hugging Face Transformers. Also, as a bonus, the labels (bs, sr, hr) are natively baked into the model's config file, so you don't need to manually add them. Enjoy:

# RoBERTo — sr/bs/hr language identification

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline

MODEL_NAME = "absltnull/RoBERTo"

# labels (sr/bs/hr) are already baked into the model's config
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME)

classifier = pipeline(
    "text-classification",
    model=model,
    tokenizer=tokenizer,
    device=0 if torch.cuda.is_available() else -1,
)

texts = [
    "Ove sedmice moram da kupim bijeli hljeb.", # bs
    "Ове недеље морам да купим бели хлеб.", # sr
    "Ovog tjedna moram da kupim bijeli kruh.", # hr
]

# simple usage: top predicted label
predictions = classifier(texts)
for text, pred in zip(texts, predictions):
    print(f"[{pred['label']}] ({pred['score']:.2%})  {text}")

Final Message

Made with love in Bosnia. Feel free to use, upgrade, fine-tune or adapt to your needs. absltnull out.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
XLMRobertaForSequenceClassification
Ревизия весов
779b973

0 моделей