AnoraLee/vietnamese-hsd-phobert-combined is a fine-tuned vinai/phobert-base model for 3-class Vietnamese Hate Speech Detection (CLEAN, OFFENSIVE, HATE) on social media text.
This checkpoint is trained on the combined augmented dataset (merging original training data with Back-Translation, EDA, and LLM synthetic augmentations from Gemma & Qwen, deduplicated and conflict-filtered). Among all PhoBERT experiments in the benchmark, phobert_combined achieves the highest HATE F1 (58.0%), improving by +4.2% over phobert_baseline.
| ID | Label | Description |
|---|---|---|
0 |
CLEAN |
Normal, non-toxic Vietnamese text |
1 |
OFFENSIVE |
Profanity, vulgarity, or rude language without targeted hate |
2 |
HATE |
Hate speech, harassment, dehumanization, or targeted attacks |
Evaluated on the frozen tdtu_test set (6,576 samples; validation set: 2,650 samples):
| Model | Strategy | Accuracy | Macro F1 | Weighted F1 | HATE F1 |
|---|---|---|---|---|---|
phobert_baseline |
Original unaugmented | 84.4% | 60.2% | 84.7% | 53.8% |
phobert_bt |
+ Back-translation (vi → en → vi) |
83.0% | 44.5% | 79.8% | 42.7% |
phobert_eda |
+ Easy Data Augmentation | 78.4% | 58.3% | 81.3% | 56.5% |
phobert_llm |
+ LLM synthesis (Gemma, Qwen) | 83.5% | 60.9% | 84.5% | 56.1% |
phobert_combined |
Combined augmentation (BT + EDA + LLM) | 78.0% | 57.3% | 80.7% | 58.0% |
0.5513CLEAN comments, combining multiple augmentation strategies intentionally trades off a small drop in overall accuracy to maximize sensitivity and F1 on the minority HATE class (+4.2% HATE F1 over phobert_baseline).Important: PhoBERT requires Vietnamese word segmentation (compound words joined with
_, e.g.,cảm_ơn,xã_hội) before tokenization, and uses the slow tokenizer (use_fast=False). Useundertheseaorpy_vncorenlpto segment input text first.
underthesea + transformers pipelinefrom underthesea import word_tokenize
from transformers import AutoTokenizer, pipeline
model_id = "AnoraLee/vietnamese-hsd-phobert-combined"
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)
classifier = pipeline(
"text-classification",
model=model_id,
tokenizer=tokenizer,
max_length=128,
truncation=True,
)
raw_texts = [
"Bài viết chia sẻ rất hữu ích, cảm ơn tác giả!",
"Thứ rác rưởi, cút khỏi mạng xã hội đi.",
]
segmented_texts = [word_tokenize(t, format="text") for t in raw_texts]
print(classifier(segmented_texts))
import torch
from underthesea import word_tokenize
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model_id = "AnoraLee/vietnamese-hsd-phobert-combined"
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()
raw_text = "Nói chuyện kiểu gì mà vô duyên thế không biết."
segmented_text = word_tokenize(raw_text, format="text")
inputs = tokenizer(segmented_text, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.softmax(logits, dim=-1).squeeze()
pred_id = torch.argmax(probs).item()
print(f"Label: {model.config.id2label[pred_id]} ({probs[pred_id]:.4f})")
vinai/phobert-basecombined_bt_eda_llm (140,914 samples from ViHSD, VOZ, YouTube, Back-Translation, EDA, and LLM synthesis; word-segmented)128learning_rate: 2e-5per_device_train_batch_size: 16weight_decay: 0.01fp16: Trueseed: 42EarlyStoppingCallback(patience=2) with load_best_model_at_end=True (metric_for_best_model="macro_f1"), stopping at Epoch 3 and restoring the best checkpoint._) or comes from formal domains outside social media.HATE speech, which can slightly increase false positives on borderline CLEAN / sarcastic sentences.Developed by researchers at the Faculty of Information Technology, Ton Duc Thang University (TDTU).
Distributed under the Apache License 2.0.
vinai/phobert-base