/ Модель

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

Контекст
256 токенов
Параметры
1,1 млн
Лицензия
Своя лицензия
Архитектура
tashkeel_nano · dense
Опубликована
14 окт 2026

tashkeel-nano-1p1m

Разметка токеновТекст → label3 профессии
75скачиваний за 30 дней0лайковвеса обновлены24 окт 2026

Описание модели

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

Компактная символьная Transformer-модель Ahmadsy восстанавливает огласовку арабского текста для локального запуска на CPU и в браузере.

Tashkeel Nano 1.1M — компактная модель Ahmadsy для восстановления арабской огласовки (ташкиля). Она принимает арабский текст без огласовок или с частичной огласовкой и возвращает тот же текст с предсказанными знаками: фатхой, даммой, касрой, сукуном, шаддой и танвином. Архитектура — двунаправленный символьный Transformer-энкодер с классификационной головой на 15 классов; модель содержит 1,1 млн параметров, имеет контекст до 256 токенов и доступна в форматах Safetensors и ONNX.

Модель рассчитана на локальный запуск на CPU, мобильных и периферийных устройствах, а также в браузере. README приводит результат 3,78% DER на SadeedDiac-25 с нормализацией порядка знаков; при буквальном сравнении без неё DER составляет 8,78%. Крупные размещённые LLM могут точнее восстанавливать огласовку целых слов. Модель не предсказывает коранические знаки аннотации, а неарабские символы пропускает без изменений. Лицензия ограничивает использование исследовательскими целями.

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

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

Ограничения

Не предназначена для предсказания коранических знаков аннотации; показатель на SadeedDiac-25 зависит от нормализации порядка диакритических знаков, а обучающие данные пересекаются с исходным текстом этого бенчмарка. Использование ограничено исследовательскими целями.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

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

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

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

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

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

Открыть на Hugging Face

Tashkeel Nano 1.1M — Arabic Diacritization (Tashkeel) Model

اقرأ هذه الصفحة بالعربية ← · English

A 1.08M-parameter Arabic diacritizer (tashkeel / تشكيل) that runs on a plain CPU or inside a browser tab. It is the best-scoring open-weight model on the public SadeedDiac-25 benchmark below 1.5B parameters: 3.78% DER with case endings, ahead of the dedicated 1.5B Sadeed model (7.29) and every 7B–13B open model on that benchmark's leaderboard.

  • Try it in your browser: ahmadsy/tashkeel-compare (nothing is uploaded)
  • Input: Arabic text, bare or partly diacritized. Output: the same text with fatha, damma, kasra, sukun, shadda and tanwin on every Arabic letter.
  • Size: 4.15 MiB. Non-Arabic text (digits, Latin, emoji) passes through unchanged.
  • Code: github.com/ahmadmhmdsy/tashkeel-nano
  • License: research-only (see License).

Quickstart

pip install "tashkeel-nano[hub] @ git+https://github.com/ahmadmhmdsy/tashkeel-nano"
from tashkeel_nano import TashkeelNano

model = TashkeelNano.from_pretrained("ahmadsy/tashkeel-nano-1p1m")
print(model.diacritize("السلام عليكم ورحمة الله"))
# السَّلَامُ عَلَيْكُمْ وَرَحْمَةُ اللَّهِ
import sys
from huggingface_hub import snapshot_download

local = snapshot_download("ahmadsy/tashkeel-nano-1p1m")
sys.path.insert(0, local)          # the model package ships inside this repo
from tashkeel_nano import TashkeelNano

Needs pip install torch huggingface_hub safetensors.

Command line: python diacritize.py --text "مرحبا بالعالم" (also --file, or stdin).

ONNX (no PyTorch: browser, mobile, edge)

onnx/model.onnx (fp32, 4.8 MB) takes input_ids [batch, ≤256] from the repo's char tokenizer and returns per-character logits over the 15 classes; the browser demo runs it with ONNX Runtime Web. onnx/model_int8.onnx (1.9 MB, dynamic int8) agrees with fp32 on 99.2% of labels on 300 fadel_test lines — use it only when size matters more than the last fraction of accuracy.

Results at a glance

SadeedDiac-25 (1,200 paragraphs, half Modern Standard, half Classical Arabic), scored with the benchmark authors' own evaluator. Lower is better.

SystemParamsOpen weightsDER (CE)WER (CE)
Claude-3.7-Sonnet-no1.394.67
Gemini-Flash-2.0-no3.197.99
tashkeel-nano-1p1m (this)1.08 Myes3.7812.73
GPT-4-no3.865.27
Sadeed (Kuwain 1.5B)~1.5 Byes7.2913.74
Aya-23-8B8 Byes25.6347.49

Large hosted LLMs remain more accurate on whole words; this model is the option when you need diacritization offline, on-device, or at near-zero cost (about 10–20 ms for a short sentence in the browser demo, once loaded). Our score uses mark-order normalisation (the benchmark gold writes shadda before the vowel; this model emits Unicode NFC). The literal, unnormalised score is 8.78 DER — both are explained in the full results.

Training data

Trained on the train splits of four public diacritized corpora. Every test split used for scoring was kept out of training.

CorpusWhereUsed for
Sadeed TashkeelaMisraj/Sadeed_Tashkeelatrain (largest source)
Abdou Arabic TashkeelAbdou/arabic-tashkeel-datasettrain + valid; its test split is a held-out witness, never trained on
Fadel (Tashkeela split)AliOsm/arabic-text-diacritizationtrain + val; fadel_test is an external gate, never trained on
QCRI WikiNews 2024qcri/advancing-arabic-diacritizationtrain (so wikinews2024 is excluded from all scoring)

SadeedDiac-25 and WikiNews 2014 are evaluation-only. Sadeed_Tashkeela shares upstream text with SadeedDiac-25, so that benchmark is overlap-flagged (see Limitations). Most of the data is Tashkeela-derived and GPL-2-noted, which is why the weights are research-only.

Which model should I use?

NeedUse
Offline / on-device / browser tashkeel, tiny footprintthis model
Older 4.5M model from the same lineahmadsy/tashkeel-nano-4p5m — superseded, prefer this one
Quranic annotation marksnot supported (passed through, not predicted)

Technical details

The sections below are the full evaluation record: the benchmark table with both mark-order readings, this project's own tracker, the architecture, the training recipe and the reproduction steps.

  • Internal ids: e98_soupB, artifact soupB_uniform.
  • Architecture: bidirectional char-level Transformer encoder + 15-class diacritic head (see Architecture).
  • Published checkpoint: a uniform average ("soup") of 12 checkpoints from a 60,000-step run (steps 32,500 to 60,000) on the v3full corpus.

Every number in this card is either produced by a downloadable model or taken from a published leaderboard.


Results on SadeedDiac-25 (published benchmark)

SadeedDiac-25 is a 1,200-paragraph Arabic diacritization benchmark (50% Modern Standard Arabic, 50% Classical Arabic; 600 of its paragraphs come from the Fadel test set). It ships a gold reference and a published leaderboard, so it is a comparison a reader can actually reproduce.

The scores below were produced by running each model on the benchmark's own input field and scoring with the benchmark authors' evaluator (misraj-ai/Sadeed, Eval_code.ipynb), gt_missing_diacritic_is_error=False. CE = case endings. Lower is better.

SystemParamsDER (CE)WER (CE)DER (w/o CE)WER (w/o CE)
Claude-3.7-Sonnet-1.394.670.772.31
Gemini-Flash-2.0-3.197.992.385.50
tashkeel-nano-1p1m (this)1.08 M3.7812.732.257.41
GPT-4-3.865.273.8610.93
Sadeed (Kuwain 1.5B)~1.5 B7.2913.745.269.92
Aya-23-8B8 B25.6347.4919.7640.25
ALLaM-7B-Instruct7 B50.3670.3439.4167.09
Yehia-7B7 B50.8870.2339.7767.15
Jais-13B13 B78.6899.7560.7399.57
Gemma-2-9B9 B78.8699.7960.9299.59
SILMA-9B-Instruct-v1.09 B78.6699.7460.7199.56

All rows except ours are quoted from the benchmark's published leaderboard. Rank of this model: 3rd of 11 on DER (CE), 4th on WER (CE), 2nd on DER (w/o CE), 3rd on WER (w/o CE).

Read this before quoting the number above

SadeedDiac-25's gold reference is not Unicode-NFC: it writes the shadda before the vowel, while this model emits standard NFC order (vowel before shadda). The benchmark's evaluator is order-sensitive and silently drops a shadda that follows a vowel, so scoring our raw output against that gold marks every geminate wrong - a serialization artifact, not a diacritization error.

Both readings are reported here, because hiding either one would be misleading:

Evaluation of this modelDER (CE)WER (CE)DER (w/o CE)WER (w/o CE)
As emitted (NFC), scored literally8.7831.146.1922.73
Mark order normalised to the benchmark's convention3.7812.732.257.41

The table at the top of this section uses the normalised row, which compares linguistic content and is the like-for-like reading against the leaderboard. The literal row is what you get if you feed this model's raw output straight into the benchmark's evaluator. The same defect was root-caused independently inside this project (see Unicode NFC). Whether each leaderboard system above was scored with or without the same normalisation is not stated by the benchmark, so treat the ranking as approximate.


Registered tracker (this project's own metric)

For continuity with earlier releases, the same two public models under this project's own registered scorer (der_registered, word-level, mean over fadel_test / sadeed25 / wikinews2014 - all three are public corpora):

ModelParamsfadel_testsadeed25wikinews20143-gate mean
tashkeel-nano-1p1m (this)1.08 M5.2011.7117.6411.51
tashkeel-nano-4p5m (NFC-corrected)4.49 M14.3022.5931.8122.90

This metric is word-level (a word counts as correct only if all its marks match) and is therefore not comparable to the benchmark's diacritic-level DER (CE) column above. It is reported only so the two published models can be compared to each other under one fixed convention.

The soup is the lever, not the extra training

The published weights are a uniform average of 12 checkpoints from a single 60,000-step run. Continuing training from step 30,000 to 60,000 did not produce a monotone gain on its own; the average over that same-basin set is what lands the result. A soup is not a checkpoint: reproducing this exact number requires the same 12 members and the same uniform recipe, in ascending step order.

Correction: the earlier 4.5M comparison was wrong

If you have seen a figure near -64% for this line against tashkeel-nano-4p5m, it is retracted. That comparison decoded the 4.5M model with a renderer that predates the NFC mark-order fix, so its output was penalised by a defect rather than by model quality. Under the registered tracker above, with NFC on both sides, the corrected gap is -49.7%.


Unicode NFC - this model emits canonical text

Combining marks are emitted in NFC order: fatHa (ccc 30) sorts before shadda (ccc 33), so a geminate renders دَّ and not دّ َ. The historical renderer in this line emitted shadda-first, which disagrees with every NFC reference on every geminate - measured at 4.5% of all units and 42% of the registered gate on the 4.5M model. tashkeel_nano/labels.py in this repo carries the fixed marks_for_label, and inference additionally normalises its output to NFC.

Note that this choice is why the benchmark's raw evaluator penalises this model (see above): SadeedDiac-25's gold uses the older shadda-first order. NFC is the correct Unicode serialization; the benchmark gold is the outlier.


Architecture

Char-level bidirectional Transformer encoder with a per-position 15-class diacritic head. Llama-style blocks (RMSNorm + RoPE + SwiGLU + grouped-query attention) with the causal mask off.

layers18
hidden64
FFN256 (SwiGLU)
heads8 (GQA, 2 KV heads, head_dim 8)
context256
vocab171 (char-level, deterministic)
classes15
parameters1,083,328

The 15 classes are bare, fatha, damma, kasra, sukun, fathatan, dammatan, kasratan, shadda, shadda_fatha, shadda_damma, shadda_kasra, shadda_fathatan, shadda_dammatan, shadda_kasratan.

Non-Arabic content (digits, latin, emoji, tatweel, Quranic annotation, invisibles) is passthrough: it stays visible to the encoder as context but is never a prediction target and is re-inserted byte-exact, so reconstruct(parse(x)) == x always holds.

Decoding

centered (default): overlapping windows of 256 chars at stride 128 are scored, and each Arabic letter takes the mark from the window whose centre is nearest to it - no majority vote, ties broken on the mark's codepoint order. single is the non-overlapping hard-chunk fallback (cheaper, about 0.8 DER worse on the registered tracker).


Training

corpusv3full - the full v3 corpus with real space tokens (15.28% of positions)
steps60,000
batch64
LR2e-4 constant (AdamW, no schedule)
weight decay0.1
precisionfp16 autocast
published artifactuniform mean of the 12 step probes at 32,500 to 60,000

Why real space tokens matter: the 4.5M model was trained on a bed with no space tokens, so its space embedding row is never trained and raw-text decoding feeds it an untrained embedding. This model is trained on a bed with real space tokens, so ordinary raw text is the correct input - no whitespace-stripping workaround is needed.


Usage

From the HuggingFace hub (recommended)

from huggingface_hub import snapshot_download
import sys

local = snapshot_download('ahmadsy/tashkeel-nano-1p1m')
sys.path.insert(0, local)

from tashkeel_nano import TashkeelNano

model = TashkeelNano.from_pretrained('ahmadsy/tashkeel-nano-1p1m')
print(model.diacritize('السلام عليكم ورحمة الله'))
# السَّلَامُ عَلَيْكُمْ وَرَحْمَةُ اللَّهِ

Only torch, huggingface_hub and safetensors are required; the tokenizer, label schema and passthrough codec are stdlib-only and ship with the repo.

CLI

python diacritize.py --text 'مرحبا بالعالم'
python diacritize.py --file input.txt
echo 'مرحبا بالعالم' | python diacritize.py
python diacritize.py --decode single --file input.txt   # cheaper, slightly worse

Notes

  • Input may be diacritized or bare; marks are stripped and the text is NFC-normalised before encoding, so both are accepted.
  • Output is always NFC.
  • CPU works; a GPU is used automatically when available.
  • Long inputs are windowed internally - no manual chunking needed.

Limitations & honesty

  1. Mark order changes the benchmark score. See the note in the results section: the benchmark gold is shadda-first, this model is NFC. Both readings are published above; the normalised one is the comparable one.
  2. The ranking against the leaderboard is approximate. The benchmark does not state whether the systems on its leaderboard were scored with or without mark-order normalisation.
  3. wikinews2024 is excluded from the registered tracker as contaminated, and sadeed25 is overlap-flagged (Sadeed_Tashkeela is in this project's training mix), so the cleanest single reading there is wikinews2014.
  4. A soup is not a checkpoint. The published weights are an average of 12 checkpoints. Reproducing the exact number requires the same 12 members and the same uniform recipe, in ascending step order.
  5. The package's fp32 decode differs slightly from the registered fp16 measurement - about -0.12% relative, roughly 20x below the 2% significance bar used throughout this line.
  6. Not a Quranic diacritization model. It predicts the 15 classes above; Quranic annotation marks are passthrough and are not predicted.

Held-out witness: abdou_test (self-report)

abdou_tashkeel's test split was never trained on by any model in this line, and it has no published leaderboard, so this is a self-report rather than a comparison. In the arm the package ships (centered, NFC):

MetricValue
DER10.23
DER (no case)7.77
WER10.69
text preservation0.9846

15,091 sentences / 1.54 M words, scripts/score_gate.py, word-level DER. The 4.5 M model reports 39.30 on the same witness in the single arm; those are different arms of two different models, not an arm-matched head-to-head.


Source code

The pipeline that produced this checkpoint is public:

https://github.com/ahmadmhmdsy/tashkeel-nano

It carries the model and tokenizer code, both published checkpoints, the configs that trained them, the config-driven dataset downloader (every corpus from its original host, with a per-source license gate), the preparation and tokenization steps, the training and checkpoint-soup scripts, the registered gate scorer, and both demos (Gradio and browser-only). The datasets themselves are not redistributed: scripts/download_data.py fetches them.

The registered tracker can be re-scored from the shipped weights with python scripts/score_gate.py --run models/nano1p1m --config training_config.yaml --decode centered --order nfc. Measured here: 11.50 % against the 11.51 % first published - the whole difference is argmax tie-flip between the original batch decode and the single-sequence decode, on byte-identical references (docs/evaluation.md).


Reproduction

SadeedDiac-25 scores: download the benchmark (Misraj/SadeedDiac-25, input/output columns), run each model's own published diacritize on the input column, then score with the benchmark authors' evaluator from misraj-ai/Sadeed (Eval_code.ipynb), gt_missing_diacritic_is_error=False. The mark-order-normalised variant rewrites each NFC geminate [base][vowel][shadda] to the benchmark's [base][shadda][vowel] before scoring.

benchmark        Misraj/SadeedDiac-25            (1200 paragraphs)
evaluator        misraj-ai/Sadeed Eval_code.ipynb (their own metric code)
1p1m predictions scratch/e104_pred_1p1m.json      (published package, centered decode)
4p5m predictions scratch/e104_pred_4p5m.json      (published package, as shipped)
scores           scratch/e104_sadeed_results.json

Registered-tracker numbers were produced with this project's scorer over identical splits, with references byte-identical across all runs.


Ancestor models

  • ahmadsy/tashkeel-nano-4p5m - the 4.49M model from the same line, also published. On SadeedDiac-25 with the benchmark's evaluator it scores DER (CE) 9.91 / WER (CE) 31.03, against 3.78 / 12.73 for this model.

License

Research-only; see LICENSE.

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

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

GPU в ailist

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

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

Архитектура tashkeel_nano неизвестна transformers в образе рантайма.

Класс архитектуры
DiacritizerModel
Ревизия весов
3c20311

0 моделей