CoolFace
Datasetpublic

laskar-ks/toxic-guardrail-id-en

Toxic Guardrail ID/EN A normalized dataset for training a bilingual (Indonesian + English) toxicity severity classifier intended for use as an application guardrail. Several source datasets with incompatible label schemas are mapped onto a single ordinal severity scale. Curation runs through a deterministic TypeScript pipeline with a seeded PRNG, so the splits are reproducible rather than the output of an ad-hoc notebook. Rating scale rating meaning default… See the full description on the dataset page: https://huggingface.co/datasets/laskar-ks/toxic-guardrail-id-en.

sourceHugging Facecc-by-sa-3.0updated 13d agoView on Hugging Face
0likes102downloads
Dataset Card

Toxic Guardrail ID/EN

A normalized dataset for training a bilingual (Indonesian + English) toxicity severity classifier intended for use as an application guardrail. Several source datasets with incompatible label schemas are mapped onto a single ordinal severity scale.

Curation runs through a deterministic TypeScript pipeline with a seeded PRNG, so the splits are reproducible rather than the output of an ad-hoc notebook.

Rating scale

ratingmeaningdefault action
0safeallow
1borderline (not available — reserved)soft_warn
2toxic / abusive / obscenewarn
3targeted harassment / hatereview
4threat / severe toxicityblock

Rating 1 is deliberately empty: none of the source datasets annotate "mildly rude" as distinct from an actual attack. The slot is reserved so that adding it in v2 will not shift the meaning of ratings 2-4.

The label column holds the contiguous training index (0-3) required by cross-entropy; rating holds the public scale. Use label for training, rating for anything user-facing.

Columns

Human-sourced labels

These derive from the original datasets' annotations.

columntypedescription
textstringnormalized text (NFKC, zero-width stripped, URLs and mentions masked)
text_rawstringoriginal text before normalization
labelint64training index, 0-3
ratingint64public severity: 0, 2, 3, 4
languagestringid or en
sourcestringoriginating dataset, for per-source evaluation

Model-generated sentiment

These columns are not human annotations. They are the output of a sentiment model run over the text column, and carry that model's errors and biases. Treat them as a derived feature, not as ground truth.

columntypedescription
sentimentstringpredicted sentiment class
sentiment_scorefloat64confidence in the predicted class, 0-1
sentiment_polarityfloat64signed sentiment, −1 (negative) to +1 (positive)

Generated with `cardiffnlp/twitter-xlm-roberta-base-sentiment`, an XLM-RoBERTa model trained on ~198M tweets and fine-tuned for three-class sentiment. Classes: negative, neutral, positive. sentiment_score is the softmax probability of the predicted class; sentiment_polarity is p(positive) − p(negative).

Example row:

json
{
  "sentiment": "negative",
  "sentiment_score": 0.9233,
  "sentiment_polarity": -0.8983
}

Here p(negative) = 0.9233 and p(positive) = 0.0250, leaving p(neutral) = 0.0517.

Indonesian sentiment is itself zero-shot

The XLM-T sentiment models were fine-tuned on a specific set of languages, and Indonesian is not among them. Sentiment predictions on Indonesian rows therefore rest on cross-lingual transfer from XLM-RoBERTa's multilingual pretraining — the same mechanism this dataset's own severity ratings depend on, and the same one that demonstrably failed for Indonesian threat detection.

No Indonesian sentiment benchmark was run to check this. Until someone measures it, treat the sentiment columns on language == "id" rows as substantially less reliable than on English rows, and do not assume the two are comparable in quality.

The source model is also Twitter-domain. Jigsaw rows are Wikipedia talk-page comments — longer and more formal than the model's training distribution — which introduces a second, separate domain shift on the English side.

Sentiment is not toxicity

The two correlate but are not the same axis, and conflating them is the most likely way to misuse these columns.

textsentimentrating
filmnya jelek banget, buang-buang duitnegative0 — safe
anjir keren banget bropositive0 — safe
dasar goblok lunegative2 — abusive

Strong negative sentiment appears in ordinary criticism, and Indonesian profanity appears as positive-intensity filler. A classifier that treats sentiment_polarity as a proxy for toxicity will flag product complaints and miss casual profanity.

Where the columns may help is disambiguation rather than prediction: they give a second signal for cases where lexical toxicity markers and communicative intent diverge. Whether that actually improves a severity classifier is untested here.

Distribution (train)

langr0r2r3r4total
id6,7126,6480013,360
en6,94610,3528011,46619,565

Row counts are unchanged from the previous revision — the sentiment columns were added to existing rows, not accompanied by new data.

Methodology

  1. 1.Download raw files from each source repository
  2. 2.Map source labels onto the ordinal scale using a max-severity rule — when a row carries several labels, the heaviest one wins
  3. 3.Normalize text: NFKC, strip zero-width characters, mask URLs and mentions
  4. 4.Global deduplication before splitting, so near-identical rows cannot leak from train into test and inflate the reported scores
  5. 5.Downsample English so it does not overwhelm the Indonesian data
  6. 6.Stratified split on language × label with a fixed seed
  7. 7.Run cardiffnlp/twitter-xlm-roberta-base-sentiment over the normalized text column and attach the three sentiment fields

Step 7 runs after the split, over all three splits with the same model and settings. It does not influence how rows were assigned to splits.

Text normalization parity

Curation runs in TypeScript; inference runs in Python. clean_parity.json contains input/output pairs produced by the TypeScript implementation.

Verify your Python port against that file before training. A small divergence in text normalization produces train/serve skew that raises no error and shows up only as unexplained accuracy loss. The most likely source of divergence is \w in regular expressions: Unicode-aware in Python, ASCII-only in JavaScript. The Python port must pass re.ASCII.

Source datasets

`source`DatasetLanguageLicenseNotes
id_twitterhaipradana/indonesian-twitter-hate-speech-cleanedidapache-2.0Indonesian Twitter, binary labels. Severity granularity not available.
en_jigsawthesofakillers/jigsaw-toxic-comment-classification-challengeencc-by-sa-3.0Mirror of the Jigsaw Toxic Comment Challenge. Wikipedia talk page text.

Citing the original work

Ibrohim, M. O., & Budi, I. (2019). Multi-label Hate Speech and Abusive Language Detection in Indonesian Twitter. Proceedings of the Third Workshop on Abusive Language Online (ALW3), ACL.
Jigsaw / Conversation AI. Toxic Comment Classification Challenge. Kaggle, 2018. Text originates from Wikipedia talk page comments.

If you use this dataset, please cite the original sources above as well.

Limitations

  • —Rating 1 (borderline) is not available
  • —A single Indonesian source, binary-labeled, dominated by Twitter text
  • —The severity mapping is the author's interpretation, not a re-annotation
  • —Sentiment columns are model output, not annotation. Indonesian sentiment is zero-shot and unmeasured; English sentiment carries a Twitter-to-Wikipedia domain shift on the Jigsaw rows

Per-language limitations

The Indonesian source provides only binary labels (neutral / hate), so it contributes to ratings 0 and 2 only. Ratings 3 and 4 for Indonesian text depend entirely on cross-lingual transfer from the English data.

Predictions of rating 3-4 on Indonesian text have not been validated against Indonesian labeled data and should be treated as less reliable than the same predictions on English text. Report per-language evaluation separately rather than collapsing everything into one macro-F1 figure.

A model trained on this dataset (laskar-ks/toxic-guardrail-minilm-id-en) confirms this empirically: i will find you and kill your family is correctly rated 4, while the equivalent Indonesian threat is rated 2.

License

Released under CC BY-SA 3.0.

The dataset combines Apache-2.0 material (Indonesian source) with CC BY-SA 3.0 material (English source). Because the text was modified — Unicode NFKC normalization, URL and mention masking, whitespace collapsing — this is an adaptation rather than a collection, and CC BY-SA's share-alike requirement propagates to the combined work.

  • —Commercial use is permitted
  • —Attribution is required, to this dataset and to both original sources
  • —Derivatives must also be CC BY-SA 3.0 or a compatible later version
  • —The source column is retained per row, so you can filter to the Apache-2.0 subset if you need material without the share-alike obligation

Whether model weights trained on this data constitute a derivative work is an unsettled question and not one this card can answer. If that distinction matters for your use case, seek your own legal advice.