This repository contains our implementation for SemEval 2026 Task 9 (POLARDETECT). The system is designed around an AJT workflow:
- Augment: generate synthetic training samples.
- Judge: filter generated samples by quality.
- Train: train ST1 classifiers for English and Hausa.
- Ensemble: combine model probabilities with weighted soft voting.
Current implementation focus:
- ST1 (binary polarization classification) for English and Hausa.
- Augmentation for:
- English ST1 (
label 0andlabel 1generation). - Hausa ST2-style multi-label augmentation used for downstream ST1 training mix.
- English ST1 (
- Weighted ensemble based on paper configuration (Table 4 style weights).
Reported in paper draft:
- Hausa: rank 1, Macro-F1 0.8336
- English: Top 10, Macro-F1 0.8092
dataset/
subtask1/
subtask2/
augmentation/
english/
hausa/
augmentation/
augmentEnglish.py
augmentHausa.py
training/
training.py
llmfinetunehausa.py
ensemble/
ensemble.py
result/
public/
eng/
hau/
ensemble/
eng/
hau/
src/
augmentation/
data/
training/
utils/
tests/
- Python 3.10+ (tested with Python 3.13)
- Install dependencies:
pip install -r requirements.txtdataset/subtask1/train/eng.csvdataset/subtask1/dev/eng.csvdataset/subtask1/test/eng.csvdataset/subtask1/train/hau.csvdataset/subtask1/dev/hau.csvdataset/subtask1/test/hau.csv
dataset/subtask2/train/hau.csv
- ST1 columns:
id, text, polarization - ST2 columns:
id, text, political, racial/ethnic, religious, gender/sexual, other
Generate label-0 or label-1 augmented data:
python augmentation/augmentEnglish.py --label 0
python augmentation/augmentEnglish.py --label 1Default outputs:
dataset/augmentation/english/augmented_data_label0.csvdataset/augmentation/english/augmented_data_label1.csv- Judge score files are saved with suffix
_judge_scores.csv
python augmentation/augmentHausa.pyDefault output:
dataset/augmentation/hausa/df_3.csv- Judge score file:
dataset/augmentation/hausa/df_3_judge_scores.csv
Train ST1 model and automatically export prediction CSV files for both dev and test.
python training/training.py --lang engpython training/training.py --lang hauWhat training writes:
- Model directory:
outputs/train/eng/final_modeloutputs/train/hau/final_model
- Prediction artifacts:
result/public/eng/pred_eng_dev.csvresult/public/eng/pred_eng_dev_probs.csvresult/public/eng/pred_eng.csvresult/public/eng/pred_eng_probs.csvresult/public/hau/pred_hau_dev.csvresult/public/hau/pred_hau_dev_probs.csvresult/public/hau/pred_hau.csvresult/public/hau/pred_hau_probs.csv
Run weighted soft voting:
python ensemble/ensemble.py --lang eng
python ensemble/ensemble.py --lang hauDefault ensemble inputs:
- English uses:
result/public/eng/llm_500_full.csvresult/public/eng/llm_850.csvresult/public/eng/llm_fulldata.csvresult/public/eng/rbase-300-full1.csvresult/public/eng/rbase-fulldata.csv
- Hausa uses:
result/public/hau/df_1.csvresult/public/hau/df_2.csvresult/public/hau/df_3.csvresult/public/hau/original.csv
Default ensemble outputs:
result/ensemble/eng/pred_eng_ensemble.csvresult/ensemble/eng/pred_eng_ensemble_prob.csvresult/ensemble/hau/pred_hau_ensemble.csvresult/ensemble/hau/pred_hau_ensemble_prob.csv
Soft-voting probability:
P_ens = (sum_i w_i * P_i) / (sum_i w_i)
Decision rule:
- predict
1ifP_ens >= 0.5 - else predict
0
Paper-style weights in current code:
- Hausa:
[0.20, 0.20, 0.30, 0.30] - English:
[0.40, 0.25, 0.10, 0.15, 0.10]
QLoRA entrypoint:
python training/llmfinetunehausa.py --lang hau --hf_token <YOUR_HF_TOKEN>Note: this path requires peft and suitable GPU setup.
Run all unit tests:
python -m unittest discover -s tests -p "test_*.py"No module named 'google'
- Install
google-generativeaiand ensure environment is active.
- Gemini call failed in augmentation/judge
- Ensure
GEMINI_API_KEYis set in environment or.env.
- Missing ensemble input files
- Verify all expected CSV files exist under
result/public/engorresult/public/hau.

