File size: 5,447 Bytes
f137247
 
 
 
 
 
 
 
1c5aa88
2c6ae88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c5aa88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c6ae88
 
 
 
 
 
 
1c5aa88
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
datasets:
- masakhane/masakhaner2
- masakhane/masakhapos
metrics:
- accuracy
- f1
---
- Paper: [`FonMTL: Toward Building a Multi-Task Learning Model for Fon Language`](https://arxiv.org/abs/2308.14280), accepted at WiNLP co-located at EMNLP 2023

- Official Github: https://github.com/bonaventuredossou/multitask_fon

- Build Multi-task Learning Model: For the shared layers (encoders) we used the following language model heads:

    - [AfroLM-Large](https://huggingface.co/bonadossou/afrolm_active_learning)
        - [AfroLM: A Self-Active Learning-based Multilingual Pretrained Language Model for 23 African Languages](https://aclanthology.org/2022.sustainlp-1.11/) (Dossou et.al., EMNLP 2022)        
    
    - [XLMR-Large](https://huggingface.co/xlm-roberta-large):
        - [Unsupervised Cross-lingual Representation Learning at Scale](https://aclanthology.org/2020.acl-main.747) (Conneau et.al., ACL 2020)

- Evaluation:

    - The goal primarily is to explore whether multitask learning improves performance on downstream tasks for Fon. We try two settings: (a) training only on Fon and evaluating on Fon, (b) training on all languages and evaluating on Fon. We evaluate the multi-task learning model on NER and POS tasks, and compare it with baselines (models finetuned and evaluated on single tasks)

# How to get started

- Run the training: `sbatch run.sh`

This command will:

- Set up the environement
- Install required libraries: `pip install -r requirements.txt -q`
- Move to the code folder: `cd code`
- Run the training & evaluate: `python run_train.py`

# NER Results
Model | Task | Pretraining/Finetuning Dataset | Pretraining/Finetuning Language(s) | Evaluation Dataset | Metric | Metric's Value |
|:---: |:---: |:---: | :---: |:---: | :---: | :---: |
`AfroLM-Large` | Single Task | MasakhaNER 2.0 | All | FON NER | F1-Score | 80.48 |
`AfriBERTa-Large` | Single Task | MasakhaNER 2.0 | All | FON NER | F1-Score | 79.90 |
`XLMR-Base` | Single Task | MasakhaNER 2.0 | All | FON NER | F1-Score | 81.90 |
`XLMR-Large` | Single Task | MasakhaNER 2.0 | All | FON NER | F1-Score | 81.60 |
`AfroXLMR-Base` | Single Task | MasakhaNER 2.0 | All | FON NER | F1-Score | 82.30 |
`AfroXLMR-Large` | Single Task | MasakhaNER 2.0 | All | FON NER | F1-Score | 82.70 |
|:---: |:---: |:---: | :---: |:---: | :---: |
`MTL Sum (ours)` | Multi-Task | MasakhaNER 2.0 & MasakhaPOS | All | FON NER | F1-Score | 79.87 |
`MTL Weighted (ours)` | Multi-Task | MasakhaNER 2.0 & MasakhaPOS | All | FON NER | F1-Score | 81.92 |
`MTL Weighted (ours)` | Multi-Task | MasakhaNER 2.0 & MasakhaPOS | Fon Data | FON NER | F1-Score | 64.43 |


# POS Results
Model | Task | Pretraining/Finetuning Dataset | Pretraining/Finetuning Language(s) | Evaluation Dataset | Metric | Metric's Value |
|:---: |:---: |:---: | :---: |:---: | :---: | :---: |
`AfroLM-Large` | Single Task | MasakhaPOS | All | FON POS | Accuracy | 82.40 |
`AfriBERTa-Large` | Single Task | MasakhaPOS | All | FON POS | Accuracy | 88.40 |
`XLMR-Base` | Single Task | MasakhaPOS | All | FON POS | Accuracy | 90.10 |
`XLMR-Large` | Single Task | MasakhaPOS | All | FON POS | Accuracy | 90.20 |
`AfroXLMR-Base` | Single Task | MasakhaPOS | All | FON POS | Accuracy | 90.10 |
`AfroXLMR-Large` | Single Task | MasakhaPOS | All | FON POS | Accuracy | 90.40 |
|:---: |:---: |:---: | :---: |:---: | :---: |
`MTL Sum (ours)` | Multi-Task | MasakhaNER 2.0 & MasakhaPOS | All | FON POS | Accuracy | 82.45 |
`MTL Weighted (ours)` | Multi-Task | MasakhaNER 2.0 & MasakhaPOS | All | FON POS | Accuracy | 89.20 |
`MTL Weighted (ours)` | Multi-Task | MasakhaNER 2.0 & MasakhaPOS | Fon Data | FON POS | Accuracy | 80.85 |

# Importance of Merging Representation Type

Merging Type | Models | Task | Metric | Metric's Value |
| :---: | :---: | :---: | :---: | :---: |
Multiplicative | MTL Weighted (multi-task; ours; *) | NER | F1-Score | **81.92** |
Multiplicative | MTL Weighted (multi-task; ours; +) | NER | F1-Score | 64.43 |
| :---: | :---: | :---: | :---: | :---:|
Multiplicative | MTL Weighted (multi-task; ours; *) | POS | Accuracy | **89.20** |
Multiplicative & MTL Weighted (multi-task; ours; +) | POS | Accuracy | 80.85 | 
| :---: | :---: | :---: | :---: | :---: |
Additive | MTL Weighted (multi-task; ours; *) | NER | F1-Score | 78.91 |
Additive | MTL Weighted (multi-task; ours; +) | NER | F1-Score | 60.93 |
| :---: | :---: | :---: | :---: | :---: |
Additive | MTL Weighted (multi-task; ours; *) | POS | Accuracy | 86.99 |
Additive | MTL Weighted (multi-task; ours; +) | POS | Accuracy | 78.25 |

# Model End-Points

- [`multitask_model_fon_False_multiplicative.bin`](https://huggingface.co/bonadossou/multitask_model_fon_False_multiplicative) is the MTL Fon Model which has been pre-trained on all MasakhaNER 2.0 and MasakhaPOS datasets, and merging representations in a multiplicative way.

- [`multitask_model_fon_True_multiplicative.bin`](https://huggingface.co/bonadossou/multitask-learning-fon-true-multiplicative) is the MTL Fon Model which has been pre-trained only on Fon data from the MasakhaNER 2.0 and MasakhaPOS datasets, and merging representations in a multiplicative way.

# How to run inference when you have the model
 To run inference with the model(s), you can use the [testing block](https://github.com/bonaventuredossou/multitask_fon/blob/main/code/run_train.py#L209) defined in our MultitaskFON class.

 # TODO
 - leverage the impact of `the dynamic weighted average loss`