This repository implements multi-pivoting methods for multilingual MT task, as described in Mohammadshahi et al. (2023).
In direct translation, the score of a translation
In multi-pivot setting, we select a set of pivots (
Multilingual Averaging (MultiAvg): We average the predicted log-probabilities of a token
Maximum Ensemble (MaxEns): This method biases the prediction towards the more confident pivot. MaxEns computes the combination as
pip install -r requirements.txt
python -m unittest
It automatically downloads the required pair from https://huggingface.co/datasets/gsarti/flores_101
python -m scripts.run_inference --model_path MODEL --pivots TYPE --language_pairs af-ast --result_path PATH
MODEL: path to multilingual model
TYPE (ensembeling method):
- "direct" = direct translation
- "en" = pivoting English
- "top" = MaxEns method (add "--do_simple_avg" for MultiAvg method)
Supported models are:
- M2M-100 (418M). Use
--model_path m2m100_418M
- SMaLL-100. Use
--model_path small100
Install sacreblue as:
git clone --single-branch --branch adding_spm_tokenized_bleu https://github.com/ngoyal2707/sacrebleu.git
cd sacrebleu
python setup.py install
Then:
sacrebleu ref.txt < pred.txt --tokenize spm
Note: compute_chrf.py and compute_no_hallucinations.py can be used to compute hallucinations.
@misc{mohammadshahi2023investigating,
title={Investigating Multi-Pivot Ensembling with Massively Multilingual Machine Translation Models},
author={Alireza Mohammadshahi and Jannis Vamvas and Rico Sennrich},
year={2023},
eprint={2311.07439},
archivePrefix={arXiv},
primaryClass={cs.CL}
}