vietnamese-toxicity
A Vietnamese toxicity classifier fine-tuned from
uitnlp/visobert (a Vietnamese-native, social-media
pretrained backbone). Single output label toxicity (binary, sigmoid).
v2 (current): fine-tuned from ViSoBERT (Vietnamese-native backbone). Outperforms v1 (fine-tuned from a general multilingual toxicity model) on every threshold — see evaluation below.
Usage
from transformers import pipeline
pipe = pipeline("text-classification", model="dangvansam/vietnamese-toxicity")
pipe("mày là thằng ngu")
# [{'label': 'toxicity', 'score': 0.99...}]
ONNX export available for faster CPU inference:
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("dangvansam/vietnamese-toxicity")
model = ORTModelForSequenceClassification.from_pretrained("dangvansam/vietnamese-toxicity")
Training data
- ViHSD — ~24k Vietnamese social-media comments, 3-class (clean/offensive/hate) collapsed to binary.
- ViCTSD — ~10k Vietnamese news-comment pairs with a binary toxicity label.
- A small set of clean, non-toxic domain questions added as hard negatives to reduce false positives on frustrated-but-non-toxic customer messages.
Combined and deduplicated: 34k training examples (5.4k toxic / ~28.8k clean).
Evaluation
Held-out test splits (never seen during training), combined threshold sweep:
| Threshold | Recall | Precision | FP rate |
|---|---|---|---|
| 0.3 | 0.86 | 0.56 | 0.13 |
| 0.5 | 0.81 | 0.62 | 0.10 |
| 0.7 | 0.74 | 0.68 | 0.07 |
| 0.9 | 0.63 | 0.78 | 0.03 |
Comparison against a v1 checkpoint (identical data/recipe, but fine-tuned from a general multilingual toxicity model instead of a Vietnamese-native backbone) at the same thresholds:
| Threshold | v1 recall/precision/FP | v2 recall/precision/FP |
|---|---|---|
| 0.5 | 0.70 / 0.52 / 0.13 | 0.81 / 0.62 / 0.10 |
| 0.7 | 0.60 / 0.60 / 0.08 | 0.74 / 0.68 / 0.07 |
| 0.9 | 0.43 / 0.73 / 0.03 | 0.63 / 0.78 / 0.03 |
Also compared against other publicly available Vietnamese hate-speech classifiers on the same held-out test data — this model matches or exceeds them on both source datasets, without any detectable train/test overlap (verified per-source, and against a small hand-written zero-leak probe set with unambiguous VN toxic/clean examples, on which this model scores 20/20).
Label schema
Output label is named toxicity (single label) — sufficient for detectors that take the max
score across a recognized-label allowlist rather than requiring a full multi-label taxonomy.
- Downloads last month
- 83
Model tree for dangvansam/vietnamese-toxicity
Base model
uitnlp/visobert