socsys commited on
Commit
919dad5
·
verified ·
1 Parent(s): 202be10

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +118 -3
README.md CHANGED
@@ -1,4 +1,119 @@
1
- # gbv-model-final
 
 
2
 
3
- Stage the remote GBV-classifier assets here before uploading to Hugging Face.
4
- Expected runtime repo id: `dhdc/gbv-model-final`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This repository contains the quantized ONNX export of an English language text classifier for detecting gender based violence (GBV) and GBV-subtype.
2
+ <br>The model predicts a binary label for GBV `pred_binary`: `0` (non-GBV), `1` (GBV).
3
+ <br>The model predicts one or more GBV subtypes `pred_category_labels`: `IDEOLOGICAL-INEQUALITY`, `STEREOTYPING-DOMINANCE`, `OBJECTIFICATION`, `SEXUAL-VIOLENCE`, `MISOGYNY-NON-SEXUAL-VIOLENCE`.
4
 
5
+ The model was developed for the Digital Harms, Democratic Costs (DHDC) browser extension. It is intended as a research classifier and content-analysis aid, not as a determination about a person or as a substitute for human review.
6
+
7
+ ## Model details
8
+ - **Base model:** [`NLP-LTU/bertweet-large-sexism-detector`](https://huggingface.co/NLP-LTU/bertweet-large-sexism-detector)
9
+ - **Architecture:** Bertweet based sexism model as encoder with separate binary and five-class multi-label classification heads.
10
+ - **Language:** English
11
+ - **Maximum input length:** 514 tokens (inherited from encoder)
12
+ - **Published format:** quantized ONNX, opset 17
13
+ - **Runtime target:** Transformers.js 2.17.2 with ONNX Runtime Web (WASM/CPU)
14
+ - **Repository ID:** `socsys/gbv-model`
15
+
16
+ ## Using Model
17
+
18
+ Python version = 3.12.3
19
+
20
+ pip install -r requirements.txt
21
+
22
+ Should declare environment variables (or use .env file) for
23
+
24
+ export TRAIN_DATA='/path/to/EXIST/training/data'
25
+ export VAL_PATH='/path/to/EXIST/dev/data'
26
+ export PROCESSED_DATA_DIR='/path/to/where/to/store/labelled/inference/data'
27
+
28
+ #### Train and validate model
29
+
30
+ python main.py --train
31
+ [--train_data_name] # Default to EXIST, currently code only written for EXIST
32
+ [--train_data_path] /path/to/train/data # To override environment variable
33
+ [--no_eval] # Does not perform evaluation of model after training
34
+
35
+
36
+ #### Use model for inference
37
+ Also runs validation automatically.
38
+
39
+ python main.py --infr --infr_data_path '/path/to/inf/data'
40
+ [--resume_infr] # if inference was interupted
41
+ [--no_eval] # Does not perform evaluation of model before inference
42
+
43
+ #### Export model for use in Chrome extension
44
+ Creates folder containing necessary config, tensor files etc, and subfolder containing quantized onnx model. Currently normalizes tensors to match expected format for extension. Can be commented out.
45
+
46
+ python main.py --export
47
+ [--output] # Output file if not intended to overright tokenizer.json
48
+ [--no_backup] # Skipping backing up of original tokenizer.json
49
+
50
+ ## Model Card
51
+
52
+ #### Model Details
53
+ Model developed by DHDC team at University of Surrey.
54
+ Model intended to detect gender based violence (GBV) and GBV subtype in text-based microblogging platform data (e.g. from Bluesky, X.com).
55
+ Multilabel multilevel classifier has a binary head (GBV) and a multiple category head (GBV subtype).
56
+ Uses [NLP-LTU/bertweet-large-sexism-detector on Huggingface](https://huggingface.co/NLP-LTU/bertweet-large-sexism-detector) as encoder layer.
57
+ Model is trained and validated on EXIST 2025 training data and evaluated on EXIST 2025 development data (test data is withheld for this task).
58
+
59
+ #### Intended Use
60
+ The model is intended for use in predicted GBV and GBV subtype for short spans of text. It is a monolingual English model. The intended users are researchers looking to estimate levels of GBV on the platform e.g. for a given set of users.
61
+
62
+ #### Factors
63
+ Random seed = 51
64
+ <br>The GBV subtypes from EXIST are: `IDEOLOGICAL-INEQUALITY`, `STEREOTYPING-DOMINANCE`, `OBJECTIFICATION`, `SEXUAL-VIOLENCE`, `MISOGYNY-NON-SEXUAL-VIOLENCE`.
65
+ <br>During training, model only learns GBV subtype classification from true examples of GBV.
66
+ <br>Both heads used focal loss, with γ = 2 to downweight easy examples.
67
+
68
+ #### Metrics
69
+ EXIST uses a custom ICM metric to evaluate performance, "punishing" binary GBV/Not GBV errors more than GBV subtype errors. Gold score = 2.15; best performing model = 0.65, 10th best performing model = 0.38.
70
+
71
+ #### Training and Evaluation Data
72
+ Encoder model trained on Gab (right-wing microblogging platform) and Reddit data; classifier trained on EXIST Twitter data.
73
+
74
+ EXIST training and evaluation data collected by searching Twitter for key terms related to GBV. Tweets collected 2021-2022. Tweets contain 5+ words.
75
+ Data labelled by human annotators. Six annotations per data point. Binary label for GBV applied for majority (4/6) label. Draws (3/6) dropped. Category labels applied if at least two annotators give label.
76
+
77
+ #### Quantitative Analyses
78
+ The model performs well at binary GBV identification. Binary F1 Score: 0.8614
79
+ <br>For subtypes, performance is above 0.63 for all subtypes except `MISOGYNY-NON-SEXUAL-VIOLENCE` where performance is poor (0.47).
80
+ <br>Subtype F1 Scores: `-` (no GBV): 0.88; `IDEOLOGICAL-INEQUALITY`: 0.64, `STEREOTYPING-DOMINANCE`: 0.66; `OBJECTIFICATION`: 0.69; `SEXUAL-VIOLENCE`: 0.67; `MISOGYNY-NON-SEXUAL-VIOLENCE`: 0.47
81
+ <br>Category Macro F1 Score: 0.6696
82
+ <br>Predicted ICM: 0.4823 (likely comparable to top 10 performance on test set for Plaza et al., 2025)
83
+
84
+ #### Ethical Considerations
85
+ Evaluated using hard labels. Hard (majority vote) labels may "suppress" minoritised voices. Annotation performed by expert annotators, 3 male, 3 female. If there is a perfect gender split in labels, example will be dropped, rather than "privileging" female expertise on GBV through lived experience.
86
+
87
+ #### Caveats
88
+ Given training data, likely model may underperform on posts using up-to-date slang etc, posts shorter than 5 words.
89
+ Trained on multiple microblogging platforms but may underperform on other platforms e.g. Bluesky.
90
+ <br>Only tested for English language, uses English language encoder model (though uses multilingual finetuning data as this improved performance).
91
+ <br>Likely fails to distinguish reports of GBV from instances of GBV as this remains challenging.
92
+ Prediction of `MISOGYNY-NON-SEXUAL-VIOLENCE` is very poor and label should be discarded.
93
+
94
+ ## License and attribution
95
+
96
+ This repository is released under the Attribution-NonCommercial-ShareAlike (CC BY-NC-SA). The upstream [`NLP-LTU/bertweet-large-sexism-detector`](https://huggingface.co/NLP-LTU/bertweet-large-sexism-detector) model does not provide license information.
97
+
98
+ The finetuning dataset EXIST (Plaza et al., 2025) stipulates that:
99
+ <ul>
100
+ <li> The dataset should only be used for scientific or research purposes. Any other use is explicitly prohibited. </li>
101
+ <li> The datasets must not be redistributed or shared in part or full to any third party. Redirect interested parties to this website. </li>
102
+ <li> All data released for these tasks are under the CC BY-SA 4.0 License (https://creativecommons.org/licenses/by-sa/4.0/legalcode). </li>
103
+ <li> Data must not be used for providing surveillance, analyses or research that isolates a group of individuals or any single individual for any unlawful or discriminatory purpose. </li>
104
+ </ul>
105
+
106
+ We inherit the stipulation against commercial use from this training data.
107
+
108
+ Our license for this model does not grant rights to third-party input data, platform content, personal data, trademarks, or generated outputs. Downstream users remain responsible for those rights and obligations.
109
+
110
+ ### Citations
111
+ The following are citations for the encoder model and finetuning data respectively.
112
+
113
+ ```bibtex
114
+ @inproceedings{Al-Azzawi_Kovács_Nilsson_Adewumi_Liwicki_2023, address={Toronto, Canada}, title={NLP-LTU at SemEval-2023 Task 10: The Impact of Data Augmentation and Semi-Supervised Learning Techniques on Text Classification Performance on an Imbalanced Dataset}, url={https://aclanthology.org/2023.semeval-1.196/}, DOI={10.18653/v1/2023.semeval-1.196}, booktitle={Proceedings of the 17th International Workshop on Semantic Evaluation (SemEval-2023)}, publisher={Association for Computational Linguistics}, author={Al-Azzawi, Sana and Kovács, György and Nilsson, Filip and Adewumi, Tosin and Liwicki, Marcus}, editor={Ojha, Atul Kr. and Doğruöz, A. Seza and Da San Martino, Giovanni and Tayyar Madabushi, Harish and Kumar, Ritesh and Sartori, Elisa}, year={2023}, month=july, pages={1421–1427} }
115
+
116
+
117
+ @article{Plaza_Carrillo-de-Albornoz_Arcos_Rosso_Spina_Amigó_Gonzalo_Morante_2025, address={Madrid, Spain}, title={Overview of EXIST 2025: Learning with Disagreement for Sexism Identification and Characterization in Tweets, Memes, and TikTok Videos (Extended Overview)}, journal={CLEF 2025 Working Notes}, author={Plaza, Laura and Carrillo-de-Albornoz, Jorge and Arcos, Iván and Rosso, Paolo and Spina, Damiano and Amigó, Enrique and Gonzalo, Julio and Morante, Roser}, year={2025}, month=sept, language={en} }
118
+
119
+ ```