Downloads ยท 30 days
47
55% of all-time downloads
alighabusaleh/SARF-MARBERTv2-Arabic-Sentiment
SARF-MARBERTv2-Arabic-Sentiment is a text classification model from alighabusaleh. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as cc-by-4.0.
๐ Try it live: Dialectal Arabic demos runs this model in your browser.
Downloads ยท 30 days
47
55% of all-time downloads
All-time downloads
85
Public
Parameters
168M
940 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors670 MB ยท 71%
From the Hugging Face model README
๐ Try it live: Dialectal Arabic demos runs this model in your browser.
SARF is a 3-class (negative / neutral / positive) sentiment classifier for dialectal Arabic. It reads each sentence in three morphological views: the normalized surface form, a light stem, and the consonantal root. All three go through one shared MARBERTv2 encoder and are fused with cross-attention.
This is the exact model behind the TTLab submission to the AraSentEval 2026 shared task (OSACT7 @ LREC 2026). It reached a macro-F1 of 0.9263 on the official test set and placed 2nd of 15 teams.
๐ Paper: TTLab at AraSentEval: SARF (ุตุฑู) Sentiment Analysis via Root-based Fusion for Multi-Dialectal Arabic ๐ป Code: github.com/aliabusaleh/ArabicSentimentAnalysis_AraSentEval_2026
| Developed by | Ali Abusaleh, Bhuvanesh Verma, Alexander Mehler (Text Technology Lab, Goethe University Frankfurt) |
| Model type | Multi-view BERT + cross-attention + CNN/LSTM classifier |
| Base model | UBC-NLP/MARBERTv2 |
| Language | Arabic: Egyptian, Saudi, Jordanian and Moroccan (Darija) dialects, plus MSA |
| Domain | Hotel / tourism reviews |
| Labels | 0: negative, 1: neutral, 2: positive |
| Parameters | ~167.5M |
โโ surface โโ โโ stem โโ โโ root โโ
sentence โโถโ normalize โ โโโโถ โ Snowballโ โโโโถ โTashaphyneโ
โโโโโโโฌโโโโโโ โโโโโฌโโโโโ โโโโโฌโโโโโ
โผ โผ โผ
MARBERTv2 โโโโ shared weights โโโ MARBERTv2 (ร3 passes)
โ H_s โ H_st โ H_r
โ โโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
โ โผ shared 8-head cross-attention (Q = H_s)
โ A_st = Attn(H_s, H_st), A_r = Attn(H_s, H_r)
โ โ
โ F = (H_s + A_st + A_r) / 3
โผ โผ
CNN (k=3,4,5 ร 200) on H_s LSTM (128) on F โ mean-pool
โโโโโโโโโ concat (728) โโโโโโโโโ
โผ
Dropout(0.3) โ Linear โ 3 classes
ArabicLightStemmer.get_root().The model ships custom code, so pass trust_remote_code=True. The
morphological preprocessing needs three small extra packages:
pip install torch transformers PyStemmer tashaphyne pyarabic
from transformers import AutoModel, AutoTokenizer
repo = "alighabusaleh/SARF-MARBERTv2-Arabic-Sentiment"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModel.from_pretrained(repo, trust_remote_code=True).eval()
texts = [
"ุงูููุฏู ูุงู ุฑุงุฆุน ูุงูุฎุฏู
ุฉ ู
ู
ุชุงุฒุฉ", # positive
"ุงูุบุฑูุฉ ูุงูุช ูุณุฎุฉ ูู
ุง ุนุฌุจุชูู", # negative
]
print(model.predict(texts, tokenizer))
# ['positive', 'negative']
print(model.predict(texts[0], tokenizer, return_probs=True))
# [{'label': 'positive', 'scores': {'negative': 7e-05, 'neutral': 7e-05, 'positive': 0.9999}}]
For custom batching, model.encode(texts, tokenizer) returns the six input
tensors: input_ids / attention_mask for the surface, stem and root views.
Pass them straight to model(**batch):
import torch
batch = model.encode(texts, tokenizer)
with torch.no_grad():
logits = model(**batch).logits
labels = [model.config.id2label[i] for i in logits.argmax(-1).tolist()]
โ ๏ธ Always pad to 128 tokens. The LSTM branch mean-pools over all 128 positions, including padding, exactly as in training.
encode()already pads tomax_length=128. If you tokenize yourself with dynamic padding, the predictions will differ from the reported results.
The released weights were checked against the original training checkpoint. They are bit-identical, and they reproduce the leaderboard submission exactly (312/312 test predictions match).
Training ran in two stages, with the same hyperparameters (found by a W&B sweep):
| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW, weight decay 0.02 |
| Learning rate | 1.24e-4 (stage 1), 1.24e-5 (stage 2) |
| Batch size | 128 |
| Max sequence length | 128 |
| CNN filters / kernels | 200 / {3, 4, 5} |
| LSTM hidden size | 128 (1 layer, unidirectional) |
| Dropout | 0.3 |
| Loss | Cross-entropy |
srinivasbilla/semeval-2016-absa-reviews-arabic).
Sentence-level labels, de-duplicated by sentence.| Split | Macro-F1 |
|---|---|
| AraSentEval 2026 official test set | 0.9263 (2nd / 15 teams) |
See the paper for the full results and analysis.
If you use this model, please cite our paper:
@inproceedings{abusaleh-etal-2026-ttlab,
title = "{TTL}ab at {A}ra{S}ent{E}val: {SARF}( ุตุฑู) Sentiment Analysis via Root-based Fusion for Multi-Dialectal {A}rabic",
author = "Abusaleh, Ali and
Verma, Bhuvanesh and
Mehler, Alexander",
editor = "Al-Khalifa, Hend and
El-Haj, Mo and
Ezzini, Saad",
booktitle = "The 7th Workshop on Open-Source {A}rabic Corpora and Processing Tools ({OSACT}7) with 5 Shared Tasks",
month = may,
year = "2026",
address = "Palma, Mallorca (Spain)",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2026.osact-1.35/",
doi = "10.63317/4wj6s3ys5osk",
pages = "262--268"
}
Please also cite MARBERT (Abdul-Mageed et al., ACL 2021), which SARF builds on.