Code for "Memorisation Cartography: Mapping out the Memorisation-Generalisation Continuum in Neural Machine Translation", to appear at EMNLP-2023 in Singapore, in December of 2023.
Visit our demo: https://memorisation-mt-demo.github.io/memorisation-mt-demo/demo.html
- Ensure our parallel corpus is underneath
data/parallel_opus(contact us for the corpus,vernadankers@gmail.com) - Install packages with
conda env create -f env.yml cd fairseqandpip install -e .
- In
modellingrunbash submit_scripts.sh memorisation-training <language>, followed bybash submit_scripts.sh memorisation-testing <language>. - Afterwards, in
analysisrunpython compute_memorisation.py --trglang <language> --postfix ref. You will now have computed memorisation metrics underanalysis/memorisation_pickled/en-<language>.
- To prepare for the analysis three types of data are required:
- the predictions that are the outcome of the memorisation pretraining
- obtain alignments using
eflomal(https://github.com/robertostling/eflomal), and insert them inanalysis/alignments/ - obtain backtranslations in the
analysis/backtranslationfolder usingpython backtranslation.py --trglang <language>
- Afterwards, you can "map out" the data by running
python map_features.py --trglang <language>. You will now have examples and their features stored undermemorisation_pickled/en-<language>/examples_<language>.pickle. - Functionality for the analyses of section 4 are contained in
section4.py.
- In
modellingrunbash submit_scripts.sh training-dynamics-training <language>, followed bybash submit_scripts.sh training-dynamics-testing <language>. - Process signals, train MLPs and visualise results for section 5 using
section5.py.
- Create subsets with examples held out, by running
python store_subsets.pyfor section 6.1. Inmodellingrunbash submit_scripts.sh performance-impact-training <language>, followed bybash submit_scripts.sh performance-impact-testing <language>. - Create "specialised corpora" using
python store_specialised_corpora.pyfor section 6.2. Inmodellingrunbash submit_scripts.sh improved-training <language>, followed bybash submit_scripts.sh improved-testing <language>.
@inproceedings{dankers2023memorisation,
title={Memorisation Cartography: Mapping out the Memorisation-Generalisation Continuum in Neural Machine Translation},
author={Dankers, Verna and Titov, Ivan and Hupkes, Dieuwke},
booktitle={Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
year={2023}
}