File size: 2,958 Bytes
276434e e01fa4a 276434e |
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 |
# BERT-tiny model finetuned with M-FAC
This model is finetuned on SQuAD version 2 dataset with state-of-the-art second-order optimizer M-FAC.
Check NeurIPS 2021 paper for more details on M-FAC: [https://arxiv.org/pdf/2107.03356.pdf](https://arxiv.org/pdf/2107.03356.pdf).
## Finetuning setup
For fair comparison against default Adam baseline, we finetune the model in the same framework as described here [https://github.com/huggingface/transformers/tree/master/examples/pytorch/question-answering](https://github.com/huggingface/transformers/tree/master/examples/pytorch/question-answering) and just swap Adam optimizer with M-FAC.
Hyperparameters used by M-FAC optimizer:
```bash
learning rate = 1e-4
number of gradients = 1024
dampening = 1e-6
```
## Results
We share the best model out of 5 runs with the following score on SQuAD version 2 validation set:
```bash
exact_match = 50.29
f1 = 52.43
```
Mean and standard deviation for 5 runs on SQuAD version 2 validation set:
| | Exact Match | F1 |
|:----:|:-----------:|:----:|
| Adam | 48.41 ± 0.57 | 49.99 ± 0.54 |
| M-FAC | 49.80 ± 0.43 | 52.18 ± 0.20 |
Results can be reproduced by adding M-FAC optimizer code in [https://github.com/huggingface/transformers/blob/master/examples/pytorch/question-answering/run_qa.py](https://github.com/huggingface/transformers/blob/master/examples/pytorch/question-answering/run_qa.py) and running the following bash script:
```bash
CUDA_VISIBLE_DEVICES=0 python run_qa.py \
--seed 42 \
--model_name_or_path prajjwal1/bert-tiny \
--dataset_name squad_v2 \
--version_2_with_negative \
--do_train \
--do_eval \
--per_device_train_batch_size 12 \
--learning_rate 1e-4 \
--num_train_epochs 2 \
--max_seq_length 384 \
--doc_stride 128 \
--output_dir out_dir/ \
--optim MFAC \
--optim_args '{"lr": 1e-4, "num_grads": 1024, "damp": 1e-6}'
```
We believe these results could be improved with modest tuning of hyperparameters: `per_device_train_batch_size`, `learning_rate`, `num_train_epochs`, `num_grads` and `damp`. For the sake of fair comparison and a robust default setup we use the same hyperparameters across all models (`bert-tiny`, `bert-mini`) and all datasets (SQuAD version 2 and GLUE).
## BibTeX entry and citation info
```bibtex
@article{DBLP:journals/corr/abs-2107-03356,
author = {Elias Frantar and
Eldar Kurtic and
Dan Alistarh},
title = {Efficient Matrix-Free Approximations of Second-Order Information,
with Applications to Pruning and Optimization},
journal = {CoRR},
volume = {abs/2107.03356},
year = {2021},
url = {https://arxiv.org/abs/2107.03356},
eprinttype = {arXiv},
eprint = {2107.03356},
timestamp = {Tue, 20 Jul 2021 15:08:33 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2107-03356.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
```
|