3.8 KiB
ErnieM
Overview
The ErnieM model was proposed in ERNIE-M: Enhanced Multilingual Representation by Aligning Cross-lingual Semantics with Monolingual Corpora by Xuan Ouyang, Shuohuan Wang, Chao Pang, Yu Sun, Hao Tian, Hua Wu, Haifeng Wang.
The abstract from the paper is the following:
Recent studies have demonstrated that pre-trained cross-lingual models achieve impressive performance in downstream cross-lingual tasks. This improvement benefits from learning a large amount of monolingual and parallel corpora. Although it is generally acknowledged that parallel corpora are critical for improving the model performance, existing methods are often constrained by the size of parallel corpora, especially for lowresource languages. In this paper, we propose ERNIE-M, a new training method that encourages the model to align the representation of multiple languages with monolingual corpora, to overcome the constraint that the parallel corpus size places on the model performance. Our key insight is to integrate back-translation into the pre-training process. We generate pseudo-parallel sentence pairs on a monolingual corpus to enable the learning of semantic alignments between different languages, thereby enhancing the semantic modeling of cross-lingual models. Experimental results show that ERNIE-M outperforms existing cross-lingual models and delivers new state-of-the-art results in various cross-lingual downstream tasks. This model was contributed by Susnato Dhar. The original code can be found here.
Usage tips
- Ernie-M is a BERT-like model so it is a stacked Transformer Encoder.
- Instead of using MaskedLM for pretraining (like BERT) the authors used two novel techniques:
Cross-attention Masked Language Modeling
andBack-translation Masked Language Modeling
. For now these two LMHead objectives are not implemented here. - It is a multilingual language model.
- Next Sentence Prediction was not used in pretraining process.
Resources
- Text classification task guide
- Token classification task guide
- Question answering task guide
- Multiple choice task guide
ErnieMConfig
autodoc ErnieMConfig
ErnieMTokenizer
autodoc ErnieMTokenizer - build_inputs_with_special_tokens - get_special_tokens_mask - create_token_type_ids_from_sequences - save_vocabulary
ErnieMModel
autodoc ErnieMModel - forward
ErnieMForSequenceClassification
autodoc ErnieMForSequenceClassification - forward
ErnieMForMultipleChoice
autodoc ErnieMForMultipleChoice - forward
ErnieMForTokenClassification
autodoc ErnieMForTokenClassification - forward
ErnieMForQuestionAnswering
autodoc ErnieMForQuestionAnswering - forward
ErnieMForInformationExtraction
autodoc ErnieMForInformationExtraction - forward