🌍 Multilingual Spam Analysis for Social Media
Indonesian 🇮🇩 | English | Multilabel | IndoBERT Base P1
A fine-tuned xlm-roberta-base model for Spam Analysis on noisy social media text.
This model is optimized for multilingual informal content commonly found on:
- Twitter / X
- Instagram
- TikTok
- Facebook
- Online forums
It supports Bahasa Indonesia, English, Arabic, Portugues, and many language making it suitable for moderation systems, social listening, and content intelligence pipelines.
🔍 Model Overview
- Architecture:
FacebookAI/xlm-roberta-base
- Task: Text Classification (Spam Analysis)
- Languages: Indonesian, English, Arabic, Portugues, etc
- Domain: Informal & Social Media Text
- Training Date: 2026-03-05
🏷️ Supported Emotion Labels
This model detects the following emotion types:
| Label | Description |
|---|
| LABEL_0 | Ham (Not Spam) |
| LABEL_1 | Spam |
📊 Model Performance
Evaluated on held-out validation dataset:
| Metric | Score |
|---|
| F1 Score | 0.96 |
| Precision | 0.96 |
| Recall | 0.96 |
| Training Loss | 0.082100 |
| Validation Loss | 0.202610 |
🏗️ Training Configuration
| Parameter | Value |
|---|
| Base Model | xlm-roberta-base |
| Training Samples | 77,456 |
| Epochs | 3 |
| Learning Rate | 2e-5 |
| Batch Size | 16 (train), 32 (eval) |
| Optimizer | AdamW |
| Framework | Hugging Face Transformers |
🚀 Usage
Preprocessing Configuration
1import re
2
3def clean_text(text):
4 if not isinstance(text, str):
5 return text
6 text = text.replace("#", "")
7 text = re.sub(r"https?://\S+|www\.\S+", "<link>", text)
8 text = re.sub(r"\b[\w\.-]+@[\w\.-]+\.\w+\b", "<email>", text)
9 text = re.sub(r"@\w+", "<user>", text)
10 text = text.replace('"', "").replace("'", "")
11 text = text.replace("\n", " ")
12 text = text.replace("\\n", " ")
13 text = re.sub(r"\s+", " ", text).strip()
14
15 return text
Quick Inference (Single Text)
1from transformers import pipeline
2import torch
3clf = pipeline(
4 "text-classification",
5 model="HuggingFace/Model/Path",
6 tokenizer="HuggingFace/Model/Path",
7 device=0 if torch.cuda.is_available() else -1
8)
9
10
11text = """
12Gran película, pero el final sí está en otra categoría. El mejor final que vi este año, y ese le va a dar todos los premios. Irán tiene historias bien poderosas, esta vale muchísimo la pena, y creo que recién llegó a cines. #itwasjustanaccident #iran #cine #jafarpanahi
13"""
14
15text = clean_text(text)
16print(text)
17print(clf(text))
Quick Inference (Batch Size)
1from transformers import pipeline
2import torch
3clf = pipeline(
4 "text-classification",
5 model="HuggingFace/Model/Path",
6 tokenizer="HuggingFace/Model/Path",
7 device=0 if torch.cuda.is_available() else -1
8)
9
10batch_size = 32
11results = []
12
13texts = [
14 "اللحظة التي توقف فيها البث! 😱 صاروخ يصيب استديو الإيرانية وهي تقدم الخبر! شاهد ما حدث في الثواني الأخيرة! 👇🔥 #إيران | #طهران | #عاجل | #اكسبلور | #fyp إيران | طهران | انفجار | قصف | مذيعة | أخبار عاجلة | بوز | روينة | تصعيد | 2026 | فيديو صادم | امير_ | Iran | Tehran | Attack",
15 "ตึงเครียด! IRGC ยิงขีปนาวุธใส่เรือ USS Abraham Lincoln ของสหรัฐฯ",
16 "#HubunganBilateral #Indonesia #Brasil #BeritaTerkini #InformasiPublik #BergerakBerdampak #SetahunBerdampak https://t.co/9aGPb5ACIo",
17 "Gran película, pero el final sí está en otra categoría. El mejor final que vi este año, y ese le va a dar todos los premios. Irán tiene historias bien poderosas, esta vale muchísimo la pena, y creo que recién llegó a cines. #itwasjustanaccident #iran #cine #jafarpanahi"
18]
19
20for i in range(0, len(texts), batch_size):
21 batch = texts[i:i+batch_size]
22 preds = clf(
23 batch,
24 truncation=True
25 )
26 results.extend(preds)
27
28labels = [
29 1 if p["label"] in ["LABEL_1", "spam"] else 0
30 for p in results
31]
32
33output = [
34 {"text": t, "spam": l}
35 for t, l in zip(texts, labels)
36]
37print(output)
38
🎯 Intended Use Cases
- Social media spam analysis
- Comment & post filtering
- Content moderation assistance
- Political monitoring
- Brand & organization tracking
- Multilingual content intelligence systems
⚠️ Limitations
- Supports only the defined emotion labels set:
labels = ['ham', 'spam']
- Not optimized for:
- Formal academic/legal documents
- Extremely short or ambiguous messages
- Heavy slang or sarcastic expressions
- Performance may degrade on highly code-mixed sentences
- The model may inherit bias from training data
⚖️ Ethical Considerations
This model may reflect demographic, geopolitical, or cultural biases present in the training dataset.
It is not intended to replace human judgment in high-risk or sensitive decision-making systems.
Human-in-the-loop review is strongly recommended for moderation or governance-related deployments.
🖥️ Hardware Recommendations
- Recommended: GPU (≥ 8GB VRAM) for optimal performance
- CPU inference supported but slower
- Compatible with FP16 mixed precision for faster inference
📜 License
Released under the Apache 2.0 License.
Free for commercial and research use.
📚 Citation
1@misc{purba2026multilingualspamanalysis,
2 author = {M. Iqbal Purba},
3 title = {Multilabel Emotion Analysis for Social Media},
4 year = {2026},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/iqbalpurba26/dev-emot-indobert}
7}
🙌 Acknowledgements
- Hugging Face Transformers
- Facebook AI Research — XLM-RoBERTa
- Open-source NLP community
- Contributors and dataset annotators