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