Title: SENTENCES IN 1620 LANGUAGE PAIRS FROM WIKIPEDIA

Abstract: We present an approach based on multilingual sentence embeddings to automatically extract parallel sentences from the content of Wikipedia articles in 85 languages, including several dialects or low-resource languages. We do not limit the extraction process to alignments with English, but systematically consider all possible language pairs. In total, we are able to extract 135M parallel sentences for 1620 different language pairs, out of which only 34M are aligned with English. This corpus of parallel sentences is freely available. 1 To get an indication on the quality of the extracted bitexts, we train neural MT baseline systems on the mined data only for 1886 languages pairs, and evaluate them on the TED corpus, achieving strong BLEU scores for many language pairs. The WikiMatrix bitexts seem to be particularly interesting to train MT systems between distant languages without the need to pivot through English.

1. INTRODUCTION:

Most of the current approaches in Natural Language Processing (NLP) are data-driven. The size of the resources used for training is often the primary concern, but the quality and a large variety of topics may be equally important. Monolingual texts are usually available in huge amounts for many topics and languages. However, multilingual resources, typically sentences in two languages which are mutual translations, are more limited, in particular when the two languages do not involve English. An important source of parallel texts are international organizations like the European Parliament (Koehn, 2005) or the United Nations (Ziemski et al., 2016) . These are professional human translations, but they are in a more formal language and tend to be limited to political topics. There are several projects relying on volunteers to provide translations for public texts, e.g. news commentary (Tiedemann, 2012) , OpensubTitles (Lison & Tiedemann, 2016) or the TED corpus (Qi et al., 2018) Wikipedia is probably the largest free multilingual resource on the Internet. The content of Wikipedia is very diverse and covers many topics. Articles exist in more than 300 languages. Some content on Wikipedia was human translated from an existing article into another language, not necessarily from or into English. Eventually, the translated articles have been later independently edited and are not parallel any more. Wikipedia strongly discourages the use of unedited machine translation,2 but the existence of such articles can not be totally excluded. Many articles have been written independently, but may nevertheless contain sentences which are mutual translations. This makes Wikipedia a very appropriate resource to mine for parallel texts for a large number of language pairs. To the best of our knowledge, this is the first work to process the entire Wikipedia and systematically mine for parallel sentences in all language pairs. We hope that this resource will be useful for several research areas and enable the development of NLP applications for more languages.

In this work, we build on a recent approach to mine parallel texts based on a distance measure in a joint multilingual sentence embedding space (Schwenk, 2018; Artetxe & Schwenk, 2018b) . For this, we use the freely available LASER toolkit3 which provides a language agnostic sentence encoder which was trained on 93 languages (Artetxe & Schwenk, 2018a) . We approach the computational challenge to mine in almost six hundred million sentences by using fast indexing and similarity search algorithms.

The paper is organized as follows. In the next section, we first discuss related work. We then summarize the underlying mining approach. Section 4 describes in detail how we applied this approach to extract parallel sentences from Wikipedia in 1620 language pairs. To asses the quality of the extracted bitexts, we train NMT systems for a subset of language pairs and evaluate them on the TED corpus (Qi et al., 2018) for 45 languages. These results are presented in section 5. The paper concludes with a discussion of future research directions.

2. RELATED WORK:

There is a large body of research on mining parallel sentences in collections of monolingual texts, usually named "comparable coprora". Initial approaches to bitext mining have relied on heavily engineered systems often based on metadata information, e.g. (Resnik, 1999; Resnik & Smith, 2003) . More recent methods explore the textual content of the comparable documents. For instance, it was proposed to rely on cross-lingual document retrieval, e.g. (Utiyama & Isahara, 2003; Munteanu & Marcu, 2005) or machine translation, e.g. (Abdul-Rauf & Schwenk, 2009; Bouamor & Sajjad, 2018) , typically to obtain an initial alignment that is then further filtered. In the shared task for bilingual document alignment (Buck & Koehn, 2016) , many participants used techniques based on n-gram or neural language models, neural translation models and bag-of-words lexical translation probabilities for scoring candidate document pairs. The STACC method uses seed lexical translations induced from IBM alignments, which are combined with set expansion operations to score translation candidates through the Jaccard similarity coefficient (Etchegoyhen & Azpeitia, 2016; Azpeitia et al., 2017; 2018) . Using multilingual noisy web-crawls such as ParaCrawl4 for filtering good quality sentence pairs has been explored in the shared tasks for high resource (Koehn et al., 2018) and low resource (Koehn et al., 2019) languages.

In this work, we rely on massively multilingual sentence embeddings and margin-based mining in the joint embedding space, as described in (Schwenk, 2018; Artetxe & Schwenk, 2018b; a) . This approach has also proven to perform best in a low resource scenario (Chaudhary et al., 2019; Koehn et al., 2019) . Closest to this approach is the research described in España-Bonet et al. (2017) ; Hassan et al. (2018) ; Guo et al. (2018) ; Yang et al. (2019) . However, in all these works, only bilingual sentence representations have been trained. Such an approach does not scale to many languages, in particular when considering all possible language pairs in Wikipedia. Finally, related ideas have been also proposed in Bouamor & Sajjad (2018) or Grégoire & Langlais (2017) . However, in those works, mining is not solely based on multilingual sentence embeddings, but they are part of a larger system. To the best of our knowledge, this work is the first one that applies the same mining approach to all combinations of many different languages, written in more than twenty different scripts.

Wikipedia is arguably the largest comparable corpus. One of the first attempts to exploit this resource was performed by Adafre & de Rijke ( 2006). An MT system was used to translate Dutch sentences into English and to compare them with the English texts. This method yielded several hundreds of Dutch/English parallel sentences. Later, a similar technique was applied to the Persian/English pair (Mohammadi & GhasemAghaee, 2010) . Structural information in Wikipedia such as the topic categories of documents was used in the alignment of multilingual corpora (Otero & López, 2010) . In another work, the mining approach of Munteanu & Marcu (2005) was applied to extract large corpora from Wikipedia in sixteen languages (Smith et al., 2010) . Otero et al. (2011) measured the comparability of Wikipedia corpora by the translation equivalents on three languages Portuguese, Spanish, and English. Patry & Langlais (2011) came up with a set of features such as Wikipedia entities to recognize parallel documents, and their approach was limited to a bilingual setting. Tufis et al. (2013) proposed an approach to mine parallel sentences from Wikipedia textual content, but they only considered high-resource languages, namely German, Spanish and Romanian paired with English. Tsai & Roth (2016) grounded multilingual mentions to English wikipedia by training cross-lingual embeddings on twelve languages. Gottschalk & Demidova (2017) searched for parallel text passages in Wikipedia by comparing their named entities and time expressions. Finally, Aghaebrahimian (2018) propose an approach based on bilingual BiLSTM sentence encoders to mine German, French and Persian parallel texts with English. Parallel data consisting of aligned Wikipedia titles have been extracted for twenty-three languages5 . Since Wikipedia titles are rarely entire sentences with a subject, verb and object, it seems that only modest improvements were observed when adding this resource to the training material of NMT systems.

We are not aware of other attempts to systematically mine for parallel sentences in the textual content of Wikipedia for a large number of languages.

3. DISTANCE-BASED MINING APPROACH:

The underling idea of the mining approach used in this work is to first learn a multilingual sentence embedding, i.e. an embedding space in which semantically similar sentences are close independently of the language they are written in. This means that the distance in that space can be used as an indicator whether two sentences are mutual translations or not. Using a simple absolute threshold on the cosine distance was shown to achieve competitive results (Schwenk, 2018) . However, it has been observed that an absolute threshold on the cosine distance is globally not consistent, e.g. (Guo et al., 2018) . The difficulty to select one global threshold is emphasized in our setting since we are mining parallel sentences for many different language pairs.

3.1. MARGIN CRITERION:

The alignment quality can be substantially improved by using a margin criterion instead of an absolute threshold (Artetxe & Schwenk, 2018b) . In that work, the margin between two candidate sentences x and y is defined as the ratio between the cosine distance between the two sentence embeddings, and the average cosine similarity of its nearest neighbors in both directions:

EQUATION

where NN k (x) denotes the k unique nearest neighbors of x in the other language, and analogously for NN k (y). We used k = 4 in all experiments.

We follow the "max" strategy as described in (Artetxe & Schwenk, 2018b ): the margin is first calculated in both directions for all sentences in language L 1 and L 2 . We then create the union of these forward and backward candidates. Candidates are sorted and pairs with source or target sentences which were already used are omitted. We then apply a threshold on the margin score to decide whether two sentences are mutual translations or not. Note that with this technique, we always get the same aligned sentences, independently of the mining direction, e.g. searching translations of French sentences in a German corpus, or in the opposite direction. The reader is referred to Artetxe & Schwenk (2018b) for a detailed discussion with related work.

The complexity of a distance-based mining approach is O(N × M ), where N and M are the number of sentences in each monolingual corpus. This makes a brute-force approach with exhaustive distance calculations intractable for large corpora. Margin-based mining was shown to significantly outperform the state-of-the-art on the shared-task of the workshop on Building and Using Comparable Corpora (BUCC) (Artetxe & Schwenk, 2018b) . The corpora in the BUCC corpus are rather small: at most 567k sentences.

The languages with the largest Wikipedia are English and German with 134M and 51M sentences, respectively, after pre-processing (see Section 4.1 for details). This would require 6.8×10 15 distance calculations. 6 We show in Section 3.3 how to tackle this computational challenge.

3.2. MULTILINGUAL SENTENCE EMBEDDINGS:

Distance-based bitext mining requires a joint sentence embedding for all the considered languages.

One may be tempted to train a bi-lingual embedding for each language pair, e.g. (España-Bonet et al., 2017; Hassan et al., 2018; Guo et al., 2018; Yang et al., 2019) , but this is difficult to scale to thousands of language pairs present in Wikipedia. Instead, we chose to use one single massively multilingual sentence embedding for all languages, namely the one proposed by the open-source LASER toolkit (Artetxe & Schwenk, 2018a) . Training one joint multilingual embedding on many languages at once also has the advantage that low-resource languages can benefit from the similarity to other language in the same language family. For example, we were able to mine parallel data for several Romance (minority) languages like Aragonese, Lombard, Mirandese or Sicilian although data in those languages was not used to train the multilingual LASER embeddings.

The underlying idea of LASER is to train a sequence-to-sequence system on many language pairs at once using a shared BPE vocabulary and a shared encoder for all languages. The sentence representation is obtained by max-pooling over all encoder output states. Figure 1 illustrates this approach.

The reader is referred to Artetxe & Schwenk (2018a) for a detailed description.

3.3. FAST SIMILARITY SEARCH:

Fast large-scale similarity search is an area with a large body of research. Traditionally, the application domain is image search, but the algorithms are generic and can be applied to any type of vectors. In this work, we use the open-source FAISS library7 which implements highly efficient algorithms to perform similarity search on billions of vectors (Johnson et al., 2017) . An additional advantage is that FAISS has support to run on multiple GPUs. Our sentence representations are 1024-dimensional. This means that the embeddings of all English sentences require 153 • 10 6 × 1024 × 4 = 513 GB of memory. Therefore, dimensionality reduction and data compression are needed for efficient search. In this work, we chose a rather aggressive compression based on a 64-bit product-quantizer (Jégou et al., 2011) , and portioning the search space in 32k cells. This corresponds to the index type "OPQ64,IVF32768,PQ64" in FAISS terms. 8 Another interesting compression method is scalar quantization. A detailed comparison is left for future research. We build and train one FAISS index for each language.

The compressed FAISS index for English requires only 9.2GB, i.e. more than fifty times smaller than the original sentences embeddings. This makes it possible to load the whole index on a standard GPU and to run the search in a very efficient way on multiple GPUs in parallel, without the need to shard the index. The overall mining process for German/English requires less than 3.5 hours on 8 GPUs, including the nearest neighbor search in both direction and scoring all candidates

4. BITEXT MINING IN WIKIPEDIA:

For each Wikipedia article, it is possible to get the link to the corresponding article in other languages. This could be used to mine sentences limited to the respective articles. One one hand, this local mining has several advantages: 1) mining is very fast since each article usually has a few hundreds of sentences only; 2) it seems reasonable to assume that a translation of a sentence is more likely to be found in the same article than anywhere in the whole Wikipedia. On the other hand, we

L 1 (French)

Ceci est une très grande maison L 2 (German) Das ist ein sehr großes Haus This is a very big house Ez egy nagyon nagy ház Ini rumah yang sangat besar

Table 2 : Illustration how sentences in the wrong language can hurt the alignment process with a margin criterion. See text for a detailed discussion.

hypothesize that the margin criterion will be less efficient since one article has usually few sentences which are similar. This may lead to many sentences in the overall mined corpus of the type "NAME was born on DATE in CITY", "BUILDING is a monument in CITY built on DATE", etc. Although those alignments may be correct, we hypothesize that they are of limited use to train an NMT system, in particular when they are too frequent. In general, there is a risk that we will get sentences which are close in structure and content.

The other option is to consider the whole Wikipedia for each language: for each sentence in the source language, we mine in all target sentences. This global mining has several potential advantages: 1) we can try to align two languages even though there are only few articles in common; 2) many short sentences which only differ by the name entities are likely to be excluded by the margin criterion. A drawback of this global mining is a potentially increased risk of misalignment and a lower recall.

In this work, we chose the global mining option. This will allow us to scale the same approach to other, potentially huge, corpora for which document-level alignments are not easily available, e.g. Common Crawl. An in depth comparison of local and global mining (on Wikipedia) is left for future research.

4.1. CORPUS PREPARATION:

Extracting the textual content of Wikipedia articles in all languages is a rather challenging task, i.e. removing all tables, pictures, citations, footnotes or formatting markup. There are several ways to download Wikipedia content. In this study, we use the so-called CirrusSearch dumps since they directly provide the textual content without any meta information. 9 We downloaded this dump in March 2019. A total of about 300 languages are available, but the size obviously varies a lot between languages. We applied the following processing:

• extract the textual content;

• split the paragraphs into sentences;

• remove duplicate sentences;

• perform language identification and remove sentences which are not in the expected language (usually, citations or references to texts in another language).

It should be pointed out that sentence segmentation is not a trivial task, with many exceptions and specific rules for the various languages. For instance, it is rather difficult to make an exhaustive list of common abbreviations for all languages. In German, points are used after numbers in enumerations, but numbers may also appear at the end of sentences. Other languages do not use specific symbols to mark the end of a sentence, namely Thai. We are not aware of a reliable and freely available sentence segmenter for Thai and we had to exclude that language. We used the freely available Python tool10 which is based on Moses scripts. Regular expressions were used for most of the Asian languages, falling back to English for the remaining languages. This gives us 879 million sentences in 300 languages. The margin criterion to mine for parallel data requires that the texts do not contain duplicates. This removes about 25% of the sentences.11 LASER's sentence embeddings are totally language agnostic. This has the side effect that the sentences in other languages (e.g. citations or quotes) may be considered closer in the embedding space than a potential translation in the target language. Table 2 illustrates this problem. The algorithm would not select the German sentence although it is a perfect translation. The sentences in the other languages are also valid translations which would yield a very small margin. To avoid this problem, we perform language identification (LID) on all sentences and remove those which are not in the expected language. LID is performed with fasttext12 (Joulin et al., 2016) . Fasttext does not support all the 300 languages present in Wikipedia and we disregarded the missing ones (which typically have only few sentences anyway). After deduplication and LID, we dispose of 595M sentences in 182 languages. English accounts for 134M sentences, and German with 51M sentences is the second largest language. The sizes for all languages are given in Tables 4 and 6 .

4.2 THRESHOLD OPTIMIZATION Artetxe & Schwenk (2018b) optimized their mining approach for each language pair on a provided corpus of gold alignments. This is not possible when mining Wikipedia, in particular when considering many language pairs. In this work, we use an evaluation protocol inspired by the WMT shared task on parallel corpus filtering for low-resource conditions (Koehn et al., 2019 ): an NMT system is trained on the extracted bitexts -for different thresholds -and the resulting BLEU scores are compared. We choose newstest2014 of the WMT evaluations since it provides an N -way parallel test sets for English, French, German and Czech. We favoured the translation between two morphologically rich languages from different families and considered the following language pairs: German/English, German/French, Czech/German and Czech/French. The size of mined bitexts is in the range of 100k to more than 2M (see Table 3 and Figure 1 ). We did not try to optimize the architecture of the NMT system to the size of the bitexts and used the same architecture for all systems: the encoder and decoder are 5-layer transformer models as implemented in fairseq (Ott et al., 2019) . The goal of this study is not to develop the best performing NMT system for the considered languages pairs, but to compare different mining parameters.

The evolution of the BLEU score in function of the margin threshold is given in Figure 1 . Decreasing the threshold naturally leads to more mined data -we observe an exponential increase of the data size. The performance of the NMT systems trained on the mined data seems to change as expected, in a surprisingly smooth way. The BLEU score first improves with increasing amounts of available training data, reaches a maximum and than decreases since the additional data gets more and more noisy, i.e. contains wrong translations. It is also not surprising that a careful choice of the margin threshold is more important in a low-resource setting. Every additional parallel sentence is important. According to Figure 1 , the optimal value of the margin threshold seems to be 1.05 when many sentences can be extracted, in our case German/English and German/French. When less parallel data is available, i.e. Czech/German and Czech/French, a value in the range of 1.03-1.04 seems to be a better choice. Aiming at one threshold for all language pairs, we chose a value of 1.04. It seems to be a good compromise for most language pairs. However, for the open release of this corpus, we provide all mined sentence with a margin of 1.02 or better. This would enable end users to choose an optimal threshold for their particular applications. However, it should be emphasized that we do not expect that many sentence pairs with a margin as low as 1.02 are good translations.

For comparison, we also trained NMT systems on the Europarl corpus V7 (Koehn, 2005) , i.e. professional human translations, first on all available data, and then on the same number of sentences than the mined ones (see Table 3 ). With the exception of Czech/French, we were able to achieve better BLEU scores with the automatically mined bitexts in Wikipedia than with Europarl of the same size. Adding the mined text to the full Europarl corpus, also leads to further improvements of 1.1 to 3.1 BLEU. We argue that this is a good indicator of the quality of the automatically extracted parallel sentences.

5. RESULT ANALYSIS:

We run the alignment process for all possible combinations of languages in Wikipedia. This yielded 1620 language pairs for which we were able to mine at least ten thousand sentences. Remember that mining L 1 → L 2 is identical to L 2 → L 1 , and is counted only once. We propose to analyze and evaluate the extracted bitexts in two ways. First, we discuss the amount of extracted sentences (Section 5.1). We then turn to a qualitative by training NMT systems for all language pairs with more than twenty-five thousand mined sentences (Section 5.2).

5.1. QUANTITATIVE ANALYSIS:

Due to space limits, Table 4 summarizes the number of extracted parallel sentences only for languages which have a total of at least five hundred thousand parallel sentences (with all other languages at a margin threshold of 1.04). Additional results are given in Table 6 in the Appendix.

There are many reasons which can influence the number of mined sentences. Obviously, the larger the monolingual texts, the more likely it is to mine many parallel sentences. Not surprisingly, we observe that more sentences could be mined when English is one of the two languages. Let us point out some languages for which it is usually not obvious to find parallel data with English, namely Indonesian (1M), Hebrew (545k), Farsi (303k) or Marathi (124k sentences). The largest mined texts not involving English are Russian/Ukrainian (2.5M), Catalan/Spanish (1.6M), between the Romance languages French, Spanish, Italian and Portuguese (480k-923k), and German/French (626k).

It is striking to see that we were able to mine more sentences when Galician and Catalan are paired with Spanish than with English. On one hand, this could be explained by the fact that LASER's multilingual sentence embeddings may be better since the involved languages are linguistically very similar. On the other, it could be that the Wikipedia articles in both languages share a lot of content, or are obtained by mutual translation.

Services from the European Commission provide human translations of (legal) texts in all the 24 official languages of the European Union. This N-way parallel corpus enables training of MT system to directly translate between these languages, without the need to pivot through English. This is gives the number of lines in the monolingual texts after deduplication and LID.

Src/Trgar bg bs cs da de el en eo es frfr-ca gl he hr hu id it ja ko mk nb nl pl ptpt-br ro ru sk sl sr sv tr uk vizh-cnzh-tw ar 4.9 1.8 3.0 4.5 3.8 6.720.3 4.113.212.2 9.0 5.6 3.5 2.2 2.7 9.2 9.9 4.2 5.3 5.5 4.9 4.4 3.012.0 12.2 5.6 5.6 1.5 2.7 1.2 4.0 2.4 4.512.3 8.2 4.9 bg 3.0 4.2 6.7 8.7 8.510.025.3 7.716.314.7 11.9 8.4 3.2 6.4 4.710.312.2 4.0 5.416.2 8.1 7.7 6.314.7 15.4 9.812.4 4.0 6.4 2.7 7.1 2.410.411.7 6.4 4.7 bs 1.2 6.1 4.1 3.7 5.8 4.521.7 9.9 6.7 4.6 5.7 1.030.9 2.4 5.3 6.5 1.4 12.9 3.8 2.9 9.9 10.9 5.7 4.8 3.110.410.6 4.4 1.5 5.4 5.8 2.8 1.8 cs 1.9 7.8 3.7 7.1 8.3 6.420.010.412.611.4 8.6 5.0 2.5 6.5 4.9 7.8 9.6 4.1 5.5 5.0 6.3 7.6 8.110.8 12.1 6.3 9.428.1 6.7 1.6 7.0 2.6 7.8 9.0 6.6 4.7 da 2.0 8.9 4.0 5.2 14.0 9.032.9 6.716.716.7 12.8 7.3 3.5 4.4 4.710.813.4 4.7 6.0 6.233.112.4 4.814.0 16.2 8.5 7.8 3.1 5.2 1.425.8 2.7 6.311.2 7.3 4.9 de 2.4 9.7 4.9 8.116.9 7.824.515.917.418.3 14.7 6.8 4.3 5.5 7.2 8.613.5 6.4 6.6 5.611.517.6 6.814.2 15.2 8.7 9.2 5.4 8.6 1.512.7 3.6 7.811.3 9.2 4.3 el 4.111.2 4.8 5.5 9.7 6.7 27.9 8.018.816.3 13.510.1 4.0 5.6 5.313.115.3 5.5 6.110.2 9.3 8.7 5.118.0 18.310.4 8.4 3.1 6.4 2.0 7.2 3.4 7.214.4 8.7 5.3 en 11. 923.914.715.530.920.427.1 22.635.832.6 25.124.317.318.813.528.829.510.218.621.831.825.112.031.4 37.020.417.413.816.5 5.529.110.317.626 .9 18.0 10.7 eo 1.8 6.4 7.3 7.413.5 8.123.1 16.117.6 12.710.5 1.9 3.0 4.8 9.213.9 2.5 4.8 6.2 7.212.1 6.712.4 16.0 6.9 8.6 7.4 5.6 0.6 8.8 1.8 5.4 7.7 5.2 3.6 es 6.214.3 6.8 8. 015.712.916.433.213.5 25.6 19.930.1 8.1 8.7 7.716.123.8 7.9 9.911.913.314.1 8.127.6 27.814.711.6 2.6 7.3 4.7 2.9 7.4 5.3 8.523.4 9.234.416.0 15.2 2.5 3.5 2.8 9.819.3 3.6 4.2 5.6 6.9 6.5 4.322.4 23.7 7.7 5.9 1.7 3.1 0.2 4.3 2.3 3.9 9.4 5.8 4.2 he 3.4 5.7 1.8 3.7 6.1 5.4 6.325.7 4.215.313.6 10.3 5.1 2.5 3.2 8.911.2 4.1 4.5 4.6 5.4 6.5 3.713.7 15.0 6.3 8.0 1.9 2.6 1.0 5.2 1.8 5.110.7 6.9 4.6 hr 1.6 8.729.9 7.0 6.5 5.8 6.624.4 4.412.6 9.9 7.8 5.7 1.5 4.3 8.210.4 1.8 4.014.1 5.3 6.1 5.412.1 12.6 7.3 8.3 4.612.611.7 6.0 1.9 6.9 9.4 4.8 2.9 hu 1.6 5.6 2.6 5.9 7.0 5.516.7 6.510.810.9 9.3 3.9 2.1 3.6 6.6 8.2 4.4 6.2 3.9 4.5 6.0 4.3 9.7 9.9 7.1 5.8 3.4 4.2 1.2 5.3 3.0 4.4 8.5 6.5 4.2 id 4.1 9.1 4.2 5.210.1 6.711.124.9 8.216.415.1 11.1 9.9 5.1 5.6 5.2 12.7 5.8 9.1 7.010.0 9.4 5.514.6 16.7 9.8 8.1 3.6 5.6 1.8 9.3 4.6 7.318.5 11.0 6.2 it 5.311.7 5.0 6. 913.111.514.530.013.926.424 .9 20.019.3 6.2 7.0 6.714.0 7.3 9.0 9.913.312.8 7.322.8 24.913.310.2 5.4 7.1 2.311.9 4.6 8.815.3 10.7 5.8 ja 1.4 1.9 0.7 1.8 3.1 2.7 2.5 7.9 2.2 6.0 6.0 4.7 2.3 1.4 1.3 2.0 3.5 4.6 16.9 1.6 2.6 3.1 1.8 5.1 4.9 2.8 2.7 1.2 1.8 0.5 2.6 1.9 2.2 5.9 ko 0.9 1.7 1.3 2.0 1.7 1.7 8.7 1.3 4.7 4.4 3.4 1.5 0.9 0.7 1.5 3.1 3.2 9.2 1.2 1.3 1.9 1.4 4.3 4.6 2.0 2.1 1.0 1.5 0.4 1.5 1.4 1.5 4.3 mk 2.418.212.0 5.4 7.2 4.310.323.4 8.915.211.5 10.0 5.4 4.012.6 3.7 8.911.1 3.5 4.7 7.5 6.7 4.513.9 15.6 8.3 7.5 3.5 7.1 3.7 5.6 2.0 6.410.9 6.3 4.3 nb 2.7 8.5 5.432.7 9.8 8.935.1 9.517.014.6 8.0 3.1 3.9 4.5 9.915.0 5.5 5.7 6.7 4.714.2 9.5 7.5 3.2 3.9 0.626.3 1.9 6.2 7.8 nl 2.4 8.2 2.9 5.914.216.1 8.426.513.416.816.7 13.5 7.3 3.9 4.8 5.311.413.3 5.2 5.9 5.9 5.313.8 15.4 7.8 7.6 4.1 5.1 1.611.1 3.2 6.110.6 8.0 5.1 pl 1.8 7.4 2.9 8.2 6.6 6.5 5.415.1 7.511.411.3 8.6 5.2 2.3 4.8 4.0 7.5 8.6 4.2 5.7 5.2 4.1 6.2 9.6 9.9 6.2 9.5 6.2 5.3 1.5 5.6 2.4 8.9 7.7 6.3 3.6 pt 7.415.2 7.0 8. 015.513.218.735.012.032.426.7 19.023.0 8.810.3 8.417.524.4 7.810.613.114.314 .9 8.9 15.311.7 6.6 8.1 2.014.3 6.2 9.318.0 12.9 5.8 pt-br 6.514.7 7.4 8. 616.812.917.637.316.031.026.6 20.323.0 8.7 9.8 8.118.624.8 7.810.712.5 14.8 8.5 15.111.8 6.4 8.9 2.814.6 5.310.818.8 13.2 6.7 ro 3.2 9.7 3.7 5.1 9.4 7.510.425.0 6.718.819.3 14.610.0 4.0 5.7 5.911.015.5 4.3 6.4 7.3 8.0 8.1 5.215.4 17.7 8.0 3.6 5.0 1.9 7.0 3.3 6.612.7 7.8 4.9 ru 3.312.6 4.2 7.7 8.5 8.8 8.318.7 9.914.314.5 11.0 6.0 4.9 6.8 5.6 9.511.7 6.1 7.7 7.4 8.0 8.1 8.912.4 13.9 8.2 5.8 5.4 2.7 8.2 2.922.511.5 9.1 5.2 sk 0.7 5.1 2.727.0 4.3 5.7 3.216.9 9.3 9.4 8.5 6.7 2.7 1.0 5.1 3.7 4.9 6.9 2.2 3.9 3.5 4.9 5.0 7.1 7.8 8.5 3.5 6.6 5.0 1.5 4.3 1.6 5.4 5.4 2.3 2.5 sl 1.2 6.2 7.6 5.5 4.7 7.6 5.817.3 5.911.4 8.5 6.4 3.2 1.211.2 3.9 6.5 7.8 2.7 4.2 6.3 4.3 5.5 4.8 9.9 4.8 5.9 3.6 1.9 4 4.8 5.926.512.6 8.131.811.016.915.7 10.7 7.1 3.3 5.5 5.411.613.3 4.8 6.2 5.225.411.5 5.815.0 17.4 7.9 8.1 3.8 4.7 1.0 3.2 6.912.9 7.8 4.8 tr 2.2 3.5 2.0 2.6 3.9 4.1 4.715.9 2.9 9.4 7.7 6.7 3.6 1.6 2.1 3.4 6.7 6.4 4.3 7.0 3.5 3.1 4.2 2.5 9.0 8.4 4.6 4.0 1.8 2.3 0.8 3.5 3.3 8.2 6.7 4.4 uk 2.912.3 5.3 7.4 7.5 7.5 8.420.7 6.514.214.1 11.2 5.5 3.5 6.6 4.7 9.511.2 4.9 5.8 7.2 6.3 6.9 9.6 12.9 7.223.5 4.9 5.7 2.6 6.9 2.6 11.4 7.9 4.9 vi 4.2 7.5 4.0 4.7 8.5 6.0 8.820.2 7.313.713.2 9.9 6.5 4.6 4.9 4.714.710.7 5.6 9.3 6.9 5.7 7.3 4.513.0 14.1 8.5 7.2 3.4 4.6 1.7 8.2 4.0 6.7 9.9 6.7 zh-cn 2.1 3.2 1.0 2.2 3.8 3.2 4.511.8 3.8 8.2 7.6

3.2 1.7 1.9 3.0 6.6 6.0 3.4 3.8 2.2 7.1 7.9 4.1 4.1 1.6 2.4 0.9 3.1 2.3 3.010.8 zh-tw 2.2 3.1 1.1 2.1 3.7 2.8 3.910.7 3.4 7.5 7.2 6.1 2.8 1.8 1.6 3.0 6.2 5.4

2.8 3.5 2.3 6.3 6.9 3.5 3.9 1.4 2.1 0.9 3.0 2.4 2.910.0

Table 5 : BLEU scores on the TED test set as proposed in (Qi et al., 2018) . NMT systems were trained on bitexts mined in Wikipedia only (with at least twenty-five thousand parallel sentences).

No other resources were used.

usually not the case when translating between other major languages, for example in Asia. Let us list some interesting language pairs for which we were able to mine more than hundred thousand sentences: Korean/Japanese (222k), Russian/Japanese (196k), Indonesian/Vietnamese (146k), or Hebrew/Romance languages (120-150k sentences).

Overall, we were able to extract at least ten thousand parallel sentences for 85 different languages. 13 For several low-resource languages, we were able to extract more parallel sentences with other languages than English. These include, among others, Aragonse with Spanish, Lombard with Italian, Breton with several Romance languages, Western Frisian with Dutch, Luxembourgish with German or Egyptian Arabic and Wu Chinese with the respective major language.

Finally, Cebuano (ceb) falls clearly apart: it has a rather huge Wikipedia (17.9M filtered sentence), but most of it was generated by a bot, as for the Waray language 14 . This certainly explains that only a very small number of parallel sentences could be extracted. Although the same bot was also used to generate articles in the Swedish Wikipedia, our alignments seem to be better for that language.

5.2. QUALITATIVE EVALUATION:

Aiming to perform a large-scale assessment of the quality of the extracted parallel sentences, we trained NMT systems on the extracted parallel sentences. We identified a publicly available data set which provide test sets for many language pairs: translations of TED talks as proposed in the context of a study on pretrained word embeddings for NMT 15 (Qi et al., 2018) . We would like to emphasize that we did not use the training data provided by TED -we only trained on the mined sentences from Wikipedia. The goal of this study is not to build state-of-the-art NMT system for for the TED task, but to get an estimate of the quality of our extracted data, for many language pairs. In 13 99 languages have more than 5,000 parallel sentences. 14 https://en.wikipedia.org/wiki/Lsjbot 15 https://github.com/neulab/word-embeddings-for-nmt particular, there may be a mismatch in the topic and language style between Wikipedia texts and the transcribed and translated TED talks.

For training NMT systems, we used a transformer model from fairseq (Ott et al., 2019) with the parameter settings shown in Figure 2 in the appendix. For preprocessing, the text was tokenized using the Moses tokenizer (without true casing) and a 5000 subword vocabulary was learnt using SentencePiece (Kudo & Richardson, 2018) . Decoding was done with beam size 5 and length normalization 1.2.

We evaluate the trained translation systems on the TED dataset (Qi et al., 2018) . The TED data consists of parallel TED talk transcripts in multiple languages, and it provides development and test sets for 50 languages. Since the development and test sets were already tokenized, we first detokenize them using Moses. We trained NMT systems for all possible language pairs with more than twentyfive thousand mined sentences. This gives us in total 1886 language pairs in 45 languages. We train L 1 → L 2 and L 2 → L 1 with the same mined bitexts L 1 /L 2 . Scores on the test sets were computed with SacreBLEU (Post, 2018) . Table 5 summarizes all the results. Due to space constraints, we are unable to report BLEU score for all language combinations in that table. Some additional results are reported in Table 7 in the annex. 23 NMT systems achieve BLEU scores over 30, the best one being 37.3 for Brazilian Portuguese to English. Several results are worth mentioning, like Farsi/English: 16.7, Hebrew/English: 25.7, Indonesian/English: 24.9 or English/Hindi: 25.7 We also achieve interesting results for translation between various non English language pairs for which it is usually not easy to find parallel data, e.g. Norwegian ↔ Danish ≈33, Norwegian ↔ Swedish ≈25, Indonesian ↔ Vietnamese ≈16 or Japanese / Korean ≈17.

Our results on the TED set give an indication on the quality of the mined parallel sentences. These BLEU scores should be of course appreciated in context of the sizes of the mined corpora as given in Table 4 . Obviously, we can not exclude that the provided data contains some wrong alignments even though the margin is large. Finally, we would like to point out that we run our approach on all available languages in Wikipedia, independently of the quality of LASER's sentence embeddings for each one.

6. CONCLUSION:

We have presented an approach to systematically mine for parallel sentences in the textual content of Wikipedia, for all possible language pairs. We use a recently proposed mining approach based on massively multilingual sentence embeddings (Artetxe & Schwenk, 2018a ) and a margin criterion (Artetxe & Schwenk, 2018b) . The same approach is used for all language pairs without the need of a language specific optimization. In total, we make available 135M parallel sentences in 85 languages, out of which only 34M sentences are aligned with English. We were able to mine more than ten thousands sentences for 1620 different language pairs. This corpus of parallel sentences is freely available. 16 We also performed a large scale evaluation of the quality of the mined sentences by training 1886 NMT systems and evaluating them on the 45 languages of the TED corpus (Qi et al., 2018) .

This work opens several directions for future research. The mined texts could be used to first retrain LASER's multilingual sentence embeddings with the hope to improve the performance on low-resource languages, and then to rerun mining in Wikipedia. This process could be iteratively repeated. We also plan to apply the same methodology to other large multilingual collections. The monolingual texts made available by ParaCrawl or CommonCrawl17 are good candidates.

We expect that the WikiMatrix corpus has mostly well-formed sentences and it should not contain social media language. The mined parallel sentences are not limited to specific topics like many of the currently available resources (parliament proceedings, subtitles, software documentation, . . .), but are expected to cover many topics of Wikipedia. The fraction of unedited machine translated text is also expected to be low. We hope that this resource will be useful to support research in multilinguality, in particular machine translation.

A APPENDIX:

Table 6 provides the amounts of mined parallel sentences for languages which have a rather small Wikipedia. Aligning those languages obviously yields to a very small amount of parallel sentences. Therefore, we only provide these results for alignment with high resource languages. It is also likely that several of these alignments are of low quality since the LASER embeddings were not directly trained on most these languages, but we still hope to achieve reasonable results since other languages of the same family may be covered. Table 6 : WikiMatrix (part 2): number of extracted sentences (in thousands) for languages with a rather small Wikipedia. Alignments with other languages yield less than 5k sentences and are omitted for clairty.

Table 2 gives the detailed configuration which was used to train NMT models on the mined data in Section 5.

--arch transformer --share-all-embeddings --encoder-layers 5 --decoder-layers 5 --encoder-embed-dim 512 --decoder-embed-dim 512 --encoder-ffn-embed-dim 2048 --decoder-ffn-embed-dim 2048 --encoder-attention-heads 2 --decoder-attention-heads 2 --encoder-normalize-before --decoder-normalize-before --dropout 0.4 --attention-dropout 0.2 --relu-dropout 0.2 --weight-decay 0.0001 --label-smoothing 0.2 --criterion label smoothed cross entropy --optimizer adam --adam-betas '(0.9, 0.98)' --clip-norm 0 --lr-scheduler inverse sqrt --warmup-update 4000 --warmup-init-lr 1e-7 --lr 1e-3 --min-lr 1e-9 --max-tokens 4000 --update-freq 4 --max-epoch 100 --save-interval 10 Finally, Table 7 gives the BLEU scores on the TED corpus when translating into and from English for some additional languages.

Lang xx → en en → xx et 15.9 14.3 eu 10.1 7.6 fa 16.7 8.8 fi 10.9 10.9 lt 13.7 10.0 hi 17.8 21.9 mr 2.6 3.5

Table 7 : BLEU scores on the TED test set as proposed in (Qi et al., 2018) . NMT systems were trained on bitexts mined in Wikipedia only. No other resources were used.

:

Anonymized for review

https://en.wikipedia.org/wiki/Wikipedia:Translation

https://github.com/facebookresearch/LASER

http://www.paracrawl.eu/

https://linguatools.org/tools/corpora/wikipedia-parallel-titles-corpora/

Strictly speaking, Cebuano and Swedish are larger than German, yet mostly consist of template/machine translated text https://en.wikipedia.org/wiki/List_of_Wikipedias

https://github.com/facebookresearch/faiss

https://github.com/facebookresearch/faiss/wiki/Faiss-indexes

https://dumps.wikimedia.org/other/cirrussearch/

https://pypi.org/project/sentence-splitter/

The Cebuano and Waray Wikipedia were largely created by a bot and contain more than 65% of duplicates.

https://fasttext.cc/docs/en/language-identification.html

Anonymized for review

http://commoncrawl.org/

Figures and Tables:

Figure 1: BLEU scores (continuous lines) for several NMT systems trained on bitexts extracted from Wikipedia for different margin thresholds. The size of the mined bitexts are depicted as dashed lines.

Figure 2: Model settings for NMT training with fairseq

Architecture of the system used to train massively multilingual sentence embeddings. SeeArtetxe & Schwenk (2018a)  for details.

Table content: <table/>

Comparison of NMT systems trained on the Europarl corpus and on bitexts automatically mined in Wikipedia by our approach at a threshold of 1.04. We give the number of sentences (first line) and the BLEU score (second line of each bloc) on newstest2014.

Table content: <table><tr><td>Bitexts</td><td colspan="4">de-en de-fr cs-de cs-fr</td></tr><tr><td/><td colspan="4">1.9M 1.9M 568k 627k</td></tr><tr><td>Europarl</td><td>21.5</td><td>23.6</td><td>14.9</td><td>21.5</td></tr><tr><td/><td colspan="4">1.0M 370k 200k 220k</td></tr><tr><td/><td>21.2</td><td>21.1</td><td>12.6</td><td>19.2</td></tr><tr><td>Mined</td><td colspan="4">1.0M 372k 201k 219k</td></tr><tr><td>Wikipedia</td><td>24.4</td><td>22.7</td><td>13.1</td><td>16.3</td></tr><tr><td>Europarl</td><td colspan="4">3.0M 2.3M 768k 846k</td></tr><tr><td>+ Wikipedia</td><td>25.5</td><td>25.6</td><td>17.7</td><td>24.0</td></tr></table>

be bg bn bs ca cs da de el en eo es et eu fa fi fr gl he hi hr hu id is it ja kk ko lt mk ml mr ne nl no oc pl pt ro ru sh si sk sl sq sr sv sw ta te tl tr tt uk WikiMatrix: number of extracted sentences for each language pair (in thousands), e.g. Es-Ja=219 corresponds to 219,260 sentences (rounded). The column "size"

Table content: <table><tr><td>size az ba</td><td/></tr><tr><td>Language</td><td>Family</td></tr><tr><td>ISOName</td><td/></tr></table>

Peer review (iclr2020):
The paper creates a large dataset for machine translation, called WikiMatrix, that contains 135M parallel sentences in 1620 language pairs from Wikipedia. The paired sentences from different languages are mined based on the sentence embeddings. Training NMT systems based on the mined dataset, and comparing with those trained based on existing dataset, the authors claim that the quality of the dataset is good. The effect of thresholding values of similarity scores for selecting parallel sentences is studied. Since the data is huge, dimension reduction and data compression techniques are used for efficient mining. The study is the first one that systematically mine for parallel sentences of Wikipedia for a large number of languages. The results are solid and the dataset is valuable for research in multilinguality.