/ Модель

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

Контекст
4 096 токенов
Параметры
32,6 млн
Лицензия
Apache 2.0
Архитектура
modernbert · dense
Библиотека
transformers
Опубликована
6 ноя 2026

arabic-modernbert-unified

Заполнение пропусковТекст → текст5 профессий

Компактный арабский энкодер ModernBERT для предсказания замаскированных слов, NLI, извлечения ответов и эмбеддингов для поиска.

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

Бенчмарки

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

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

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

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

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

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

Arabic ModernBERT Unified — компактная модель Waqf-AI для обработки арабского текста. Это восьмислойный двунаправленный энкодер ModernBERT с 32,6 млн параметров, шириной скрытого слоя 384 и шестью головами внимания. Модель принимает последовательности длиной до 4096 токенов и использует BPE-токенизатор на 48 тысяч элементов, ориентированный на арабский язык.

Основная задача модели — предсказание замаскированных слов. В комплект также входят обученные головы для распознавания текстовых отношений по трём классам, извлечения ответов из контекста и создания 384-мерных эмбеддингов предложений для поиска. Модель обучена с нуля на арабских текстах, а затем адаптирована для этих задач. В опубликованных диагностических оценках она показала результаты по NLI и поиску выше ряда указанных базовых моделей, однако оценки основаны на небольших наборах коротких примеров. Качество длинного контекстного поиска и извлечения ответов в README не измерялось.

Для использования нужны Transformers и PyTorch. Модель распространяется по лицензии Apache-2.0.

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

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

Ограничения

Оценки основаны на небольших наборах коротких примеров; качество на длинных документах и извлечения ответов отдельно не измерялось. Результаты NLI учитывают проведённую для модели задачно-ориентированную адаптацию.

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

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

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

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

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

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

Открыть на Hugging Face

Arabic ModernBERT Unified

Arabic ModernBERT Unified banner with a layered encoder illustration

A compact Arabic text encoder with 32.79M parameters for masked-language modeling and 32.94M with all task heads. Its eight-layer ModernBERT backbone supports masked-word prediction, three-way natural language inference, extractive QA, and 384-dimensional sentence embeddings.

Model propertyValue
EncoderModernBERT, 8 layers, hidden width 384, 6 attention heads
TokenizerArabic-focused BPE, 48,000 entries
Configured input limit4,096 tokens
HQ pretraining input lengthUp to 1,024 tokens per block
WeightsFP32 safetensors, about 131 MB for encoder + MLM, plus 0.60 MB for auxiliary heads
InitializationRandom weights
LicenseApache-2.0

Quick start

Use the standard Transformers fill-mask pipeline. Tested with Python 3.13, PyTorch 2.13.0 and Transformers 5.14.1.

from transformers import pipeline

fill_mask = pipeline("fill-mask", model="Abdelkareem/arabic-modernbert-unified")
for candidate in fill_mask("تقع القاهرة على ضفاف نهر [MASK].", top_k=5):
    print(candidate["token_str"], candidate["score"])

Sentence embeddings and NLI

Download the release and run the included example.

hf download Abdelkareem/arabic-modernbert-unified --revision v1.0.0 --local-dir arabic-modernbert-unified
cd arabic-modernbert-unified
pip install -r requirements.txt
python example.py
from unified_encoder import UnifiedArabicEncoder

model = UnifiedArabicEncoder(".")
embeddings = model.encode(["يقرأ الطفل كتاباً.", "الطفل يقرأ كتاباً."])
print(float(embeddings[0] @ embeddings[1]))

scores = model.classify(
    ["يقرأ الطفل كتاباً في المكتبة."],
    ["الطفل يقرأ كتاباً."],
)[0]
print(dict(zip(("entailment", "neutral", "contradiction"), scores.tolist())))

The retrieval path mean-pools non-special tokens, applies the learned projection and L2-normalizes each vector. NLI uses the first-token hidden state and the released three-way classifier. The QA head is accessible as model.qa and maps each hidden state to start and end logits. For extractive QA, encode the question as the first sequence and the context as the second, and use only context offsets for answer spans.

Training

  1. Arabic pretraining. A single pass over the retained Arabic arb_Arab subset of FineWeb2-HQ, pinned at c0c06e94fd3a44ae9e802b2b0fc533817601eb5e. After cleanup, overlap exclusions and exact deduplication, the run retained 3,098,999 documents and 18.30 GB of cleaned UTF‑8 text. The model saw 2.508B content tokens and 2.517B attended positions in 142,210 updates using 15% token masking. FineWeb2-HQ dataset card
  2. Language and task continuation. The selected lineage used merged Arabic Wikipedia, HQ and Arabic XL-Sum language replay, Arabic NLI, TyDi QA and filtered domain examples. The reconstructed continuation budget is ~778M attended positions. Replay contributes to this count.
  3. Unified adaptation. The final 1,000 updates combined MLM, NLI with teacher supervision, contrastive retrieval with teacher-vector alignment, and extractive QA replay. Domain MLM included Nawah and filtered Waqfeya text. Training manifest

Evaluation

Reviewed scores show Luna → Terra percentages on 100 shared Arabic cases per task. MLM credits exact answers and plausible completions accepted by the judge. NLI measures judge agreement. Retrieval measures whether the top results include a judged relevant sentence. All checkpoints used the same frozen probe protocol for NLI and retrieval.

CheckpointMLM parametersConfigured contextMLM top‑1 / top‑5NLI agreementRetrieval R@1 / R@5
Arabic ModernBERT Unified32.79M4,09670/100 → 65/8868 → 5948/61 → 42/53
Waqf-AI ArabicBertHash v249.41M2,04865/93 → 48/7637 → 4131/39 → 27/35
AraBERTv2135.26M51282/98 → 81/8949 → 4055/64 → 50/58
NAMAA AraModernBERT149.59M8,19284/97 → 78/9534 → 3547/62 → 42/55
Arabic MiniBERT11.58M51230/78 → 35/7435 → 3246/63 → 41/57

Unified uses 78% fewer MLM parameters than NAMAA. On these cases it comes within two points of NAMAA on sentence retrieval, while NAMAA leads by 13–14 points on MLM top‑1. Unified leads all three public baselines on NLI agreement after its own supervised task adaptation. The public checkpoints' encoder weights remained frozen.

Unified uses 34% fewer parameters for MLM than ArabicBertHash v2 and scores higher on all five reported metrics under both judges. ArabicBertHash v2 has a 16.25M-parameter encoder and a larger, untied MLM head. Its encoder is configured for 2,048 tokens, with a 1,024-token tokenizer limit in the release. Its NLI and retrieval scores come from the shared probes.

Exact-reference and native-head results

ProtocolUnified score
Whole-word MLM exact top‑1 / top‑5, 201 shared single-token-eligible cases16.92% / 30.35%
Frozen NLI probe, 1,024 pairs71.68% accuracy
Released native NLI head, same pairs74.12% accuracy
Frozen retrieval probe, 512 queries53.13% / 76.76% R@1 / R@5
Released native retrieval head, same queries55.27% / 77.73% R@1 / R@5

Exact MLM scores require the original masked word. A blinded spot review found that each automated judge missed valid alternatives and accepted some invalid answers. The MLM scorer rejects blank and control-token candidates. Machine-readable evaluation

Scope and limitations

These diagnostics use short examples from previously used evaluation sets. Retrieval uses NLI-derived sentence pairs, and the NLI comparison includes the benefit of Unified’s prior supervised training. Long-document and extractive QA performance remain unmeasured here.

Files

FileContents
model.safetensorsEncoder and tied MLM head
auxiliary_heads.safetensorsTrained NLI classifier, QA span head, and embedding projection
tokenizer.json, tokenizer_config.jsonReleased 48K tokenizer and special-token settings
unified_encoder.py, example.pyOptional local loader and runnable example
training_summary.json, evaluation/summary.jsonTraining and evaluation records
SHA256SUMSRelease file checksums

Architecture reference: ModernBERT. The Arabic checkpoint was initialized and trained from scratch.

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей