← cd ~/work

~/work/fairness-robustness/README.md

Fairness & Robustness in Risk Detection Models

My MSc dissertation. Do toxicity classifiers fail differently depending on who is being targeted?

role
Author · MSc dissertation, Trinity College Dublin
year
2026
stack
Python · PyTorch · Hugging Face · scikit-learn · SHAP
status
complete

Problem

Automated moderation decides what gets seen online. Toxicity classifiers are usually tested for fairness or for robustness to rewording, rarely both, so nobody checks whether the people they protect least are also the easiest to attack.

Approach

  • A config-driven pipeline. Every experiment is a YAML file, and every run is saved with its exact config, predictions and metrics, so any number in the dissertation traces back to a run.
  • Four open-source classifiers (IBM Granite Guardian HAP-38M, RoBERTa-Toxicity, Detoxify-Unbiased, Toxic-BERT) across six datasets, including CivilComments-WILDS, HateCheck, HateXplain and ToxiGen.
  • Purpose-built benchmarks to isolate failure modes: counterfactual identity swaps, semantic and jailbreak attacks, leetspeak, over-refusal on benign identity-related text, and target masking.
  • Proper statistics: bootstrap confidence intervals, permutation tests, Benjamini–Hochberg correction and effect sizes, plus a human annotation study of about 1,040 paraphrase pairs.
  • Interpretability: SHAP token attributions show identity terms among the top drivers of false positives.

A note on reading the numbers

Some groups show a 0% bypass rate. That is not good news: the original, undisguised attacks on those groups were never flagged in the first place, so there was nothing to bypass. The explorer on the home page marks those groups as n/a rather than 0%.

~/architecture

  1. datasets + purpose-built benchmarks
  2. Hugging Face classifier wrapper
  3. predictions + metrics per run
  4. fairness · robustness · calibration analyses
  5. figures + tables

~/results

91.7%
attack bypass against Muslims for HAP-38M and Toxic-BERT; rates vary sharply by targeted group
7.8–26.3%
swap-test inconsistency across the four models
−63.8%
RoBERTa-Tox's false-positive gap at a 0.95 threshold, for 0.006 F1
≈ 0
correlation between paraphrase robustness and adversarial robustness: one is not a proxy for the other

~/figures

Semantic attack bypass rate by targeted group
Semantic attack bypass rate by targeted group
Jailbreak bypass rate by model and target group
Jailbreak bypass rate by model and target group
Calibration error varies by dataset for the same model
Calibration error varies by dataset for the same model

Ask Leah

an assistant that only answers from what's on this site · it can be wrong