francesco-zatto/twitter-roberta-base-hate-freeze-embeddings-weighted-L-sexism-detector
018
RoBERTa Sexism Classifier (Freeze Embeddings / Weighted Loss)
This model is a fine-tuned version of cardiffnlp/twitter-roberta-base-hate, trained for multi-class sexism detection on the EXIST 2023 Task 2 dataset.
Experiment Details: freeze_embeddings
This repository contains the Freeze Embeddings variant of our ablation study.
- Frozen Embeddings: Only the base embedding layer (
model.roberta.embeddings.parameters()) was frozen during training. All subsequent transformer encoder layers and the classification head were fully fine-tuned. This allows the model to learn task-specific attention patterns while anchoring the fundamental word representations. - Weighted Loss: Because the EXIST 2023 dataset contains class imbalances, training was conducted using a weighted Cross-Entropy loss function. This ensures the model does not become heavily biased toward the majority class (e.g., Non-sexist) and adequately penalizes errors on the minority classes.
Intended Use
Categorizes English tweets into one of four sexist intentions:
-(Non-sexist)DIRECT(Directly sexist messages)JUDGEMENTAL(Messages condemning sexist behaviors)REPORTED(Messages reporting a sexist situation)
Preprocessing
Inputs must be preprocessed to match the CardiffNLP base model formatting. Note that this model is case-sensitive, so do not aggressively lowercase your text if you want to preserve capitalization signals:
- Replace user mentions (
@user) with the token@user - Replace URLs with the token
http
Evaluation Results (Test Set)
- Macro F1: 0.5508
- Precision: 0.5315
- Recall: 0.5924
How to Use
from transformers import AutoTokenizer, AutoModelForSequenceClassification
repo_id = "francesco-zatto/twitter-roberta-base-hate-freeze-embeddings-weighted-L-sexism-detector"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
inputs = tokenizer("Your cleaned tweet text here", return_tensors="pt")
outputs = model(**inputs)