This model card documents the fine-tuned PhoBERT baseline model for Vietnamese Hate Speech Detection (HSD) on social media content. It serves as an unaugmented empirical anchor in a comparative study evaluating data augmentation methodologies.
vi)vinai/phobert-baseThe model is designed for direct inference in text classification tasks aimed at identifying abusive and toxic content in Vietnamese social media. It predicts one of three mutually exclusive classes:
0 - CLEAN: Constructive, neutral, or non-toxic expressions.1 - OFFENSIVE: Profanity, vulgarities, or impolite expressions lacking structured intent to discriminate against protected groups.2 - HATE: Hostile expressions targeting individuals or collectives based on protected demographic attributes (e.g., ethnicity, regional background, religion, gender).This checkpoint can serve as a pre-trained feature extractor or baseline classifier for broader automated content moderation workflows and sociolinguistic toxicity analysis in Vietnamese digital spaces.
This model is not intended for:
Human moderators should remain in the loop for high-stakes enforcement. Systematic fairness and toxicity threshold tuning are recommended prior to live deployment.
PhoBERT processes inputs at the word level rather than subword characters directly; compound words must be joined by an underscore (_).
from transformers import pipeline
import pyvi
classifier = pipeline(
"text-classification",
model="AnoraLee/vietnamese-hsd-phobert-baseline",
tokenizer="AnoraLee/vietnamese-hsd-phobert-baseline"
)
raw_text = "Thời tiết hôm nay thật dễ chịu."
segmented_text = pyvi.ViTokenizer.tokenize(raw_text)
prediction = classifier(segmented_text)
print(prediction)
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import pyvi
MODEL_ID = "AnoraLee/vietnamese-hsd-phobert-baseline"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
text = "Thời tiết hôm nay thật dễ chịu."
text_segmented = pyvi.ViTokenizer.tokenize(text)
inputs = tokenizer(text_segmented, 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 dataset, which consolidates multiple benchmark Vietnamese hate speech corpora while systematically removing cross-split duplicate leakage and label conflicts.
All samples were normalized (teencode mapping, punctuation alignment) and segmented using syllable-level compound word boundary detection (VnCoreNLP).
vinai/phobert-base (12 layers, 768 hidden dimensions, 12 attention heads)weight_decay=0.01)BonTori/ViHatePhoBERT-TDTU.HATE).| Metric | Score |
|---|---|
| Test Accuracy | 91.74% |
| Test Macro F1 | 67.74% |
| Test Weighted F1 | 91.24% |
| Test Hate F1 (Class 2) | 62.23% |
| Test Loss | 0.3204 |
Sequence classification head stacked atop vinai/phobert-base pooled output, optimized via cross-entropy loss over 3 discrete target classes.