Text Classification
Transformers
Safetensors
Arabic
bert
arabic
toxicity
hate-speech
cyberbullying
content-moderation
offensive-language
profanity
multi-dialect
arabic-nlp
MARBERTv2
Eval Results (legacy)
text-embeddings-inference
Instructions to use youssefreda9/HAYAA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use youssefreda9/HAYAA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="youssefreda9/HAYAA")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("youssefreda9/HAYAA") model = AutoModelForSequenceClassification.from_pretrained("youssefreda9/HAYAA", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -34,13 +34,13 @@ model-index:
|
|
| 34 |
split: test
|
| 35 |
metrics:
|
| 36 |
- type: accuracy
|
| 37 |
-
value: 0.
|
| 38 |
name: Accuracy
|
| 39 |
- type: f1
|
| 40 |
-
value: 0.
|
| 41 |
name: F1 (Toxic)
|
| 42 |
- type: f1
|
| 43 |
-
value: 0.
|
| 44 |
name: F1 (Safe)
|
| 45 |
---
|
| 46 |
|
|
@@ -57,22 +57,23 @@ Hayā is the core classifier in a larger **defense-in-depth content moderation s
|
|
| 57 |
|
| 58 |
### Key Highlights
|
| 59 |
|
| 60 |
-
- 🎯 **
|
| 61 |
- 🌍 **Every major Arabic dialect**: Egyptian, Levantine, Gulf, Maghrebi, Iraqi, Sudanese, MSA
|
| 62 |
-
- 📊 Trained on **
|
| 63 |
- ⚡ Optimized for real-time inference via serverless API (Modal + FastAPI)
|
|
|
|
| 64 |
|
| 65 |
---
|
| 66 |
|
| 67 |
## Performance
|
| 68 |
|
| 69 |
-
Evaluated on a **held-out test set of
|
| 70 |
|
| 71 |
| Metric | Score |
|
| 72 |
|--------|-------|
|
| 73 |
-
| **Accuracy** | **
|
| 74 |
-
| **F1 (Toxic)** | **
|
| 75 |
-
| **F1 (Safe)** | **
|
| 76 |
|
| 77 |
> **Note on the numbers:** Manual error analysis showed the model frequently *outperformed the original human annotations* — many counted "errors" were actually mislabels in the source datasets. Real-world performance on correctly-labeled data is therefore higher than the raw scores suggest.
|
| 78 |
|
|
@@ -162,9 +163,9 @@ for text, result in zip(texts, results):
|
|
| 162 |
|
| 163 |
### Training Data
|
| 164 |
- **Dataset**: [youssefreda9/HAYAA](https://huggingface.co/datasets/youssefreda9/HAYAA)
|
| 165 |
-
- **Training examples**: ~
|
| 166 |
-
- **Validation examples**: ~
|
| 167 |
-
- **Sources**:
|
| 168 |
- **Dialects**: All major Arabic dialects + MSA
|
| 169 |
|
| 170 |
### Hyperparameters
|
|
@@ -172,9 +173,9 @@ for text, result in zip(texts, results):
|
|
| 172 |
| Parameter | Value |
|
| 173 |
|-----------|-------|
|
| 174 |
| Max sequence length | 128 |
|
| 175 |
-
|
|
| 176 |
| Batch size | 16 (effective: 32 with gradient accumulation) |
|
| 177 |
-
| Learning rate | 2e-5 |
|
| 178 |
| Warmup ratio | 0.1 |
|
| 179 |
| Weight decay | 0.01 |
|
| 180 |
| FP16 | ✅ |
|
|
@@ -234,7 +235,7 @@ The full pipeline ships as a **Chrome Extension (Manifest V3)** with PIN-protect
|
|
| 234 |
## Limitations & Biases
|
| 235 |
|
| 236 |
- **Platform bias**: Training data is predominantly from Twitter; performance may vary on other platforms (forums, messaging apps, gaming chat).
|
| 237 |
-
- **Annotation noise**: Despite extensive cleaning, some label noise from the
|
| 238 |
- **Dialect imbalance**: Egyptian and MSA are better represented than Sudanese or Yemeni dialects.
|
| 239 |
- **Max length**: Sequences longer than 128 tokens are truncated, which may affect classification of very long texts.
|
| 240 |
- **Evolving language**: Arabic internet slang and evasion tactics evolve constantly; periodic retraining is recommended.
|
|
|
|
| 34 |
split: test
|
| 35 |
metrics:
|
| 36 |
- type: accuracy
|
| 37 |
+
value: 0.9784
|
| 38 |
name: Accuracy
|
| 39 |
- type: f1
|
| 40 |
+
value: 0.9412
|
| 41 |
name: F1 (Toxic)
|
| 42 |
- type: f1
|
| 43 |
+
value: 0.9845
|
| 44 |
name: F1 (Safe)
|
| 45 |
---
|
| 46 |
|
|
|
|
| 57 |
|
| 58 |
### Key Highlights
|
| 59 |
|
| 60 |
+
- 🎯 **97.84% accuracy** on a held-out test set of ~100K sentences
|
| 61 |
- 🌍 **Every major Arabic dialect**: Egyptian, Levantine, Gulf, Maghrebi, Iraqi, Sudanese, MSA
|
| 62 |
+
- 📊 Trained on **nearly 1 million examples (997K)** from 51 curated public Arabic datasets
|
| 63 |
- ⚡ Optimized for real-time inference via serverless API (Modal + FastAPI)
|
| 64 |
+
- 🧠 **V2 Update:** Enhanced with continued fine-tuning on 34K hard edge-cases to conquer implicit hate and subtle toxicity.
|
| 65 |
|
| 66 |
---
|
| 67 |
|
| 68 |
## Performance
|
| 69 |
|
| 70 |
+
Evaluated on a **held-out test set of 99,759 sentences** (stratified, zero data leakage):
|
| 71 |
|
| 72 |
| Metric | Score |
|
| 73 |
|--------|-------|
|
| 74 |
+
| **Accuracy** | **97.84%** |
|
| 75 |
+
| **F1 (Toxic)** | **94.12%** |
|
| 76 |
+
| **F1 (Safe)** | **98.45%** |
|
| 77 |
|
| 78 |
> **Note on the numbers:** Manual error analysis showed the model frequently *outperformed the original human annotations* — many counted "errors" were actually mislabels in the source datasets. Real-world performance on correctly-labeled data is therefore higher than the raw scores suggest.
|
| 79 |
|
|
|
|
| 163 |
|
| 164 |
### Training Data
|
| 165 |
- **Dataset**: [youssefreda9/HAYAA](https://huggingface.co/datasets/youssefreda9/HAYAA)
|
| 166 |
+
- **Training examples**: ~798K
|
| 167 |
+
- **Validation examples**: ~100K
|
| 168 |
+
- **Sources**: 51 curated public Arabic hate-speech and abuse datasets
|
| 169 |
- **Dialects**: All major Arabic dialects + MSA
|
| 170 |
|
| 171 |
### Hyperparameters
|
|
|
|
| 173 |
| Parameter | Value |
|
| 174 |
|-----------|-------|
|
| 175 |
| Max sequence length | 128 |
|
| 176 |
+
| Training Strategy | 2-Stage (4 epochs base corpus + 3 epochs hard edge-cases) |
|
| 177 |
| Batch size | 16 (effective: 32 with gradient accumulation) |
|
| 178 |
+
| Learning rate | 2e-5 (Stage 1), 5e-6 (Stage 2) |
|
| 179 |
| Warmup ratio | 0.1 |
|
| 180 |
| Weight decay | 0.01 |
|
| 181 |
| FP16 | ✅ |
|
|
|
|
| 235 |
## Limitations & Biases
|
| 236 |
|
| 237 |
- **Platform bias**: Training data is predominantly from Twitter; performance may vary on other platforms (forums, messaging apps, gaming chat).
|
| 238 |
+
- **Annotation noise**: Despite extensive cleaning, some label noise from the 51 original source datasets may persist.
|
| 239 |
- **Dialect imbalance**: Egyptian and MSA are better represented than Sudanese or Yemeni dialects.
|
| 240 |
- **Max length**: Sequences longer than 128 tokens are truncated, which may affect classification of very long texts.
|
| 241 |
- **Evolving language**: Arabic internet slang and evasion tactics evolve constantly; periodic retraining is recommended.
|