A compact DeBERTa-v2 encoder pre-trained from scratch on Algerian text — Darja (dialect), Arabizi (Arabic in Latin script), French, Modern Standard Arabic, and the heavy code-switching that real Algerians actually write.
algerianDeBERTa is a ~60M-parameter masked language model built specifically for the Algerian linguistic space. It was trained on a custom Algerian corpus with a purpose-built tokenizer, and is designed to be a small, fast, fine-tunable backbone for downstream Algerian NLP tasks (sentiment, intent, classification, retrieval, NER).
Headline: it matches ~96–98% of DziriBERT's macro-F1 on Algerian sentiment benchmarks while using ≈ half the parameters and half the memory (231 MB vs 475 MB).
Why another Algerian model?
Algerian is a genuinely hard, low-resource setting:
Three+ languages in one sentence — Arabic, French and Tamazight vocabulary mixed freely.
Two scripts — the same word is written in Arabic letters and in Latin "Arabizi" (e.g. wach rak / واش راك), often with digits standing in for sounds (3 = ع, 7 = ح, 9 = ق).
No standard orthography — spelling is phonetic and varies per writer and per region.
General multilingual models and even MSA-centric Arabic models underperform here. algerianDeBERTa tackles this with (1) a tokenizer learned directly on Algerian text and (2) DeBERTa-v2's disentangled attention, which is strong at modeling the messy, non-canonical token order of dialectal writing — all in a deliberately small footprint.
≈ 60M parameters · 231 MB (fp32) — about half of DziriBERT
Tokenizer
Custom fast tokenizer, 30k vocab, trained on Algerian Darja/Arabizi/French
Languages
Algerian Darja, Arabizi, French, MSA, code-switched
Objective
Masked Language Modeling (MLM), trained from scratch
Best for
Fine-tuning on Algerian classification / retrieval / token tasks
Performance vs DziriBERT
DziriBERT is the reference Transformer for Algerian dialect and the prior state of the art on Algerian text classification (it beats mBERT, AraBERT, CAMeLBERT, QARiB and MARBERT on these tasks). It is the right yardstick.
Both models were fine-tuned identically (same heads, same hyper-parameters , LR 2e-5, max length 128, seed 42, 85/15 split) on three Algerian sentiment datasets, and compared on macro-F1:
Macro-F1 comparison
Dataset
DziriBERT (~124M)
algerianDeBERTa (~60M)
Retained
Herouini
0.819
0.785
95.8%
DzSentiA
0.877
0.859
97.9%
AbdouYT
0.790
0.764
96.7%
DziriBERT keeps a small edge in raw macro-F1 (≈ 2–3 points), which is expected from a model with roughly twice the parameters. The point of algerianDeBERTa is the trade-off: near-parity quality at half the size.
Memory footprint
Memory footprint
Model
Parameters
On-disk (fp32)
algerianDeBERTa
≈ 60M
231 MB
DziriBERT
≈ 124M
475 MB
That ~51% reduction in size means lower memory, faster inference, and cheaper fine-tuning — useful for edge deployment and for stacking the model into multi-stage pipelines.
1import torch
2from transformers import AutoTokenizer, AutoModel
34tok = AutoTokenizer.from_pretrained("81melody/algerianDeBERTa")5model = AutoModel.from_pretrained("81melody/algerianDeBERTa")67text ="نحب نشري دار في وهران"8inputs = tok(text, return_tensors="pt")9with torch.no_grad():10 out = model(**inputs)11# CLS / pooled representation12cls = out.last_hidden_state[:,0]13print(cls.shape)# (1, 512)
Fine-tune for classification
python
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
23tok = AutoTokenizer.from_pretrained("81melody/algerianDeBERTa")4model = AutoModelForSequenceClassification.from_pretrained(5"81melody/algerianDeBERTa", num_labels=36)7# then train with transformers.Trainer on your Algerian dataset
Pre-trained from scratch on a custom Algerian corpus (~115 MB of cleaned text) assembled from public Algerian web and social-media content, including ~45k YouTube comments. The corpus deliberately spans the full Algerian register:
Algerian Darja in Arabic script
Arabizi (Latin-script Algerian with digit substitutions)
French and French↔Arabic code-switching
some Modern Standard Arabic
Text was cleaned and normalized (deduplication, noise/boilerplate removal) before training. The tokenizer was trained on this same corpus so that frequent Darja/Arabizi sub-words get dedicated tokens instead of being shattered into bytes.
Procedure
Setting
Value
Objective
Masked Language Modeling
Epochs
2 (best checkpoint at ~1.7 epochs / 7,000 steps)
Batch size
16
Peak learning rate
3e-5 (with warmup)
Final held-out MLM loss
3.40
Framework
🤗 Transformers
Pretraining loss
The held-out masked-LM loss decreases steadily over training, from ~3.46 to 3.40.