This model card documents the fine-tuned ViSoBERT baseline model for Vietnamese Hate Speech Detection on social networking platforms. It provides a non-segmented, social-media-specialized transformer baseline to benchmark against word-segmented models (e.g., PhoBERT) under identical experimental conditions.
vi)uitnlp/visobertThe model is utilized for categorizing unsegmented Vietnamese social comments and community posts into three toxicity levels:
0 - CLEAN: Civil and non-offensive statements.1 - OFFENSIVE: Profane, abrasive, or aggressive statements lacking targeted ideological hostility.2 - HATE: Discriminatory, demeaning, or hostile attacks directed against protected social identities.Direct integration into online comment filtering pipelines, content recommendation moderation modules, and sociological sentiment tracking systems.
sinh_viên), which disrupts SentencePiece subword tokenization.CLEAN text relative to OFFENSIVE and HATE classes creates inherent class imbalance challenges in extreme edge cases.Maintain regular evaluation against real-world drift, and apply decision threshold calibration depending on whether the operational requirement favors precision or recall.
ViSoBERT does not require word segmentation. Input strings should be passed in natural orthographic form.
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="AnoraLee/vietnamese-hsd-visobert-baseline",
tokenizer="AnoraLee/vietnamese-hsd-visobert-baseline"
)
text = "Hôm nay thời tiết thật là đẹp!"
prediction = classifier(text)
print(prediction)
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
MODEL_ID = "AnoraLee/vietnamese-hsd-visobert-baseline"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
text = "Hôm nay thời tiết thật là đẹp!"
inputs = tokenizer(text, return_tensors="pt", max_length=128, truncation=True)
with torch.no_grad():
logits = model(**inputs).logits
predicted_id = torch.argmax(logits, dim=-1).item()
print("Predicted Label:", model.config.id2label[predicted_id])
The model was fine-tuned on the standardized BonTori/ViHatePhoBERT-TDTU corpus.
CLEAN (0), OFFENSIVE (1), HATE (2)Compound word segmenting underscores were removed to restore standard whitespace conventions (text_segmented.replace("_", " ")), preserving normalized teencode transformations while ensuring compatibility with ViSoBERT's SentencePiece/BPE tokenizer.
uitnlp/visobert (XLM-RoBERTa architecture, Byte-level BPE vocabulary)weight_decay=0.01)BonTori/ViHatePhoBERT-TDTU.| Metric | Score |
|---|---|
| Test Accuracy | 91.11% |
| Test Macro F1 | 66.78% |
| Test Weighted F1 | 90.62% |
| Test Hate F1 (Class 2) | 59.55% |
| Test Loss | 0.3548 |
Sequence classification head stacked upon uitnlp/visobert, optimized via categorical cross-entropy loss across 3 output classes.