This directory contains a flexible, configuration-driven training pipeline for multilingual toxicity detection models. This README is generated systematically based on the execution script (train_multilingual.py), configurations (../config/config.yaml), and our evaluated empirical results (multilingual_results.csv).
The train_multilingual.py script leverages the Hugging Face Trainer API to fine-tune pre-trained transformer models. The entire training flow—from datasets and models to hyperparameters—is coordinated through config.yaml.
models block (e.g., mmBERT, m-bert, xlm-roberta).index column. Checks fallback paths if test_label is omitted.sklearn based on the training dataset. These weights are then applied to a customized WeightedTrainer cross-entropy loss function.EarlyStoppingCallback to monitor validation performance metrics (Macro F1) to prevent overfitting.multilingual_results.csv.The following section summarizes the peak results of the trained models, extracted directly from multilingual_results.csv. The pipeline automatically calculated test data metrics for macro accuracy and F1 scores under the given hyperparameters.
| Model Alias | Base Model Path | Val F1 (Macro) | Test F1 (Macro) | Test Accuracy | Learning Rate | Batch Size / Seq Len |
|---|---|---|---|---|---|---|
| mmbert | jhu-clsp/mmBERT-base | 0.5882 | 0.4282 | 0.8634 | 1e-05 | 64 / 32 |
| m-bert | bert-base-multilingual-uncased | 0.4064 | 0.4239 | 0.8305 | 3e-06 | 32 / 64 |
| xlm-roberta | xlm-roberta-base | 0.3830 | 0.3839 | 0.8130 | 3e-06 | 32 / 64 |
| m-distilbert | distilbert-base-multilingual-cased | 0.3907 | 0.3578 | 0.7942 | 3e-06 | 32 / 64 |
| toxic-xlm-roberta | unitary/multilingual-toxic-xlm-roberta | 0.3558 | 0.3520 | 0.8281 | 3e-06 | 32 / 64 |
(Note: Data derived from the highest F1 run per model variant. Parameters like m-bert and xlm-roberta were initially run using older parameters (LR=3e-06, BS=32, MAX_LEN=64) before being upgraded in later mmBERT runs)
config.yaml)The training script dynamically acts on parameters from config.yaml.
Target data partitions allocated for training:
train_text, train_label: Training subset filesval_text, val_label: Validation setup filestest_text, test_label: Held-out testing filesThe pipeline is currently configured to evaluate the following models:
xlm-roberta: "xlm-roberta-base"m-bert: "bert-base-multilingual-uncased"deberta: "microsoft/deberta-v3-base"mmbert: "jhu-clsp/mmBERT-base"m-distilbert: "distilbert-base-multilingual-cased"m-deberta: "microsoft/mdeberta-v3-base"toxic-xlm-roberta: "unitary/multilingual-toxic-xlm-roberta"Settings for newly compiled executions:
max_length: 32 (Sequence truncation limit)batch_size: 64epochs: 10 (Max number of epochs prior to Early Stopping)learning_rate: 1e-5weight_decay: 0.01 (L2 regularization factor)early_stopping_patience: 3num_classes: 6 toxicity categoriesGameTox toxicity taxonomy:
0: Non-toxic1: Insults and Flaming2: Other Offensive Texts3: Hate and Harassment4: Threats5: ExtremismRun the file directly. Checkpoints are dynamically saved into ./results/ partitioned by the defined model alias keys.
cd multilingual_training
python train_multilingual.py
4 commits
Python
98.8%
Shell
1.2%
This directory contains a flexible, configuration-driven training pipeline for multilingual toxicity detection models. This README is generated systematically based on the execution script (train_multilingual.py), configurations (../config/config.yaml), and our evaluated empirical results (multilingual_results.csv).
The train_multilingual.py script leverages the Hugging Face Trainer API to fine-tune pre-trained transformer models. The entire training flow—from datasets and models to hyperparameters—is coordinated through config.yaml.
models block (e.g., mmBERT, m-bert, xlm-roberta).index column. Checks fallback paths if test_label is omitted.sklearn based on the training dataset. These weights are then applied to a customized WeightedTrainer cross-entropy loss function.EarlyStoppingCallback to monitor validation performance metrics (Macro F1) to prevent overfitting.multilingual_results.csv.The following section summarizes the peak results of the trained models, extracted directly from multilingual_results.csv. The pipeline automatically calculated test data metrics for macro accuracy and F1 scores under the given hyperparameters.
| Model Alias | Base Model Path | Val F1 (Macro) | Test F1 (Macro) | Test Accuracy | Learning Rate | Batch Size / Seq Len |
|---|---|---|---|---|---|---|
| mmbert | jhu-clsp/mmBERT-base | 0.5882 | 0.4282 | 0.8634 | 1e-05 | 64 / 32 |
| m-bert | bert-base-multilingual-uncased | 0.4064 | 0.4239 | 0.8305 | 3e-06 | 32 / 64 |
| xlm-roberta | xlm-roberta-base | 0.3830 | 0.3839 | 0.8130 | 3e-06 | 32 / 64 |
| m-distilbert | distilbert-base-multilingual-cased | 0.3907 | 0.3578 | 0.7942 | 3e-06 | 32 / 64 |
| toxic-xlm-roberta | unitary/multilingual-toxic-xlm-roberta | 0.3558 | 0.3520 | 0.8281 | 3e-06 | 32 / 64 |
(Note: Data derived from the highest F1 run per model variant. Parameters like m-bert and xlm-roberta were initially run using older parameters (LR=3e-06, BS=32, MAX_LEN=64) before being upgraded in later mmBERT runs)
config.yaml)The training script dynamically acts on parameters from config.yaml.
Target data partitions allocated for training:
train_text, train_label: Training subset filesval_text, val_label: Validation setup filestest_text, test_label: Held-out testing filesThe pipeline is currently configured to evaluate the following models:
xlm-roberta: "xlm-roberta-base"m-bert: "bert-base-multilingual-uncased"deberta: "microsoft/deberta-v3-base"mmbert: "jhu-clsp/mmBERT-base"m-distilbert: "distilbert-base-multilingual-cased"m-deberta: "microsoft/mdeberta-v3-base"toxic-xlm-roberta: "unitary/multilingual-toxic-xlm-roberta"Settings for newly compiled executions:
max_length: 32 (Sequence truncation limit)batch_size: 64epochs: 10 (Max number of epochs prior to Early Stopping)learning_rate: 1e-5weight_decay: 0.01 (L2 regularization factor)early_stopping_patience: 3num_classes: 6 toxicity categoriesGameTox toxicity taxonomy:
0: Non-toxic1: Insults and Flaming2: Other Offensive Texts3: Hate and Harassment4: Threats5: ExtremismRun the file directly. Checkpoints are dynamically saved into ./results/ partitioned by the defined model alias keys.
cd multilingual_training
python train_multilingual.py
4 commits
Python
98.8%
Shell
1.2%