/ Модель

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

Контекст
512 токенов
Параметры
21,5 млн
Лицензия
Apache 2.0
Архитектура
dihya · dense
Библиотека
transformers
Опубликована
1 ноя 2026

Dihya-22M

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

Байтовый классификатор Dihya-22M определяет один из 22 языковых и диалектных классов в текстах Северной Африки и нескольких мировых языках.

117скачиваний за 30 дней0лайковвеса обновлены6 ноя 2026

Бенчмарки

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

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

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

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

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

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

Dihya-22M — классификатор языка и диалекта, разработанный авторами семейства Dihya. Это байтовая свёрточно-трансформерная модель с 21,5 млн параметров и контекстом 512 токенов. Она различает 22 класса: разновидности берберского континуума в латинской и нео-тифинагской письменности, североафриканские диалекты арабского языка в арабском письме и Arabizi, современный стандартный арабский и несколько мировых языков. Модель предназначена для разметки и маршрутизации текстов в корпусных конвейерах, включая веб-сборы и вывод OCR. На отложенной выборке из 14 247 предложений заявлены точность 91,90% и macro-F1 0,9180. Предусмотрена split-conformal калибровка: функция identify может возвращать набор меток для неоднозначных текстов, тогда как forward выдаёт логиты. Лицензия — Apache-2.0.

Модель лучше подходит для предложений с различительными морфологическими признаками, чем для коротких фрагментов общей лексики. Среди ограничений авторы отмечают нехватку данных для шауйя, смешение алжирского и марокканского арабских диалектов, отсутствие токенной разметки при переключении языков и ненадёжность классификации отдельных слов. Она не предназначена для различения поддиалектов внутри классов или установления авторства по диалекту.

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

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

Ограничения

Короткие фразы с общей лексикой и отдельные слова могут быть неоднозначны; для них модель может возвращать несколько меток. Данных для шауйя мало, алжирский и марокканский арабский пересекаются, а токенная разметка переключения языков не поддерживается.

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

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

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

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

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

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

Открыть на Hugging Face

Dihya-22M

A 22.0M-parameter (21,999,616 published) byte-level Conv-Transformer that upgrades Dihya-5M across the entire Berber dialect continuum in both Latin and Neo-Tifinagh scripts, North African Arabic dialects in Arabic script and Latin Arabizi, Modern Standard Arabic, and major world languages: twenty-two classes across five scripts.

On a stratified held-out set of 14,247 sentences across 36 (language, domain) cells it reaches 91.90% accuracy and 0.9180 macro-F1 over all twenty-two classes. Every single class achieves $\ge 71.4%$ recall, and its worst group recall is 63.33% on the scarcest Shawiya cell.

Against Dihya-5M, it expands the inventory from seven classes to twenty-two, adds Neo-Tifinagh, Algerian Darija, Moroccan Darija, and Arabizi, lifts overall accuracy from 85.52% to 91.90%, and resolves the two central weaknesses of the 5M checkpoint:

  1. Kabyle precision rises from 0.626 to 0.900 while keeping recall at 0.925. Dihya-5M traded precision for recall, misrouting 37% of its Kabyle predictions to sibling text; Dihya-22M ends that trade-off.
  2. Central Atlas Tamazight recall rises from 0.660 to 0.948, and its confusion into Kabyle drops from 16.0% down to 2.58%. Tarifit confusion drops from 6.7% to 1.38%, and Tamasheq from 7.3% to 0.16%. Across Neo-Tifinagh varieties, confusion to Kabyle is $\le 2.12%$ (0.00% for Tamazight, Tarifit, and Tamasheq).

It ships with a split-conformal quantile ($\hat{q} = 0.9526$ at 99.0% nominal coverage, reaching 98.28% empirical coverage), so it returns a set of labels rather than one when text lies on the continuum and carries no distinguishing marker.

The task

Language identification across the Berber dialect continuum and North Africa confronts three structural challenges:

  1. Morphological discrimination over shared roots: Amazigh varieties share substantial core vocabulary; distinguishing evidence is predominantly affixal, phonotactic, and clitic. Short sentences lacking dialect-specific markers are genuinely ambiguous.
  2. Upstream corpus contamination: Broad-coverage classifiers (such as NLLB's lid218e and GlotLID) fail on this continuum by collapsing sibling varieties into Kabyle—mislabelling 91.3% of Shawiya, 80.7% of Tarifit, 79.3% of Tashelhit, and 73.3% of Central Atlas Tamazight. Unfiltered web and parallel corpora inherit this silent contamination.
  3. Multi-script and dialect boundaries: Written Berber alternates between Latin and Neo-Tifinagh orthographies, while North African Arabic spans Arabic script and Latin-digit Arabizi alongside close dialectal proximity between Algerian (arq) and Moroccan (ary) Darija.

Results

14,247 sentences across 36 (language, domain) cells, held out completely disjoint from train (113,974) and dev (7,145).

Against the public identifiers and Dihya-5M

All systems scored in one pass over the held-out test rows:

systemaccuracyclasses it can nameAmazigh coverageDarija & Arabizi
Dihya-22M91.90%22 of 2213 varieties (Latin & Tifinagh)arq, ary, Arabizi
Dihya-5M85.52%7 of 226 varieties (Latin only)none
GlotLID41.78%3 of 223 varieties (Latin only)conflated / no Arabizi
NLLB lid218e28.33%2 of 222 varieties (Latin only)conflated / no Arabizi

Public identifiers cannot name Shawiya, Central Atlas Tamazight, Tarifit, Tumzabt, or Arabizi. When asked to classify texts in these varieties, their accuracy is zero by construction.

The quantity that matters downstream is how much sibling text ends up labelled Kabyle, since that is what a filter keyed on kab silently ingests:

true languagescript→ Kabyle, Dihya-22M→ Kabyle, Dihya-5M→ Kabyle, GlotLID→ Kabyle, lid218e
TashelhitLatin1.38%2.0%17.3%79.3%
TarifitLatin1.38%6.7%90.0%80.7%
TumzabtLatin1.88%———
Central Atlas TamazightLatin2.58%16.0%66.7%73.3%
ShawiyaLatin21.43%19.3%96.0%91.3%
TamasheqLatin0.16%7.3%0.0%6.7%
TashelhitTifinagh0.50%———
Central Atlas TamazightTifinagh0.00%———
TarifitTifinagh0.00%———
Standard MoroccanTifinagh2.12%———
TamasheqTifinagh0.00%———

Central Atlas Tamazight leakage into Kabyle drops sixfold from Dihya-5M's 16.0% down to 2.58%, and Tamasheq drops from 7.3% to 0.16%. In Tifinagh, cross-leakage into Kabyle is virtually zero.

Per class, all twenty-two

The twenty-two-class report, which is what test-report.json holds:

labellanguage / dialectscriptsupportprecisionrecallF1
kab_LatnKabyleLatin8000.9000.9250.912
kab_TfngKabyleNeo-Tifinagh8000.9710.8790.923
shy_LatnShawiyaLatin980.8640.7140.782
mzb_LatnTumzabt / MozabiteLatin8000.9860.9630.974
shi_LatnTashelhitLatin8000.9840.9750.979
shi_TfngTashelhitNeo-Tifinagh8000.7160.7440.730
tzm_LatnCentral Atlas TamazightLatin6590.9470.9480.948
tzm_TfngCentral Atlas TamazightNeo-Tifinagh3680.9860.9270.955
rif_LatnTarifitLatin8000.9750.9790.977
rif_TfngTarifitNeo-Tifinagh690.9380.8840.910
zgh_TfngStandard Moroccan AmazighNeo-Tifinagh8000.6780.7430.709
taq_LatnTamasheqLatin6271.0000.9940.997
taq_TfngTamasheq (Tawallammat)Neo-Tifinagh2651.0000.9890.994
arq_ArabAlgerian Arabic (Darija)Arabic7880.7380.8980.811
arq_ArabiziAlgerian Arabic (Arabizi)Latin/Numerals2230.9110.9190.915
ary_ArabMoroccan Arabic (Darija)Arabic8000.8460.7810.812
ary_ArabiziMoroccan Arabic (Arabizi)Latin/Numerals8000.9790.9900.984
ara_ArabModern Standard ArabicArabic7500.9770.8350.900
fra_LatnFrenchLatin8000.9950.9980.996
eng_LatnEnglishLatin8000.9890.9950.992
spa_LatnSpanishLatin8000.9950.9950.995
zho_HaniChineseHanzi8001.0001.0001.000

Kabyle precision is 0.900, up from 0.626 in Dihya-5M. Dihya-5M traded precision for recall, sending 37% of its Kabyle predictions to sibling varieties. Dihya-22M resolves that tension: Kabyle precision reaches 0.900 while maintaining 0.925 recall.

Central Atlas Tamazight recall rises from 0.660 to 0.948, resolving the largest weakness of the 5M checkpoint.

Shawiya recall reaches 0.714 on 98 test rows, against 0.687 in Dihya-5M, with precision rising to 0.864. 447 training rows is what exists in machine-readable form.

Arabic dialect discrimination

Separating Algerian Darija (arq), Moroccan Darija (ary), and Modern Standard Arabic (ara) in Arabic script and Arabizi:

True \ Predictedarq_Arabarq_Arabiziary_Arabary_Arabiziara_Arab
arq_Arab (Algerian Arabic)708 (89.8%)073 (9.3%)07 (0.9%)
arq_Arabizi (Algerian Arabizi)0205 (91.9%)014 (6.3%)0
ary_Arab (Moroccan Arabic)166 (20.8%)0625 (78.1%)08 (1.0%)
ary_Arabizi (Moroccan Arabizi)06 (0.8%)0792 (99.0%)0
ara_Arab (Modern Standard Arabic)83 (11.1%)041 (5.5%)0626 (83.5%)

Arabizi and Arabic script have zero cross-leakage (0 errors). Over 89.8% of Algerian Darija and 78.1% of Moroccan Darija are separated correctly; on shared Maghrebi idioms the conformal set emits ('arq_Arab', 'ary_Arab').

By (language, domain) cell

Reporting is on 34 active (language, domain) cells with support $\ge 20$:

recall
median cell0.957 (vs 0.921 in 5M)
cells at or above 0.9021 of 34
cells at or above 0.7031 of 34
cells at 1.0002 — Tashelhit scripture, Chinese foreign

The lowest cells with support $\ge 20$:

cellsupportrecall
shy_Latn/bench_gold300.633
shy_Latn/everyday440.636
ary_Arab/negative_dialect1350.637
zgh_Tfng/everyday7580.740
shi_Tfng/everyday8000.744

The Shawiya cells reflect the language's digital scarcity. ary_Arab/negative_dialect holds Moroccan colloquial text sharing vocabulary with western Algerian dialects. zgh_Tfng and shi_Tfng share everyday lexicon in standard Neo-Tifinagh orthography.

Conformal prediction sets

Calibrated by split conformal at target coverage 99.0%. Fitted on one half of the development set (3,551 sentences) and coverage measured on the other (3,551 held-out sentences):

fitted on3,551 dev sentences
coverage measured on3,551 held-out dev sentences
target coverage99.0%
empirical coverage98.28%
quantile q̂0.9526
mean set size1.259 labels (across 22 classes)
singletons79.86% (2,836 of 3,551)

Usage

from transformers import AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained(
    "agbalu/Dihya-22M", trust_remote_code=True
)

for row in model.identify([
    "Azul fell-awen, amek tettilim ass-a?",
    "Mayemmi ur teccid ticemrarin nnecm a gma?",
    "Bonjour tout le monde, comment allez-vous?",
    "ⵜⴰⵇⴱⴰⵢⵍⵉⵜ ⴷ ⵜⵓⵜⵍⴰⵢⵜ ⵜⴰⵢⴻⵎⵎⴰⵜ ⵏⵏⴻⵖ.",
    "Hello everyone, how are you doing today?",
    "صباح الخير كيداير لاباس عليك",
    "واش راك خويا لاباس؟",
]):
    print(row["language"], round(row["confidence"], 4), row["prediction_set"])
# kab_Latn 0.5295 ('kab_Latn', 'shy_Latn')
# rif_Latn 0.5485 ('kab_Latn', 'rif_Latn')
# fra_Latn 0.9444 ('fra_Latn',)
# kab_Tfng 0.9265 ('kab_Tfng',)
# eng_Latn 0.9498 ('eng_Latn',)
# ary_Arab 0.8180 ('arq_Arab', 'ary_Arab')
# arq_Arab 0.4889 ('arq_Arab', 'ary_Arab')

identify applies the conformal quantile that the numbers above were measured with; it travels in config.json. The plain forward returns raw cosine logits.

The tokenizer is the 256 UTF-8 byte values and is only needed for batching:

from transformers import AutoModelForSequenceClassification, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("agbalu/Dihya-22M")
model = AutoModelForSequenceClassification.from_pretrained(
    "agbalu/Dihya-22M", trust_remote_code=True
)
batch = tokenizer(["Azul fell-awen", "صباح الخير"], return_tensors="pt", padding=True, truncation=True)
logits = model(**batch).logits

Prediction sets widen where text is genuinely ambiguous. The greeting above returns ('kab_Latn', 'shy_Latn') — Shawiya and Kabyle share that greeting and neither carries a marker separating them. A forced singleton there would be an arbitrary guess.

Intended use

Screening and routing text in corpus pipelines: tagging web scrapes and OCR output across Latin, Tifinagh, and Arabic scripts, discarding non-target lines, and routing input to variety-specific models. Use the prediction set rather than the argmax where a wrong label would corrupt a corpus.

Not suitable for distinguishing sub-varieties inside any of the twenty-two classes, single isolated words lacking morphological context, or attributing authors on the basis of dialect.

Architecture

Parameters, trained22,198,528
Parameters, published21,999,616
Encoder layers10 (vs 6 in 5M)
Hidden / feed-forward384 / 1,344 (SwiGLU) (vs 256 / 704 in 5M)
Attention heads6 × 64, rotary positions
Conv stemfour parallel depthwise-separable 1D convolutions, kernels 3, 5, 7, 11
Poolingattentive (learned score per position)
Headcosine, scale 28.0
Vocabulary258 (256 UTF-8 bytes, [PAD], [UNK])
Maximum input512 bytes (vs 256 in 5M)

The published model excludes the auxiliary script classification head, binary filter head, and contrastive projection head (198,912 parameters), which shape representations during training and are never read at inference.

Four kernel widths because evidence sits at four physical scales: grapheme clusters and diacritics ($k=3$), inflectional affixes ($k=5$), clitic chains and annexation markers ($k=7$), and word stems ($k=11$).

Training

training rows113,974 across 36 (language, domain) cells
dev rows7,145
schedule8 epochs, 4,752 steps; batch 16 cells × 12 rows
published checkpointstep 2,072, selected on dev selection score
dev score there0.9157 macro-F1, 0.6364 worst-group recall
training time24.8 minutes at 532 seq/s

Five objectives address long-tail imbalance, domain collapse, and multi-script structure:

  1. LDAM margins for the long tail — $m_k = C / n_k^{1/4}$ (Cao et al., NeurIPS 2019).
  2. Convex Group-DRO — exponentiated-gradient weights over the active (language, domain) groups (Sagawa et al., ICLR 2020) with convex normalization.
  3. Domain-aware supervised contrastive learning — negatives mined from a different language in the same domain first (ConLID) over a 4,096-entry memory bank.
  4. Multi-task auxiliary heads — script classification (5 scripts) and binary Amazigh filtering.
  5. Deferred schedule — margins and group weights are disabled for the first half of training (steps 0–2,376).

Selection is on the mean of dev macro-F1 and dev worst-group recall, never on loss.

Limitations

Dialect continuum ambiguity: Short sentences of shared vocabulary carrying no variety-specific morphology cannot be deterministically resolved to a single class. The conformal prediction set captures this ambiguity directly by returning a multi-label set.

Shawiya data scarcity: 447 training rows and 98 test rows represent the entirety of machine-readable Shawiya text currently available; reported metrics reflect these sample size bounds.

Maghrebi Arabic dialect overlap: Algerian and Moroccan Arabic share substantial colloquial syntax and lexicon, leading to cross-dialect conformal sets on shared idioms.

Input length: Evaluated on sentence-level text; single isolated words lack sufficient phonotactic context for reliable attribution.

Code-switching: Outputs sentence-level classifications; token-level language diarization is not supported.

Files

filedescription
model.safetensors88.0 MB, 21,999,616 parameters
config.jsonarchitecture, 22 classes, prior shift and conformal quantile
modeling_dihya.py, configuration_dihya.pyarchitecture, transformers and torch only
tokenizer.json, tokenizer_config.jsonthe 258-entry byte vocabulary
calibration.jsonthe calibration, in full
test-report.jsonper class and per (language, domain) cell

No optimiser state, no scheduler state, no RNG. Training cannot be resumed from these files.

The name

Dihya (also called al-Kāhina, died c. 703 CE) was an Amazigh military leader from the Aurès Mountains of what is now eastern Algeria — the Shawiya homeland — who led the Berber resistance. The naming is homage and implies no endorsement by anyone.

Citation

@software{agbalu_dihya_22m_2026,
  title  = {Dihya-22M: Pan-Amazigh, North African Arabic, and World Language Identification},
  author = {AƔBALU},
  year   = {2026},
  url    = {https://huggingface.co/agbalu/Dihya-22M},
  note   = {22M parameters; 91.90\% accuracy over 22 classes on 14,247 held-out sentences}
}

Licence

Apache-2.0 on the weights and the code. The training corpus is assembled from sources under mixed licences; see resources/sibling_registry.yaml and resources/corpus_registry.yaml for per-source terms.

Part of AƔBALU, a Kabyle and Amazigh corpus and model collection.

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

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

GPU в ailist

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

Нельзя запустить

Модели нужен код из репозитория; запуск откроется после проверки совместимости.

Класс архитектуры
DihyaForSequenceClassification
Ревизия весов
a929c1a

0 моделей