~/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?
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
- datasets + purpose-built benchmarks
- Hugging Face classifier wrapper
- predictions + metrics per run
- fairness · robustness · calibration analyses
- 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


