Instructions to use nahiar/hatespeech-abusive-xlm-roberta-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nahiar/hatespeech-abusive-xlm-roberta-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="nahiar/hatespeech-abusive-xlm-roberta-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("nahiar/hatespeech-abusive-xlm-roberta-v1") model = AutoModelForSequenceClassification.from_pretrained("nahiar/hatespeech-abusive-xlm-roberta-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("nahiar/hatespeech-abusive-xlm-roberta-v1")
model = AutoModelForSequenceClassification.from_pretrained("nahiar/hatespeech-abusive-xlm-roberta-v1", device_map="auto")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
pip install transformers torch
Single Prediction
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
[
{'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
HATESPEECH → Content that attacks or demeans a group based on identity
ABUSIVE → Insulting, offensive, or aggressive language without protected targets
📦 Batch Inference
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
@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
- Downloads last month
- 177
Model tree for nahiar/hatespeech-abusive-xlm-roberta-v1
Base model
FacebookAI/xlm-roberta-base
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="nahiar/hatespeech-abusive-xlm-roberta-v1")