Venue: NAACL 2022

WECHSEL: Effective initialization of subword embeddings for cross-lingual transfer of monolingual language models

Benjamin Minixhofer\({}^{1}\) and Fabian Paischer\({}^{2,3}\) and Navid Rekabsaz\({}^{1,3}\)

\({}^{1}\)Institute of Computational Perception, Johannes Kepler University Linz

\({}^{2}\)Institute for Machine Learning, Johannes Kepler University Linz

\({}^{3}\)ELLIS Unit Linz and LIT AI Lab

{benjamin.minixhofer, navid.rekabsaz}@jku.at paischer@ml.jku.at

###### Abstract

Large pretrained language models (LMs) have become the central building block of many NLP applications. Training these models requires ever more computational resources and most of the existing models are trained on English text only. It is exceedingly expensive to train these models in other languages. To alleviate this problem, we introduce a novel method - called WECHSEL - to efficiently and effectively transfer pretrained LMs to new languages. WECHSEL can be applied to any model which uses subword-based tokenization and learns an embedding for each subword. The tokenizer of the source model (in English) is replaced with a tokenizer in the target language and token embeddings are initialized such that they are semantically similar to the English tokens by utilizing multilingual static word embeddings covering English and the target language. We use WECHSEL to transfer the English RoBERTa and GPT-2 models to four languages French, German, Chinese and Swahili). We also study the benefits of our method on very low-resource languages. WECHSEL improves over proposed methods for cross-lingual parameter transfer and outperforms models of comparable size trained from scratch with up to 64x less training effort. Our method makes training large language models for new languages more accessible and less damaging to the environment. We make our code and models publicly available.

+
Footnote †: July 10-15, 2022 ©2022 Association for Computational Linguistics

## 1 Introduction

Large LMs based on the Transformer architecture Vaswani et al. (2017) have become increasingly popular since GPT Radford et al. (2018) and BERT Devlin et al. (2019) were introduced, prompting the creation of many large LMs pretrained on English text Yang et al. (2019); Clark et al. (2020); Lewis et al. (2020); Ram et al. (2021). There is a tendency towards training larger and larger models Brown et al. (2020); Fedus et al. (2021) while the main focus is on the English language. Recent work has called attention to the costs associated with training increasingly large LMs, including environmental and financial cost Strubell et al. (2019); Bender et al. (2021). If training large LMs for English is already costly, it is prohibitively expensive to train new, similarly powerful models to cover other languages.

One approach to address this issue is creating massively multilingual models Devlin et al. (2019); Conneau et al. (2020); Xue et al. (2021) trained on a concatenation of texts in many different languages. These models show strong natural language understanding capabilities in a wide variety of languages, but suffer from what Conneau et al. (2020) call the _curse of multilinguality_: beyond a certain number of languages, overall performance decreases on monolingual as well as cross-lingual tasks. Consistent with this finding, Nozza et al. (2020) observe that monolingual LMs often outperform massively multilingual models. This might be attributed to superior quality of monolingual tokenizers over their multilingual counterparts Rust et al. (2021). It is thus desirable to train monolingual models in more languages. Training monolingual models in non-English languages is commonly done by training a new model with randomly initialized parameters Antoun et al. (2020); Louis (2020); Martin et al. (2020); Rekabsaz et al. (2019). However, to train a model with capabilities comparable to that of an English model in this way, presumably a similar amount of compute to what was used to train the English model would be required.

To address this issue, we introduce WECHSEL,1 a novel method to transfer monolingual language models to a new language. WECHSEL uses multilingual static word embeddings between the source language and the target language to initialize model parameters. WECHSEL first copies all inner (non 

embedding) parameters of the English model, and exchanges the tokenizer with a tokenizer for the target language. Next, in contrast to prior work doing random initialization de Vries and Nissim (2021), the token embeddings in the target language are initialized such that they are close to semantically similar English tokens by mapping multilingual static word embeddings to subword embeddings. The latter step is particularly important considering that token embeddings take up roughly 31% of the parameters of RoBERTa Liu et al. (2019) and roughly 33% of the parameters of GPT2 Radford et al. (2019). Intuitively, semantically transferring embeddings instead of randomly initializing one third of the model should result in improved performance. Our parameter transfer provides an effective initialization in the target language, requiring significantly fewer training steps to reach high performance than training from scratch. As multilingual static word embeddings are available for many languages Bojanowski et al. (2017), WECHSEL is widely applicable.

We conduct our experiments on RoBERTa and GPT-2 as representative models of encoder and decoder language models, respectively. We transfer the English RoBERTa model to four languages French et al. (2017), and the English GPT-2 model to the same four plus another four very low-resource languages Sundanese et al. (2018). We evaluate the transferred RoBERTa models on Named Entity Recognition (NER), and Natural Language Inference (NLI) tasks in the respective languages. The transferred GPT-2 models are evaluated in terms of Language Modelling Perplexity (PPL) on a held-out set. We compare WECHSEL with randomly initialized models (denoted as FullRand), as well as the recently proposed TransInner method which only transfers the inner (non-embedding) parameters de Vries and Nissim (2021). All mentioned models are trained under the same conditions (around 4 days on a TPUv3-8). We also compare our model with models of comparable size trained from scratch under significantly larger training regimes, in particular CamemBERT Martin et al. (2020) French et al. (2016) Chan et al. (2020) German et al. (German), and BERT\({}_{\rm Base}\)-Chinese Devlin et al. (2019).

Results show that models initialized with WECHSEL outperform randomly initialized models and models initialized with TransInner across all languages and all tasks, for both RoBERTa and GPT-2. In addition, strong performance is reached at a fraction of the training steps of other methods. Our contribution is summarized as follows.

* We propose WECHSEL, a novel method for transferring monolingual language models to a new language by utilizing multilingual static word embeddings between the source and the target language.
* We show effective transfer of RoBERTa and GPT-2 using WECHSEL to four and eight languages, respectively, achieved after minimal training effort.
* We release more effective GPT-2 and RoBERTa models than previously published non-English models, achieved under our more efficient training setting. Our code and models are publicly available at github.com/cpjku/wechsel.

In the following, we review related work in Section 2. We introduce the WECHSEL method in Section 3, followed by explaining the experiment setup in Section 4. We show and discuss results in Section 5.

## 2 Related Work

Large Language Models.Training Language Models is usually done in a self-supervised manner i. e. deriving labels from the training text instead of needing explicit annotations. One optimization objective is Masked Language Modelling Devlin et al. (2019), MLM), where randomly selected tokens in the input are replaced by a special [MASK] token, and the task is to predict the original tokens. Another common objective is Causal Language Modelling (CLM), where the task is to predict the next token. These two objectives highlight a fundamental distinction between language models: models can be trained as encoders (e.g. with MLM) or as decoders (e.g. with CLM).

Instead of words, the vocabulary of recently proposed language models commonly consists of subwords Clark et al. (2020); Liu et al. (2019); Devlin et al. (2019).

Multilingual representations.There has been a significant amount of work in creating multilingual static word embeddings. A common method is learning embeddings from scratch using data 

in multiple languages (Luong et al., 2015; Duong et al., 2016). Alternatively, multilinguality can be achieved by aligning existing monolingual word embeddings using a bilingual dictionary, so that the resulting embeddings share the same semantic space (Xing et al., 2015; Joulin et al., 2018). Recent studies improve on this by reducing (or completely removing) the need for bilingual data Artetxe et al. (2017, 2018); Lample et al. (2018).

Beside static word embeddings, multilinguality is also well studied in the area of contextualized representations. One approach to learn multilingual contextualized representations is through training a model on a concatenation of corpora in different languages. Some models created based on this approach are mBERT Devlin et al. (2019), XLM-R Conneau et al. (2020) and mT5 Xue et al. (2021), trained on text in 104, 100, and 101 languages, respectively. As shown by Pires et al. (2019), a multilingual model such as mBERT can enable cross-lingual transfer by using task-specific annotations in one language to fine-tune the model for evaluation in another language. Despite the benefits, recent studies outline a number of limitations of massively multilingual LMs. Wu and Dredze (2020) empirically show that in mBERT "the 30% languages with least pretraining resources perform worse than using no pretrained language model at all". Conneau et al. (2020) report that beyond a certain number of languages in the training data, the overall performance decreases on monolingual as well as cross-lingual tasks. These studies motivate our work on introducing an efficient approach for creating effective monolingual LMs for more languages.

**Cross-lingual transfer of monolingual LMs.** Studies in this area can be divided into two categories:

* **Bilingualization of a monolingual LM** is concerned with extending a model to a new language while preserving its capabilities in the original language. Artetxe et al. (2020) approach this problem by replacing the tokenizer and relearning the subword embeddings, while freezing other (non-embedding) parameters. Such a model becomes bilingual, since the initial tokenizer and embeddings can be used for tasks in the source language, while the new tokenizer and embeddings can be used for tasks in the target language. Thus, a model can be finetuned on annotated task data in the source language, and then zero-shot transferred to the target language. Tran (2020) follow a similar approach, while instead of randomly initializing embeddings, they utilize static word embeddings to initialize embeddings in the target language close to semantically similar English tokens. They then continue training the model on an English text corpus as well as on the target language in order to preserve model capabilities in English.
* **Creating a new monolingual LM in the target language** is, in contrast, concerned with transferring a model from a source to a target language without the necessity to preserve its capabilities in the source language. Zoph et al. (2016) and Nguyen and Chiang (2017) show that cross-lingually transferring a machine translation model can improve performance, especially for low-resource languages. Zoph et al. (2016) use embeddings of random tokens in the original vocabulary to initialize token embeddings in the new vocabulary, while Nguyen and Chiang (2017) utilize vocabulary overlap between the source and target language. More recently, de Vries and Nissim (2021) follow a similar approach to the one of Artetxe et al. (2020) for transferring a GPT-2 model to a new language. de Vries and Nissim (2021) add an additional step, where they train the entire model for some amount of steps to allow adapting to the target language beyond the lexical level. We refer to the method of de Vries and Nissim (2021) as TransInner and consider it as a baseline in our experiments.

Our WECHSEL method belongs to the second category. WECHSEL can be seen as an extension to the method proposed by Tran (2020) with the goal of creating a new monolingual LM instead of bilingualizing the LM. This allows removing the constraints imposed by the need to preserve the model's capabilities in the source language. In addition, we generalize the semantic subword mapping done by Tran (2020) to consider an arbitrary number of semantically similar subword with an arbitrary temperature. We are the first to show that a cross-lingually transferred model can outperform monolingual models which have been trained extensively from scratch in the target language, while requiring substantially less computational resources 



## 3 Methodology

To initialize the model in the target language, we copy the inner (non-embedding) parameters from the source model. Our goal, then, is given the tokenizer \(T^{s}\) in the source language with vocabulary \(\mathbb{U}^{s}\), the corresponding token embeddings \(\mathbf{E}^{s}\), and a tokenizer \(T^{t}\) in the target language with vocabulary \(\mathbb{U}^{t}\), to find a good initialization of the embeddings \(\mathbf{E}^{t}\) by using \(\mathbf{E}^{s}\). To this end, we use existing bilingual word embeddings enriched with subword information, containing a set of words and subword n-grams in the source and target language and their aligned vectors. We denote the set of words and n-grams in the source and target language as \(\mathbb{V}^{s}\) and \(\mathbb{V}^{t}\) respectively, and the aligned static embeddings as \(\mathbf{W}^{s}\) and \(\mathbf{W}^{t}\). In Appendix D we consider an alternative method if no subword information is available in the bilingual word embeddings.

First, independently for both languages, we compute static subword embeddings for tokens in the tokenizer vocabulary in the same semantic space as the static word embeddings (Section 3.1). This results in subword embeddings \(\mathbf{U}^{s}\) and \(\mathbf{U}^{t}\) for the source and target language, respectively. Next, we use \(\mathbf{U}^{s}\) and \(\mathbf{U}^{t}\) to compute the semantic similarity of every subword in \(\mathbb{U}^{s}\) to every subword in \(\mathbb{U}^{t}\). Using these semantic similarities, we initialize the embeddings in \(\mathbf{E}^{t}\) through a convex combination of embeddings in \(\mathbf{E}^{s}\) (Section 3.2). By applying WECHSEL, the vectors of \(\mathbf{E}^{t}\) are in the same semantic space as \(\mathbf{E}^{s}\), where a subword in the target language is semantically similar to its counterpart(s) in the source language. These steps are summarized in Figure 1 and explained in more detail in the following.

### Subword Embedding Computation

The process of mapping word embeddings to subword embeddings is done individually for the source and the target language. Given a tokenizer \(T\) with vocabulary \(\mathbb{U}\) and embeddings \(\mathbf{W}\), the goal is to find subword embeddings \(\mathbf{U}\) for subwords in \(\mathbb{U}\) in the same semantic space as \(\mathbf{W}\). To this end, we decompose subwords in \(\mathbb{U}\) into n-grams and compute the embedding by taking the sum of the embeddings of all occuring n-grams, equivalent to how embeddings for out-of-vocabulary words are computed in fastText Bojanowski et al. (2017).

\[\mathbf{u}_{x}=\sum_{g\in\mathbb{G}^{(x)}}\mathbf{w}_{g}\]

where \(\mathbb{G}^{(x)}\) is the set of n-grams occuring in the subword \(x\) and \(\mathbf{w}_{g}\) is the embedding of the n-gram \(g\). Subwords in which no known n-gram occurs are initialized to zero.

### Subword similarity-based Transfer

Applying the previous step to both source and target language results in the subword embeddings \(\mathbf{U}^{s}\) and \(\mathbf{U}^{t}\) over the subword vocabularies \(\mathbb{U}^{s}\) and \(\mathbb{U}^{t}\), respectively. Our aim is to leverage these embeddings to find an effective transformation from \(\mathbf{E}^{s}\) to \(\mathbf{E}^{t}\). We first compute the cosine similarity of every subword \(x\in\mathbb{U}^{t}\) to every subword \(y\in\mathbb{U}^{s}\), denoted as \(s_{x,y}\).

\[s_{x,y}=\frac{\mathbf{u}_{x}^{t}\mathbf{u}_{y}^{sT}}{\|\mathbf{u}_{x}^{t}\|\|\mathbf{u}_{y}^{ s}\|}\]

We now exploit these similarities to initialize embeddings in \(\mathbf{E}^{t}\) by a convex combination of embeddings in \(\mathbf{E}^{s}\). In particular, each subword embedding in \(\mathbf{E}^{t}\) is defined as the weighted mean of the \(k\) nearest embeddings in \(\mathbf{E}^{s}\) according to the similarity values. The weighting is done by a softmax of the similarities with temperature \(\tau\).

\[\mathbf{e}_{x}^{t}=\frac{\sum_{y\in\mathcal{J}_{x}}\exp\left(s_{x,y}/\tau\right) \cdot\mathbf{e}_{y}^{s}}{\sum_{y^{\prime}\in\mathcal{J}_{x}}\exp\left(s_{x,y^{ \prime}}/\tau\right)}\]

where \(\mathcal{J}_{x}\) is the set of \(k\) neighbouring subwords in the source language. Subword embeddings for which \(\mathbf{U}^{t}\) is zero are initialized from a random normal distribution \(\mathcal{N}(\mathbb{E}[\mathbf{E}^{s}],\mathrm{Var}[\mathbf{E}^{s}])\).

Figure 1: Summary of our WECHSEL method. We show inputs, intermediate results and outputs.



Experiment Design

We evaluate our method by transferring the English RoBERTa Liu et al. (2019) and the English GPT-2 model Radford et al. (2019) to French, German, Chinese and Swahili. We refer to these languages as _medium-resource languages_. In addition, we study the benefits of our method on four _low-resource languages_, namely Sundanese, Scottish Gaelic, Uyghur and Malagasy.

We evaluate WECHSEL-RoBERta by fine-tuning on XNLI Conneau et al. (2018), and on the balanced train-dev-test split of WikiANN Rahimi et al. (2019); Pan et al. (2017) to evaluate NLI and NER performance, respectively. The hyperparameters used for fine-tuning are reported in Appendix B. GPT-2 is evaluated by Perplexity (PPL) on a held-out set from the same corpus on which the model was trained on. Due to the difficulty of extrinsic evaluation on low-resource languages, we only train GPT-2 models in these languages, and evaluate their performance intrinsically via Language Modelling Perplexity on a held-out set. We use the pretrained models RoBERTa\({}_{\mathrm{Base}}\) with 125M parameters, and the small GPT-2 variant with 117M parameters provided by HuggingFace's Transformers Wolf et al. (2020) in all experiments.

Since under limited training regimes such as ours, using a smaller corpus does not in general degrade performance Martin et al. (2020), we use a subset of 4GiB from the OSCAR corpus for German, French and Chinese. For the other languages, we use data from the CC-100 corpus Conneau et al. (2020) which contains 1.6GiB, 0.1GiB, 0.4GiB and 0.2GiB for Swahili, Sundanese, Scottish Gaelic, Uyghur and Malagasy, respectively. To obtain aligned word embeddings between the source and the target language we use monolingual fastText word embeddings2Bojanowski et al. (2017). We align these embeddings using the Orthogonal Procrustes method Schonemann (1966); Artetxe et al. (2016) with bilingual dictionaries from MUSE3Conneau et al. (2017) for French, German and Chinese and a bilingual dictionary from FreeDict4Bankki and Wojtowicz (2009) for Swahili. For the low-resource languages, we use bilingual dictionaries scraped from Wiktionary.5

Footnote 2: [https://fastext.cc](https://fastext.cc)

Footnote 3: [https://github.com/facebookresearch/MUSE](https://github.com/facebookresearch/MUSE)

Footnote 4: [https://freedit.org](https://freedit.org)

Footnote 5: available at github.com/cpjku/wechsel

We choose temperature \(\tau=0.1\) and neighbors \(k=10\) for WECHSEL by conducting a parameter search over a grid with varying values for \(k\) and \(\tau\) using linear probes (Appendix A). We train tokenizers in the target languages using a vocabulary size of 50k tokens and byte-level BPE Radford et al. (2019). After applying WECHSEL, we continue training RoBERTa on the MLM objective and GPT-2 on the CLM objective. We compare against two baseline methods.

* **TransInner:** Randomly initializing \(\mathbf{E}^{t}\) while transferring all other parameters from the English model as in de Vries and Nissim (2021). After training only embeddings for a fixed amount of steps while freezing other parameters, the entire model is trained for the remaining steps. In preliminary experiments reported in Appendix E, we compare the method by Zoph et al. (2016) with TransInner, observing superior performance of TransInner, so we choose TransInner as the baseline for cross-lingual transfer in all our experiments.
* **FullRand:** Training from scratch in the target language, as is commonly done when training BERT-like or GPT-like models in a new language Antoun et al. (2020); Louis (2020); Chan et al. (2020); Martin et al. (2020).

All models are trained for 250k steps with the same hyperparameters across all languages (reported in Appendix B). Training one model takes around 4 days on a TPUv3-8. For WECHSEL and FullRand we use a learning rate (LR) schedule with linear warmup from zero to the peak LR for the first 10% of steps, followed by a linear decay to zero. For TransInner, we perform two warmup phases from zero to peak LR, once for the first 10% of steps for training embeddings only, then again for the remaining steps while training the entire model.

In addition to the mentioned baselines trained under this setting, we compare the results of

\begin{table}
\begin{tabular}{l c c} \hline
**Model** & **Tokens trained on** & **Factor** \\ \hline WECHSEL-RoBERTa & 65.5B & 1.0x \\ TransInner-RoBERTa & 65.5B & 1.0x \\ FullRand-RoBERTa & 65.5B & 1.0x \\ \hline CamemBERT & 419.4B & 6.4x \\ GBERT\({}_{\mathrm{Base}}\) & 255.6B & 3.9x \\ BERT\({}_{\mathrm{Base}}\)-Chinese & 131.1B & 2.0x \\ \end{tabular}
\end{table}
Table 1: Tokens trained on in the target language between our models and previous monolingual models.

 

RoBERTa models with existing comparable models trained from scratch with more training effort. We consider the total number of tokens the model has encountered in the target language, computed as the product of batch size \(\times\) sequence length \(\times\) train steps (shown in Table 1) as a proxy for training effort. We evaluate the performance of CamemBERT Martin et al. (2020)French, GBERT\({}_{\rm Base}\)Chan et al. (2020)German, and BERT\({}_{\rm Base}\)Chinese Devlin et al. (2019) as existing monolingual LMs,6 as well as XLM-R\({}_{\rm Base}\)Artetxe et al. (2020) as a high-performing multilingual LM.

Footnote 6: To the best of our knowledge there is no monolingual model available for Swahili.

## 5 Results

We present our results on transferring RoBERTa and GPT-2 from English to other languages, followed by analyzing training behavior. In Appendix C, we provide a qualitative assessment of how well subword tokens are mapped between the source and the target languages.

### Transferring RoBERTa

Table 2 reports the evaluation results of RoBERTa. As shown, models initialized with WECHSEL outperform models trained from scratch and models initialized with TransInner across all languages. Surprisingly, close relatedness of the source and target language is not necessary to achieve effective transfer, as e. g. on NLI WECHSEL improves absolute accuracy by \(7.15\%\), \(6.31\%\), \(6.94\%\) and \(4.71\%\) over models trained from scratch for French, German, Chinese and Swahili, respectively.

We observe that our parameter transfer-based model consistently outperforms the previously released LMs on both monolingual and multilingual settings, while these models benefit from much larger training resources in terms of computation time and corpus size. In particular, the results show an improvement over XLM-R\({}_{\rm Base}\) by an average 3.54% accuracy for NLI and 1.14% micro F1 score for NER. For NLI, we improve over the prior monolingual models by \(1.55\%\), \(3.15\%\) and \(1.77\%\) absolute accuracy for French, German and Chinese, respectively. For NER, we observe improvements over monolingual models with \(0.62\%\) and \(0.26\%\) absolute micro F1 score improvement for French and German, respectively. For Chinese, the monolingual model BERT\({}_{\rm Base}\)-Chinese still outperforms our method by \(1.5\%\) absolute micro F1 score. We suspect that the discrepancy between NLI and NER is due to the limited training corpus size (max. 4GiB), while a larger corpus can potentially improve NER as more named entities appear Martin et al. (2020).

\begin{table}
\begin{tabular}{l l c c|c c c c|c c c c c} \hline \multirow{2}{*}{**Lang**} & \multicolumn{8}{c}{**Score@0**} & \multicolumn{8}{c|}{**Score@25k**} & \multicolumn{2}{c}{**Score@250k**} & \multicolumn{2}{c}{**Score (more training)**} \\  & & **NLI** & **NER** & **Avg** & **NL** & **NER** & **Avg** & **NLI** & **NER** & **Avg** & **NLI** & **NER** & **Avg** \\ \hline \multirow{6}{*}{French} & WECHSEL-RoBERTa & 78.25 & 86.93 & 82.59 & 81.63 & 90.26 & 85.95 & **82.43** & **90.88** & **86.65** & - & - & - \\  & TransInner-RoBERTa & 60.86 & 69.57 & 65.21 & 65.49 & 83.82 & 74.66 & 81.75 & 90.34 & 86.04 & - & - & - \\  & FullRad-RoBERTa & 55.71 & 70.79 & 63.25 & 69.02 & 84.24 & 76.63 & 75.28 & 89.30 & 82.29 & - & - & - \\  & CamemBERT & - & - & - & - & - & - & - & - & - & 80.88 & 90.26 & 85.57 \\  & XLM-R\({}_{\rm Base}\) & - & - & - & - & - & - & - & - & - & 79.25 & 89.48 & 84.37 \\ \hline \multirow{6}{*}{German} & WECHSEL-RoBERTa & 75.64 & 84.53 & 80.08 & 81.11 & 89.05 & 85.08 & **81.79** & **89.72** & **85.76** & - & - \\  & Transformer-RoBERTa & 58.51 & 65.23 & 61.87 & 64.78 & 82.05 & 73.42 & 80.75 & 89.30 & 85.02 & - & - & - \\  & FullRad-RoBERTa & 54.82 & 66.84 & 60.83 & 68.02 & 81.53 & 74.77 & 75.48 & 88.36 & 81.92 & - & - & - \\  & GBERT\({}_{\rm Base}\) & - & - & - & - & - & - & - & - & 78.64 & 89.46 & 84.05 \\  & XLM-R\({}_{\rm Base}\) & - & - & - & - & - & - & - & - & 78.58 & 88.76 & 83.67 \\ \hline \multirow{6}{*}{Chinese} & WECHSEL-RoBERTa & 63.23 & 72.79 & 68.01 & 77.19 & 79.07 & 78.13 & **78.32** & 80.55 & **79.44** & - & - & - \\  & TransInner-RoBERTa & 46.95 & 69.06 & 58.01 & 52.96 & 73.35 & 63.16 & 76.99 & 80.00 & 78.49 & - & - \\  & FullRad-RoBERTa & 44.24 & 57.95 & 51.09 & 58.34 & 64.84 & 61.59 & 71.38 & 78.35 & 74.86 & - & - & - \\  & BERT\({}_{\rm Base}\)-Chinese & - & - & - & - & - & - & - & - & 76.55 & **82.05** & 79.30 \\  & XLM-R\({}_{\rm Base}\) & - & - & - & - & - & - & - & - & 76.41 & 78.36 & 77.38 \\ \hline \multirow{6}{*}{Swahili} & WECHSEL-RoBERTa & 60.28 & 74.38 & 67.33 & 73.87 & 87.63 & 80.75 & **75.05** & **87.39** & **81.22** & - & - & - \\  & TransInner-RoBERTa & 54.67 & 64.46 & 59.56 & 58.85 & 80.27 & 69.56 & 74.10 & 87.05 & 80.57 & - & - \\ \cline{1-1}  & FullRad-RoBERTa & 50.59 & 62.35 & 56.47 & 63.79 & 83.49 & 73.64 & 70.34 & 87.34 & 78.84 & - & - \\ \cline{1-1}  & XLM-R\({}_{\rm Base}\) & - & - & - & - & - & - & - & - & 69.18 & 87.37 & 78.28 \\ \hline \end{tabular}
\end{table}
Table 2: Results from fine-tuning RoBERTa models. We report accuracy for NLI on XNLI and micro F1 score for NER on WikiANN. Results are averaged over 3 runs. We report scores before training (**Score@0**), after 10% of steps (**Score@25k**) and after training (**Score@250k**). We also report results from fine-tuning prior monolingual models and \(\mathrm{XLM-R}\) (**Score (more training)**), all trained on more tokens than our models. For each language, the best results in every column are indicated with underlines. The overall best results including the comparison with existing monolingual/multilingual models of comparable size are shown in bold.

 

The first two columns of Figure 2 show the performance of RoBERTa models on downstream tasks after each 12.5k training steps. Models initialized with WECHSEL reach high performance in significantly fewer steps than models initialized with FullRand or TransInner.

We expect FullRand-RoBERTa to approach performance of the respective prior monolingual models when trained on the same amount of tokens.7

\begin{table}
\begin{tabular}{l l c} \hline \hline
**Lang** & **Model** & **Best PPL** \\ \hline  & WECHSEL-GPT2 & **111.72** \\ Sundanese & TransInner-GPT2 & 151.86 \\  & FullRand-GPT2 & 149.46 \\ \hline  & WECHSEL-GPT2 & **16.43** \\ Scottish Gaelic Translnner-GPT2 & 18.62 \\  & FullRand-GPT2 & 19.53 \\ \hline Uyghur & WECHSEL-GPT2 & **34.33** \\  & TransInner-GPT2 & 39.06 \\  & FullRand-GPT2 & 42.82 \\ \hline Malagasy & WECHSEL-GPT2 & **14.01** \\  & TransInner-GPT2 & 14.85 \\  & FullRand-GPT2 & 15.93 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Results of training GPT2 models on low-resource languages. We report the best Perplexity on the held-out set, evaluated every 2.5k steps. See Figure 3 for Perplexity throughout training.

Figure 2: Test scores over training steps from fine-tuning RoBERTa models on NLI (using XNLI) and NER (using WikiANN). Perplexity on the held-out set over training steps of GPT-2 models. We evaluate every 12.5k steps.

 

For French, WECHSEL-RoBERTa outperforms CamemBERT after 10% of training steps, reducing training effort by 64x. For German, WECHSEL-RoBERTa outperforms GBERTBase after 10% of training steps, reducing training effort by 39x. For Chinese, WECHSSL-RoBERTa outperforms BERTBase-Chinese on NLI, but does not outperform BERTSBase-Chinese on NER.

### Transferring GPT-2

#### 5.2.1 To Medium-Resource Languages

Results on medium-resource languages are shown in Table 3. Similar to the results for WECHSEL-RoBERTa, the GPT-2 models trained with WECHSEL consistently outperform the models trained from scratch and with TransInner across all languages.

The rightmost column of Figure 2 depicts the performance of GPT-2 models after each 12.5k training steps. Comparing the results across all languages throughout training, we observe a stronger dependence on similarity of the source to the target language than for downstream tasks such as NLI or NER. In particular, for French and German, WECHSEL is consistently better than TransInner and FullRand throughout the entire training, while for Chinese, a decrease in perplexity towards the end of training causes WECHSEL to surpass training from scratch.

#### 5.2.2 To Low-Resource Languages

Table 4 reports the perplexity of Language Modelling on the low-resource languages. Again, we observe consistent improvements using WECHSEL on all languages. Furthermore, we find that the improvement from WECHSEL tends to increase as the amount of training data decreases by conducting a sensitivity analysis w. r. t. the amount of available training data (Appendix F).

In Figure 3 we report the performance of the low-resource LMs on the held-out set throughout training. One difference of the low-resource models with the ones trained on medium-resource languages is that the low-resource LMs are prone to overfitting, and require appropriate model selection even in the early steps of training. Notably, TransInner-GPT2 takes more steps to overfit since all non-embedding parameters are frozen for the first 25k steps (c. f. Section 4).

### Is freezing necessary?

Previous work using the TransInner method freezes non-embedding parameters for a fixed amount of steps before training the entire model (de Vries and Nissim, 2021). This is done to prevent catastrophic forgetting at the beginning of training. To evaluate if freezing non-embedding parameters is still necessary with our method, we conduct an additional experiment. We train a German GPT-2 model with WECHSEL and a model with TransInner without freezing any parameters, and the same models with freezing of non-embedding parameters for the first 10% of steps. We match hyperparameters of the main experiments except training for 75k steps only. Based on the results shown in Figure 4, we conclude that freezing is necessary when using TransInner, but there is no need for freezing when using WECHSEL.

Figure 3: Perplexity throughout training on low-resource languages. We evaluate every 2.5k steps and stop training if Perplexity on the held-out set does not improve for 10k steps.

 



## 6 Limitations and Potential Risks

### Limitations

We conduct our experiments on up to eight languages, showing the benefits of our parameter transfer method to both medium- and low-resource languages. However, there are many more languages with diverse linguistic characteristics on which our WECHSEL method is not tested. This is a limitation forced by computational constraints, as we can not ascertain whether transfer to all other languages would result in similar improvements. In addition, our extrinsic evaluation is limited to two tasks (NLI and NER). While this choice is due to the limitations on the available collections in various languages, this evaluation does not necessarily provide a comprehensive view of language understanding tasks.

### Risks

It is well-known that existing LMs trained on English text encode societal biases Bolukbasi et al. (2016); Caliskan et al. (2017); Rekabsaz et al. (2021) and stereotypes and using them in downstream tasks might lead to unfair treatment of various social groups Zerveas et al. (2022); Krieg et al. (2022); Ganhor et al. (2022); Rekabsaz et al. (2021); Melchiorre et al. (2021); Rekabsaz and Schedl (2020); Elazar and Goldberg (2018). Since we propose a method to transfer the English LMs to new languages, it is highly probable that the existing biases are also transferred to the target LMs. We therefore advocate a conscious and responsible use of the transferred LMs in practice.

## 7 Conclusion

We introduce WECHSEL, an effective method to transfer monolingual language models to new languages. WECHSEL exploits multilingual static word embeddings to compute an effective initialization of subword embeddings in the target language. We conduct experiments by transferring RoBERTa and GPT-2 models from English to French, German, Chinese and Swahili, as well as English GPT-2 to four low-resource languages. The evaluation results show that the transferred RoBERTa and GPT-2 models are more efficient and effective than strong baselines, and consistently outperform prior monolingual models that have been trained for a significantly longer time. WECHSEL facilitates the creation of effective monolingual LMs for new languages with medium to low resources, particularly in computationally-limited settings. In addition, our work provides strong evidence towards the hypothesis by Artetxe et al. (2020) that deep monolingual language models learn abstractions that generalize across languages.

## 8 Acknowledgments

Research supported with Cloud TPUs from Google's TPU Research Cloud (TRC). We thank Andy Koh and Artus Krohn-Grimberghe for providing additional computational resources. The ELLIS Unit Linz, the LIT AI Lab, the Institute for Machine Learning, are supported by the Federal State Upper Austria. We thank the project INCONTROLL-RL (FFG-881064). Research also supported in part by the NSF (IIS-1956221), the State of Upper Austria and the Austria's Federal Ministry of Education, Science, and Research through the project FAIRFLOW (LIT-2021-YOU-215).

## References

* Antoun et al. (2020)Wissam Antoun, Fady Baly, and Hazem Hajj. 2020. AraBERT: Transformer-based model for Arabic language understanding. In _Proceedings of the 4th Workshop on Open-Source Arabic Corpora and Processing Tools, with a Shared Task on Offensive Language Detection_, pages 9-15, Marseille, France. European Language Resource Association.
* Artetxe et al. (2016)Mikel Artetxe, Gorka Labaka, and Eneko Agirre. 2016. Learning principled bilingual mappings of word embeddings while preserving monolingual invariance. In _Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing_, pages 2289-2294, Austin, Texas. Association for Computational Linguistics.
* Baroni et al. (2013)

Figure 4: Comparison of German GPT-2 models trained with WECHSEL and TransInner between freezing non-embedding parameters at the start and not freezing any parameters.



Mikel Artetxe, Gorka Labaka, and Eneko Agirre. 2017: Learning bilingual word embeddings with (almost) no bilingual data. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Vancouver, Canada, pp. 451-462. External Links: Link Cited by: SS3.
* M. Artetxe, S. Ruder, and D. Yogatama (2020)On the cross-lingual transferability of monolingual representations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online, pp. 4623-4637. External Links: Link Cited by: SS3.
* P. Banski and B. Wojtowicz (2009)Frecidict: an open source repository of tei-encoded bilingual dictionaries.. Cited by: SS3.
* E. M. Bender, T. Gebru, A. McMillan-Major, and S. Shmitchell (2021)On the dangers of stochastic parrots: can language models be too big?. In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, Vol. 610-623. External Links: Link Cited by: SS3.
* P. Bojanowski, E. Grave, A. Joulin, and T. Mikolov (2017)Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics5, pp. 135-146. External Links: Link, Document Cited by: SS3.
* T. Bolukbasi, K. Chang, J. Y Zou, V. Saligrama, and A. T. Kalai (2016)Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Proc of NeurIPS, Cited by: SS3.
* R. C. Barnett, H. A. Lee, and F. Toutanova (2017)BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Minneapolis, Minnesota, pp. 4171-4186. External Links: Link, Document Cited by: SS3.
* Z. Chen, S. Schweter, and T. Moller (2020)German's next language model. In Proceedings of the 28th International Conference on Computational Linguistics, Barcelona, Spain, pp. 6788-6796. External Links: Link, Document Cited by: SS3.
* K. Clark, M. Luong, Q. V. Le, and C. D. Manning (2020)Electra: pre-training text encoders as discriminators rather than generators. arXiv preprint arXiv:2003.10555. Cited by: SS3.
* A. Conneau, K. Khandelwal, N. Goyal, V. Chaudhry, G. Wenzek, F. Guzman, E. Grave, M. Ott, L. Zettlemoyer, and V. Stoyanov (2020)Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online, pp. 8440-8451. External Links: Link, Document Cited by: SS3.
* A. Conneau, G. Lample, M. Panzato, L. Denoyer, and H. Jegou (2017)Word translation without parallel data. arXiv preprint arXiv:1710.04087. Cited by: SS3.
* A. Conneau, R. Rinott, G. Lample, A. Williams, S. R. Bowman, H. Schwenk, and V. Stoyanov (2018)Xnli: evaluating cross-lingual sentence representations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, External Links: Link, Document Cited by: SS3.
* W. de Vries and M. Nissim (2021)As good as new. how to successfully recycle English GPT-2 to make models for other languages. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, Online, pp. 836-846. External Links: Link, Document Cited by: SS3.
* J. Devlin, M. Chang, K. Lee, and K. Toutanova (2019)BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Minneapolis, Minnesota, pp. 4171-4186. External Links: Link, Document Cited by: SS3.
* L. Duong, H. Kanayama, T. Ma, S. Bird, and T. Cohn (2016)Learning crosslingual word embeddings without bilingual corpora. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, Austin, Texas, pp. 1285-1295. External Links: Link, ISBN 978145036658, Link Cited by: SS3.
* Y. Elazar and Y. Goldberg (2018)Adversarial removal of demographic attributes from text data. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Cited by: SS3.
* W. Fedus, B. Zoph, and N. Shazeer (2021)Switch transformers: scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961. Cited by: SS3.
* C. Ganhor, D. Perez, N. Rekabsaz, O. Lesota, and M. Schedl (2022)Mitigating consumer biases in recommendations with adversarial training. In Proceedings of the 45th International ACM SIGIR conference on research and development in Information Retrieval, SIGIR 2022, Cited by: SS3.

 

Armand Joulin, Piotr Bojanowski, Tomas Mikolov, Herve Jegou, and Edouard Grave. 2018. Loss in translation: Learning bilingual word mapping with a retrieval criterion. In _Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing_, pages 2979-2984, Brussels, Belgium. Association for Computational Linguistics.
* Krieg et al. (2022) Klara Krieg, Emilia Parada-Cabaleiro, Markus Schedl, and Navid Rekabsaz. 2022. Do perceived gender biases in retrieval results affect relevance judgements? In _Proceedings of the Workshop on Algorithmic Bias in Search and Recommendation at the European Conference on Information Retrieval (ECIR-BIAS 2022)_.
* Lample et al. (2018) Guillaume Lample, Alexis Conneau, Marc'Aurelio Ranzato, Ludovic Denoyer, and Herve Jegou. 2018. Word translation without parallel data. In _International Conference on Learning Representations_.
* Lewis et al. (2020) Mike Lewis, Marjan Ghazvininejad, Gargi Ghosh, Armen Aghajanyan, Sida Wang, and Luke Zettlemoyer. 2020. Pre-training via paraphrasing. In _Advances in Neural Information Processing Systems_, volume 33, pages 18470-18481. Curran Associates, Inc.
* Liu et al. (2019) Yinhan Liu, Myle Ott, Namam Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. _arXiv preprint arXiv:1907.11692_.
* Louis (2020) Antoine Louis. 2020. BelGPT-2: a GPT-2 model pretrained on French corpora. [https://github.com/antoiloui/belgpt2](https://github.com/antoiloui/belgpt2).
* Luong et al. (2015) Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Bilingual word representations with monolingual quality in mind. In _Proceedings of the 1st Workshop on Vector Space Modeling for Natural Language Processing_, pages 151-159, Denver, Colorado. Association for Computational Linguistics.
* Martin et al. (2020) Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suarez, Yoann Dupont, Laurent Romary, Eric de la Clergerie, Djame Seddah, and Benoit Sagot. 2020. CamemBERT: a tasty French language model. In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_, pages 7203-7219, Online. Association for Computational Linguistics.
* Melchiorre et al. (2021) Alessandro B. Melchiorre, Navid Rekabsaz, Emilia Parada-Cabaleiro, Stefan Brandl, Oleg Lesota, and Markus Schedl. 2021. Investigating gender fairness of recommendation algorithms in the music domain. _Information Processing and Management_, 58(5):102666.
* Nguyen and Chiang (2017) Toan Q. Nguyen and David Chiang. 2017. Transfer learning across low-resource, related languages for neural machine translation. In _Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers)_, pages 296-301, Taipei, Taiwan. Asian Federation of Natural Language Processing.
* Nozaza et al. (2020) Debora Nozaza, Federico Bianchi, and Dirk Hovy. 2020. What the [mask]? making sense of language-specificbert models. _arXiv preprint arXiv:2003.02912_.
* Pan et al. (2017) Xiaoman Pan, Boliang Zhang, Jonathan May, Joel Nothman, Kevin Knight, and Heng Ji. 2017. Crosslingual name tagging and linking for 282 languages. In _Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_, pages 1946-1958, Vancouver, Canada. Association for Computational Linguistics.
* Pires et al. (2019) Telmo Pires, Eva Schlinger, and Dan Garrette. 2019. How multilingual is multilingual BERT? In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_, pages 4996-5001, Florence, Italy. Association for Computational Linguistics.
* Radford et al. (2018) Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding with unsupervised learning.
* Radford et al. (2019) Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners.
* Rahimi et al. (2019) Afshin Rahimi, Yuan Li, and Trevor Cohn. 2019. Massively multilingual transfer for NER. In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_, pages 151-164, Florence, Italy. Association for Computational Linguistics.
* Ram et al. (2021) Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, and Omer Levy. 2021. Few-shot question answering by pretraining span selection. In _Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_, pages 3066-3079, Online. Association for Computational Linguistics.
* Rekabsaz et al. (2021a) Navid Rekabsaz, Simone Kopeinik, and Markus Schedl. 2021a. Societal biases in retrieved contents: Measurement framework and adversarial mitigation of bert rankers. In _Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval_, page 306-316.
* Rekabsaz et al. (2019) Navid Rekabsaz, Nikolaos Pappas, James Henderson, Bamriskhem K Khonglah, and Srikanth Maddieri. 2019. Regularization advantages of multilingual neural language models for low resource domains. _arXiv preprint arXiv:1906.01496_.
* Rekabsaz and Schedl (2020) Navid Rekabsaz and Markus Schedl. 2020. Do neural ranking models intensify gender bias? In _Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval_, pages 2065-2068 

Navid Rekabsaz, Robert West, James Henderson, and Allan Hanbury. 2021b. Measuring societal biases from text corpora with smoothed first-order co-occurrence. In _Proceedings of the Fifteenth International AAAI Conference on Web and Social Media, ICWSM 2021, held virtually, June 7-10, 2021_, pages 549-560. AAAI Press.
* Rust et al. (2021) Phillip Rust, Jonas Pfeiffer, Ivan Vulic, Sebastian Ruder, and Iryna Gurevych. 2021. How good is your tokenizer? on the monolingual performance of multilingual language models. In _Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_, pages 3118-3135, Online. Association for Computational Linguistics.
* Schonemann (1966) Peter H Schonemann. 1966. A generalized solution of the orthogonal procrustes problem. _Psychometrika_, 31(1):1-10.
* Strubell et al. (2019) Emma Strubell, Ananya Ganesh, and Andrew McCallum. 2019. Energy and policy considerations for deep learning in NLP. In _Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics_, pages 3645-3650, Florence, Italy. Association for Computational Linguistics.
* Tran (2020) Ke Tran. 2020. From english to foreign languages: Transferring pre-trained language models. _arXiv preprint arXiv:2002.07306_.
* Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, L Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In _Advances in Neural Information Processing Systems_, volume 30. Curran Associates, Inc.
* Wolf et al. (2020) Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remii Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Tu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations_, pages 38-45, Online. Association for Computational Linguistics.
* Wu and Dredze (2020) Shijie Wu and Mark Dredze. 2020. Are all languages created equal in multilingual BERT? In _Proceedings of the 5th Workshop on Representation Learning for NLP_, pages 120-130, Online. Association for Computational Linguistics.
* Xing et al. (2015) Chao Xing, Dong Wang, Chao Liu, and Yiye Lin. 2015. Normalized word embedding and orthogonal transform for bilingual word translation. In _Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_, pages 1006-1011, Denver, Colorado. Association for Computational Linguistics.
* Xue et al. (2021) Linting Xue, Noah Constant, Adam Roberts, Mihrik Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, and Colin Raffel. 2021. mT5: A massively multilingual pre-trained text-to-text transformer. In _Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_, pages 483-498, Online. Association for Computational Linguistics.
* Yang et al. (2019) Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In _Advances in Neural Information Processing Systems_, volume 32. Curran Associates, Inc.
* Zerveas et al. (2022) George Zerveas, Navid Rekabsaz, Daniel Cohen, and Carsten Eickhoff. 2022. Mitigating bias in search results through set-based document reranking and neutrality regularization. In _Proceedings of the 45th International ACM SIGIR conference on research and development in Information Retrieval, SIGIR 2022_. ACM.
* Zoph et al. (2016)Barret Zoph, Deniz Yuret, Jonathan May, and Kevin Knight. 2016. Transfer learning for low-resource neural machine translation. In _Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing_, pages 1568-1575, Austin, Texas. Association for Computational Linguistics.

## Appendix A Grid search over \(k\) and \(\tau\)

To choose number of neighbors \(k\) and temperature \(\tau\) for WECHSEL we conduct a grid search over linear probes of models with different initialization shown in Table 7. For RoBERTa, we compute scores on NLI (using XNLI) and POS tagging (using the French, German and Chinese GSD corpora in Universal Dependencies) using linear probes of the last hidden state. We probe on NLI by taking a concatenation of the mean of all token representations in the premise with the mean of all token representations in the hypothesis. We probe on POS tagging by taking the mean of all token representations belonging to each word. For GPT2, we compute Language Modelling Perplexity on the held-out set also used to evaluate performance of the trained models.

## Appendix B Hyperparameters

Hyperparameters used to fine-tune RoBERTa on downstream tasks are shown in Table 5. Hyperparameters used to train models in our main experiments are shown in Table 6 



## Appendix C Qualitative subword correspondence

We show a small random sample of tokens in the target language and their closest English token (according to WECHSEL) in Table 8.

## Appendix D Using Word Embeddings without subword information

As an alternative to n-gram decomposition, we introduce a method for mapping word embeddings to subword embeddings without using any subword information (shown in Figure 5). For this method, we require word frequency information in addition to the word embeddings. We apply the tokenizer \(T\) to every word \(v\) in \({\mathbb{V}}\) resulting in a set of subwords for each word. We define \({\mathbb{V}}^{(x)}\) as the set of words containing the subword \(x\) when tokenized. The embedding \(\mathbf{u}_{x}\) of the subword \(x\) is then defined as the average of the embeddings of words in \({\mathbb{V}}^{(x)}\), weighted by the word frequencies.

\[\mathbf{u}_{x}=\frac{\sum_{v\in{\mathbb{V}}^{(x)}}\mathbf{w}_{v}\cdot f_{v}}{\sum_{v \in{\mathbb{V}}^{(x)}}f_{v}}\]

where \(\mathbf{w}_{v}\) is the embedding and \(f_{v}\) is the frequency of word \(v\).

We call this variant of our method WECHSELTR. We evaluate WECHSELTR by training the same models as for WECHSEL. Results are shown in Table 9 for GPT2 and in Table 10 for RoBERTa. We find that, on average, performance is on par with WECHSEL.

## Appendix E Choosing a transfer baseline

We consider two baseline methods to transfer models to a new language without using any language-specific information. One method copies non-embedding parameters to the target language anditalizes embeddings from a random normal distribution as done by de Vries and Nissim (2021). We refer to this method as TransInner. Another option copies non-embedding parameters and assigns the embedding of a random token in the source language to each embedding in the target language (effectively "shuffling" the embeddings) as done by Zoph et al. (2016) and Nguyen and Chiang (2017). We refer to this method as TransInnerShuffleEmb. We evaluate these two methods using a setup equivalent to the experiments in Section 5.3 and find that TransInner performs slightly better than TransInnerShuffleEmb (Figure 6), so we use TransInner for subsequent experiments.

\begin{table}
\begin{tabular}{l r r} \hline
**Parameter** & **RoBERTa** & **GPT2** \\ \hline peak learning rate & 1e-4 & 5e-4 \\ batch size & 512 & 512 \\ sequence length & 512 & 512 \\ weight decay & 0.01 & 0.01 \\ Adam \(\epsilon\) & 1e-6 & 1e-6 \\ Adam \(\beta_{1}\) & 0.9 & 0.9 \\ Adam \(\beta_{2}\) & 0.98 & 0.98 \\ train steps & 250k & 250k \\ \hline \end{tabular}
\end{table}
Table 6: Hyperparameters of the models transferred from RoBERTa and GPT2.

\begin{table}
\begin{tabular}{c|r r|r r r} \hline
* & 54.0 & 81.6 & 1.8e+7 \\  & CamemBERT &
- & 46.3 & 60.6 & 5.7e+6 \\ \cline{2-6}  & & 1 & 1 & 58.9 & 72.7 & 6e+5 \\  & & 10 & 0.1 & 58.9 & 76.0 & 4.2e+5 \\  & WECHSEL@0 & 10 & 1 & 57.5 & 75.4 & 8.3e+6 \\  & & 50 & 0.1 & 55.4 & 75.4 & 1.0e+7 \\  & FullRand@0 & 50 & 1 & 53.6 & 69.5 & 5.9e+7 \\  & FullRand@0 &
- & 44.5 & 49.1 & 6.2e+6 \\  & GBERTBase &
- & 63.2 & 81.4 &
- \\ \hline \multirow{5}{*}{Chinese} & & 1 & 1 & 47.4 & 75.4 & 2.7e+6 \\  & & 10 & 0.1 & 48.0 & 80.7 & 2.6e+6 \\  & WECHSEL@0 & 10 & 1 & 48.3 & 80.3 & 3.1e+6 \\  & & 50 & 0.1 & 48.3 & 77.8 & 3.7e+7 \\  & FullRand@0 &
- & 37.5 & 53.7 & 5.8e+6 \\  & BERTBase-Chinese &
- & 61.9 & 91.9 &
- \\ \hline \end{tabular}
\end{table}
Table 7: Grid search over the temperature \(\tau\) and number of most similar tokens \(k\) parameters of WECHSEL.




## Appendix F Sensitivity Analysis w. r. t. training data size

Evaluating on languages with different amounts of available data only indirectly measures the effect of training data size on WECHSEL since other factors (e.g. language similarity to English) are also involved. We conduct a sensitivity analysis to make the relation to the amount of training data explicit (Table 11). Due to computational constraints we only do this for French. We find that the improvement from WECHSEL increases as the amount of training data decreases. In addition, we find that using fastText embeddings trained on less data deteriorates performance, but still leaves a clear margin to TransInner and FullRand.

Figure 5: WECHSELTR, an alternative subword embedding computation method. First, **tokenize** all words in the word embeddings. Then **flatten** the result by assigning the embeddings of the words in which it occured and their word frequencies to each subword. Finally, **reduce** the embeddings assigned to each subword by taking their mean, weighted by word frequency.

\begin{table}
\begin{tabular}{c|r c} \hline
**Lang** & **Target Token** & **Closest English Token** \\ \hline  & heritage & legacy \\  & tremp & soaked \\  & episcop & bishop \\  & scandaleux & udicrous \\  & vertig & astonishing \\  & enregister & rec \\  & sucres & sweets \\  & Emmanuel & Emmanuel \\  & entourage & confid \\  & secretariat & arit \\ \hline  & machen & zie \\  & mit & with \\  & Sprichwort & proverb \\  & erischen & Austrian \\  & minuten & utes \\  & Haustechnik & umbing \\  & dringen & urgent \\  & vrefienern & refine \\  & umgebung & viroments \\  & ternehmen & ims \\ \hline  & \(\mathbb{H}^{3}\!\!+\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!



\begin{table}
\begin{tabular}{l l c r|r r r|r r r} \hline \hline
**Lang** & **Model** & \multicolumn{4}{c|}{**Score@0**} & \multicolumn{3}{c|}{**Score@25k**} & \multicolumn{3}{c}{**Score@250k**} \\  & & **NLI** & **NER** & **Avg** & **NLI** & **NER** & **Avg** & **NLI** & **NER** & **Avg** \\ \hline \multirow{2}{*}{French} & WECHSEL-RoBERTa & 78.25 & 86.93 & 82.59 & 81.63 & 90.26 & 85.95 & 82.43 & **90.88** & 86.65 \\  & WECHSEL\({}_{\text{TFR}}\)-RoBERta & 78.25 & 87.43 & 82.84 & 81.86 & 90.07 & 85.96 & **82.55** & 90.80 & **86.68** \\ \hline \multirow{2}{*}{German} & WECHSEL-RoBERTa & 75.64 & 84.53 & 80.08 & 81.11 & 89.05 & 85.08 & 81.79 & **89.72** & 85.76 \\  & WECHSEL\({}_{\text{TFR}}\)-RoBERTa & 77.00 & 84.70 & 80.85 & 80.71 & 89.09 & 84.90 & **82.04** & **89.72** & **85.88** \\ \hline \multirow{2}{*}{Chinese} & WECHSEL-RoBERTa & 63.23 & 72.79 & 68.01 & 77.19 & 79.07 & 78.13 & **78.32** & 80.55 & **79.44** \\  & WECHSEL\({}_{\text{TFR}}\)-RoBERTa & 62.75 & 72.87 & 67.81 & 77.07 & 78.03 & 77.55 & 77.99 & **80.65** & 79.32 \\ \hline \multirow{2}{*}{Swahili} & WECHSEL-RoBERTa & 60.28 & 74.38 & 67.33 & 73.87 & 87.63 & 80.75 & **75.05** & 87.39 & **81.22** \\  & WECHSEL\({}_{\text{TFR}}\)-RoBERTa & 60.14 & 75.42 & 67.78 & 74.04 & 87.79 & 80.92 & 74.58 & **87.66** & 81.12 \\ \hline \hline \end{tabular}
\end{table}
Table 10: Results from fine-tuning WECHSEL\({}_{\text{TFR}}\)-RoBERTa models. Results shown equivalently as in Table 2.

\begin{table}
\begin{tabular}{l c c c c c} \hline \hline  & \multicolumn{5}{c}{**Best PPL**} \\
**Model** & **Subsample Size** & 16MiB & 64MiB & 256MiB & 1024MiB \\ \hline WECHSEL-GPT2 (original fastText embeddings) & 78.33 & 44.75 & 31.63 & 24.66 \\ \hline WECHSEL-GBT2 (fastText embeddings trained on subsample) & 97.42 & 49.50 & 32.88 & 24.75 \\ FullRand-GPT2 & 281.46 & 83.43 & 43.08 & 27.09 \\ TransInner-GPT2 & 216.37 & 77.71 & 35.27 & 25.15 \\ \hline \hline \end{tabular}
\end{table}
Table 11: Sensitivity Analysis w.r.t. the amount of training data on transfer to French. We train models on random subsamples of 16MiB, 64MiB, 256MiB and 1024MiB of the original training data, and evaluate on the same held-out set. For WECHSEL-GPT2, we train two models. One using the original, publicly available fastText embeddings trained on Common Crawld data. The other using fastText embeddings trained only on the corresponding subsample of text.