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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- id
|
| 4 |
+
- ace
|
| 5 |
+
- ban
|
| 6 |
+
- bjn
|
| 7 |
+
- bug
|
| 8 |
+
- jav
|
| 9 |
+
- mad
|
| 10 |
+
- min
|
| 11 |
+
- sun
|
| 12 |
+
- bbc
|
| 13 |
+
- eng
|
| 14 |
+
library_name: transformers
|
| 15 |
+
pipeline_tag: text-classification
|
| 16 |
+
tags:
|
| 17 |
+
- text-classification
|
| 18 |
+
- hate-speech-detection
|
| 19 |
+
- abusive-language-detection
|
| 20 |
+
- multilabel-classification
|
| 21 |
+
- indonesian
|
| 22 |
+
- multilingual
|
| 23 |
+
- social-media
|
| 24 |
+
- natural-language-processing
|
| 25 |
+
- xlm-roberta
|
| 26 |
+
license: apache-2.0
|
| 27 |
+
metrics:
|
| 28 |
+
- accuracy
|
| 29 |
+
- f1
|
| 30 |
+
base_model:
|
| 31 |
+
- FacebookAI/xlm-roberta-base
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
# Hate Speech & Abusive Language Detection (Multilabel)
|
| 35 |
+
**Multilingual Indonesian & English โ XLM-RoBERTa**
|
| 36 |
+
|
| 37 |
+
This repository provides a fine-tuned **XLM-RoBERTa** model for **MULTILABEL HATE CONTENT DETECTION** in social media text.
|
| 38 |
+
The model is designed to identify **Hate Speech** and **Abusive Language** simultaneously across **Indonesian**, **regional Indonesian languages**, and **English**, particularly in noisy and informal online conversations.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## ๐ Highlights
|
| 43 |
+
|
| 44 |
+
- Multilabel classification: **Hate Speech** & **Abusive Language**
|
| 45 |
+
- Supports overlapping labels in a single text
|
| 46 |
+
- Multilingual (Indonesia + English)
|
| 47 |
+
- Robust on informal and user-generated content
|
| 48 |
+
- Ready-to-use with Hugging Face `pipeline`
|
| 49 |
+
- Suitable for content moderation and safety systems
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## ๐ Supported Languages
|
| 54 |
+
|
| 55 |
+
- ๐ฎ๐ฉ Bahasa Indonesia
|
| 56 |
+
- Bahasa Melayu
|
| 57 |
+
- Indonesian regional languages (Aceh, Banjar, Bugis, Jawa, Madura, Minang, Sunda, dll.)
|
| 58 |
+
- ๐ฌ๐ง English
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## ๐ Model Performance
|
| 63 |
+
|
| 64 |
+
> Performance metrics are reported on a held-out validation set.
|
| 65 |
+
|
| 66 |
+
| Metric | Score |
|
| 67 |
+
|-----------------|--------|
|
| 68 |
+
| Precision | 0.9249 |
|
| 69 |
+
| Recal | 0.9300 |
|
| 70 |
+
| F1 (Macro) | 0.9274 |
|
| 71 |
+
| F1 (Weighted) | 0.9269 |
|
| 72 |
+
| Training Loss | 0.1181 |
|
| 73 |
+
| Validation Loss | 0.2070 |
|
| 74 |
+
|
| 75 |
+
*(Exact scores may vary depending on evaluation split and threshold.)*
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
## โ๏ธ Usage
|
| 80 |
+
|
| 81 |
+
### Installation
|
| 82 |
+
```bash
|
| 83 |
+
pip install transformers torch
|
| 84 |
+
````
|
| 85 |
+
|
| 86 |
+
### Single Prediction
|
| 87 |
+
|
| 88 |
+
```python
|
| 89 |
+
from transformers import pipeline
|
| 90 |
+
|
| 91 |
+
classifier = pipeline(
|
| 92 |
+
task="text-classification",
|
| 93 |
+
model="nahiar/hatespeech-abusive-xlm-roberta-v1",
|
| 94 |
+
return_all_scores=True
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
result = classifier("Dasar bodoh, otak udang!")
|
| 98 |
+
print(result)
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
**Output**
|
| 102 |
+
|
| 103 |
+
```text
|
| 104 |
+
[
|
| 105 |
+
{'label': 'HATESPEECH', 'score': 0.9123},
|
| 106 |
+
{'label': 'ABUSIVE', 'score': 0.9841}
|
| 107 |
+
]
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
> Because this is a **multilabel model**, more than one label can be active for a single input.
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## ๐ท๏ธ Label Definitions
|
| 115 |
+
|
| 116 |
+
```text
|
| 117 |
+
HATESPEECH โ Content that attacks or demeans a group based on identity
|
| 118 |
+
ABUSIVE โ Insulting, offensive, or aggressive language without protected targets
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
---
|
| 122 |
+
|
| 123 |
+
## ๐ฆ Batch Inference
|
| 124 |
+
|
| 125 |
+
```python
|
| 126 |
+
texts = [
|
| 127 |
+
"Dasar kaum ini selalu bikin rusuh",
|
| 128 |
+
"Kamu memang bodoh dan tidak berguna",
|
| 129 |
+
"Saya tidak setuju dengan pendapat kamu"
|
| 130 |
+
]
|
| 131 |
+
|
| 132 |
+
results = classifier(texts)
|
| 133 |
+
|
| 134 |
+
for text, preds in zip(texts, results):
|
| 135 |
+
labels = [(p["label"], round(p["score"], 4)) for p in preds]
|
| 136 |
+
print(text, "โ", labels)
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
---
|
| 140 |
+
|
| 141 |
+
## ๐๏ธ Training Configuration
|
| 142 |
+
|
| 143 |
+
| Parameter | Value |
|
| 144 |
+
| ----------------- | ------------------------- |
|
| 145 |
+
| Base Model | xlm-roberta-base |
|
| 146 |
+
| Task Type | Multilabel Classification |
|
| 147 |
+
| Training Strategy | Fine-tuning |
|
| 148 |
+
| Epochs | Multiple |
|
| 149 |
+
| Learning Rate | 2e-5 |
|
| 150 |
+
| Batch Size | 16 |
|
| 151 |
+
| Training Date | 2025-12-18 |
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
+
|
| 155 |
+
## ๐ฏ Intended Use
|
| 156 |
+
|
| 157 |
+
* Hate speech & abusive language moderation
|
| 158 |
+
* Content safety and compliance systems
|
| 159 |
+
* Social media monitoring dashboards
|
| 160 |
+
* Pre-filtering before sentiment or topic analysis
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## โ ๏ธ Limitations
|
| 165 |
+
|
| 166 |
+
* Limited to **Hate Speech** and **Abusive Language** labels
|
| 167 |
+
* Does not identify specific hate targets or protected attributes
|
| 168 |
+
* Context-dependent sarcasm may be misclassified
|
| 169 |
+
* Not suitable for legal or policy enforcement without human review
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## ๐ License
|
| 174 |
+
|
| 175 |
+
This model is released under the **Apache License 2.0**
|
| 176 |
+
Free for research and commercial use.
|
| 177 |
+
|
| 178 |
+
---
|
| 179 |
+
|
| 180 |
+
## ๐ Citation
|
| 181 |
+
|
| 182 |
+
```bibtex
|
| 183 |
+
@misc{djunaedi2025hatespeech_multilabel,
|
| 184 |
+
author = {Raihan Hidayatulloh Djunaedi},
|
| 185 |
+
title = {Multilabel Hate Speech and Abusive Language Detection for Social Media Text},
|
| 186 |
+
year = {2025},
|
| 187 |
+
publisher = {Hugging Face},
|
| 188 |
+
url = {https://huggingface.co/nahiar/hatespeech-xlmr-v4}
|
| 189 |
+
}
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
---
|
| 193 |
+
|
| 194 |
+
## ๐ Acknowledgements
|
| 195 |
+
|
| 196 |
+
* Hugging Face Transformers
|
| 197 |
+
* Facebook AI Research โ XLM-RoBERTa
|