Text classification is one of the main applications of Natural Language Processing (NLP). However, like the majority of NLP tasks, text classification methods tend to focus on English or a handful of other languages that have text corpora of hundreds of millions of words. This is contributing to a new flavor of the digital divide: the AI divide, an inequality in the access to, use of, or impact of AI. Several technology companies are now addressing the digital divide with ”next billion users” initiatives. In NLP, transfer-based approaches, such as Cross-Lingual Text Classification (CLTC) - the task of categorizing texts written in different languages into a common taxonomy, are a promising solution.
The first CLTC studies, appearing as early as Bel N. (2003)
, range from creating a single classifier for several languages by pooling the training data to training a monolingual classifier and using the translation of important terms for the other languages. Since then, the face of NLP, including CLTC, has been transformed by embeddings. Word embeddings have become a widely adopted way to transfer information from large unlabeled datasets to downstream tasks, such as sentiment analysis (Maas et al. (2011)2016)) or dialogue management systems (Yan et al. (2016)).
While most applications of embeddings transfer knowledge across tasks for the same language (English), multilingual embeddings aim to learn a representation common to multiple languages at the same time, making them a perfect addition to the CLTC toolbox. Indeed, a simple averaged perceptron-based CLTC is a common benchmark task to evaluate the quality of bilingual embeddings, by training CLTC on documents in a source language and testing its direct applicability to documents in a different target language.
However, the focus on CLTC as a benchmark has left several gaps. Firstly, there is no systematic comparison between CLTC with monolingual versus multilingual embeddings. Secondly, it is not clear whether and which neural architecture gives the best results for CLTC. And finally and most importantly, the multilingual embeddings are fed as such to the CLTC, treating them as universal feature representation, while recent work has shown that encoding words in context significantly improves performance in a variety of NLP tasks, for example, by transferring the encoder of a machine translation system McCann et al. (2017) or by multi-tasking the multilingual embeddings learning alongside with the CLTC learning.
In this paper, we address the above gaps, by establishing a comprehensive, systematic benchmarking framework 111To be open-sourced after publication. for surveying the performance of various types of embeddings on different variations of CLTC architectures. The components of the framework, corresponding to our main contributions are:
Several CLTC architectures, adjusted to be fed directly with mono-/multi-lingual embeddings, thus enabling mono-/multi-lingual training and the comparison between the two modes (Section 3.1).
A representative set of state-of-the-art multilingual embeddings, obtained either via training from scratch or via offline linear projection methodologies
(e.g., Singular Value Decomposition (SVD), Canonical Correlation Analysis (CCA), Attract-Repel).
A multi-tasking architecture that fine-tunes multilingual embeddings alongside the CLTC training, thus specializing them to the CLTC task (Section 3.2)
Our experiments (Section 5) with two flavors of CLTC (long news stories to be classified by topics versus short tweets to be classified for churn intent) show that the multilingual approach clearly benefits low-resource languages and that multilingual training outperforms language-specific models for each language.
2 Related Work
In previous work, the quality of multilingual embeddings is either evaluated intrinsically by directly testing their ability to capture syntactic and semantic relationships between words. Such benchmarks include word similarity, word translation, and correlation-based evaluation. Extrinsically, those multilingual models are evaluated on their performance when used as input features to downstream semantic transfer tasks.
One of the main downstream application of multilingual word embeddings is Cross-Lingual Document Classification benchmark (CLDC) initially defined in Klementiev et al. (2012)
. They train a model on labeled documents in a source language and apply it directly to classify unlabeled documents in a target language. This aims to test the ability of multilingual embeddings to act as important agents in direct transfer learning. However, a comparison between the performance using monolingual versus multilingual embeddings is missing.Zhou et al. (2015) propose a methodology to learn a cross-lingual representation of sentiment information to enable sentiment classification (CLSC). They jointly train bilingual embeddings using the documents annotated with sentiments and their translations to other languages and show that the multilingual approach outperforms monolingual training.
Other work that multi-task training the multilingual embeddings with the task at hand include Wang et al. (2017)2016)
propose a model that jointly learns to embed and predict classes of multilingual documents by optimizing for a loss that combines a cross-lingual training loss with a supervised document classification loss using logistic regression. Despite the simplicity of each loss component, this model manages to surpass other state-of-the-art models. The shown gain in performance in this work motivates us to investigate a multi-tasking model where a more complex model is adapted for document classification. To the best of our knowledge, we are the first to compare the gain when multilingual embeddings are used across different independent and multi-tasking architectures.
3 A Framework for Benchmarking Embeddings in CLTC Tasks
In what follows, we describe the different neural network models used for CLTC at different levels of complexity and how we apply them to the multilingual setting either by directly incorporating different kinds of already trained multi-embeddings or by training the embeddings alongside with the task.
3.1 Cross-Lingual Text Classification using Pre-trained Embeddings
The different variations of plain text classification models to which pre-trained embeddings are directly fed are represented in Fig. 1. In addition to fine-tuned multi-layer perceptron (FT-MLP) in Fig. 1(a) which is an extension of Klementiev et al. (2012)
averaged perceptron, we implement and evaluate other extensions namely: multi-filter convolutional neural networks and bi-directional GRU with attention. Before describing them, we explain briefly the rationale used to reproduce the set of pre-trained multilingual embeddings we work with.
3.1.1 Pre-trained Multilingual Embeddings
We obtain and reproduce several multilingual embeddings to draw fair conclusions on the potential gain of a multilingual approach applied to text classification. They have been chosen to comply with previous work proving that models with higher levels of supervision tend to perform the best Upadhyay et al. (2016). We cover a wide range of supervised methodologies to work with both models fine-tuned on top of monolingual embeddings and those trained from scratch.
Fine-tuned multilingual embeddings models are built on top of monolingual embeddings by mapping words from different languages into one joint target space. We set English as the target space, and we learn the linear transformation that aligns other languages to English using bilingual translation pairs. We evaluate two offline fine-tuned approaches. The first variant uses Singular Value Decomposition (SVD) following the work ofSmith et al. (2017) to produce two versions based on the type of bilingual dictionaries used: using ground truth dictionaries and using matching strings. The other variant is which uses Canonical Correlation Analysis (CCA).
We follow Attract-Repel methodology of Mrksic et al. (2017) for generating semantically specialized multilingual embeddings
by injecting monolingual and cross-lingual synonyms and antonyms as linguistic constraints to monolingual distributional vectors. We include more details on how the alignment from bilingual to multilingual is solved using VowPal Wabbit tool in AppendixA.
Trained from scratch models are optimized using either cross-lingual only or both monolingual and cross-lingual constraints. The first type follows a sentence alignment approach to optimize cross-lingual objective which consists of minimizing the distance between parallel sentences from different languages as described in Appendix C. The second type of embeddings uses skip-gram objective modified for multilingual setting as introduced by Luong et al. (2015).
3.1.2 Multi-Filter CNN (MF-CNN)
We build a multi-filter CNN where convolutions of different kernel sizes are applied and concatenated as described in the work of Kim (2014) and shown in Fig. 1(b). This architecture works better than a single-filter CNN as it is shown to over-fit less.
Given an input text which consists of the concatenation of n words, an embeddings layer is used to convert the words into their corresponding m dimensional embeddings vectors , , … and . The input to the convolution is then the concatenation of the word vectors: . We apply a two-dimensional convolution operation which consists of applying a filter of a window of shape: where k is the number of words and m is the entire embeddings dimensionality to be traversed at a time.
In the end, an output feature is produced from each consecutive window of words using the following equation: where W and b are the weights and bias terms and f is a non-linearity. By applying each filter times, we obtain feature maps. In order to concatenate different feature maps from each filter type of sizes (, ,
and so on), we apply max pooling as described inCollobert et al. (2011)
. Then, we apply a dropout regularization to the concatenated feature before feeding the output to a dense layer with softmax activation to convert it to a probability distribution over the set of labels.
3.1.3 Bi-directional GRU with Attention (bi-GRU-Att)
We use a non-hierarchical version of bi-directional GRU with attention model as shown in1(c). GRU is used instead of LSTM since it more lightweight and faster to train while keeping comparable performance Chung et al. (2014). We encode the input both in its forward and backward directions to encapsulate both the past and future. On top of that, we use an attention mechanism Bahdanau et al. (2014) to get a measure of which words are more important by assigning weights of importance.
Formally, at each time step t, the GRU computes the output state as a function of the previous hidden state and the update gate , dropping the forget gate as follows: . We encode each sentence where are the embeddings vector for word using GRU in the forward and backward directions: and computed for each word . Those states then are concatenated to form the encoded representation for each word: .
Attention weights are computed using a dense layer over all encoders’ states as shown in Eq. 1. Then, those scores are normalized and a probability distribution is obtained using softmax as in Eq. 2. The sentence representation is simply the weighted sum of the different encoder states by the attention weights as in Eq. 3.
where and are the weights and bias of the dense layer, is the context vector that gives a high level representation of a fixed query on the words and is initialized randomly and learned during the training process.
3.1.4 Loss Function
We use a weighted categorical cross entropy loss which is defined as follows:
where is the number of testing instances, is the weight attributed to each instance corresponding to its class, is the true label and is the prediction. The weights are inversely proportional to the distribution of classes to circumvent the possibility of over-fitting that can be caused by an imbalanced label distribution and are computed as follows:
3.2 Specialized Multilingual Embeddings
In addition to directly applying multilingual embeddings trained independently to text classification task, we investigate training them along with the task at hand in an end-to-end multi-tasking fashion.
Figure 2 depicts the main components of the followed architecture. The left-hand side fine-tunes multilingual embeddings using sentence alignment while the right-hand side optimizes for document classification using hierarchical bidirectional GRU attention network. The two tasks share a single embeddings layer which is tuned by the two tasks. Other layers which are shared between the tasks include word level GRU units and attention activation.
3.2.1 Sentence Alignment (Sent-Ali)
The goal of this component is to construct sentence embeddings out of word embeddings using the weighted average of the output of bi-GRU states, a representation which can encapsulate word order and their importance and is more useful than taking the plain average of word embeddings. Let and be the bi-GRU encoded representation of the source and target sentences in the alignment pair (, ) respectively. The loss
is reversely proportional to the cosine similarity between each pair (,
) in addition to an l2-regularizer to avoid exploding gradient problem as follows:
where is an arbitrarily fixed scalar that is experiment specific and is the training weights.
3.2.2 Hierarchical Bidirectional GRU-Attention Networks (bi-GRU-Att)
The goal of this component is to come up with a hierarchical representation for documents (only relevant for CLDC). Unlike Yang et al. (2016), we use a bidirectional GRU with attention at different levels. More specifically, we construct document representation using sentence encodings where each sentence representation is built from word representations where both levels of encodings use bidirectional GRUs with attention.
3.2.3 Learning Methodology
4 Experimental Setup
In this section, we present the approach used to compare the performance of different embeddings models and text classification architectures including datasets used for the evaluation, how experiments are designed and how models are trained.
4.1.1 Cross-Lingual Document Dataset
The dataset used for CLDC is the Reuters RCV1/RCV2 corpora described in Lewis et al. (2004)222We obtain it under a NIST license http://trec.nist.gov/data/reuters/reuters.html. We choose to work with this dataset since it has a sufficient amount of training instance and has been extensively used in prior research on the evaluation of multilingual embeddings which enables easy comparison with other work. RCV1 consists of about 810,000 English newswire stories, while RCV2 contains over 487,000 news stories in thirteen other languages333The thirteen languages are: Dutch, French, German, Chinese, Japanese, Russian, Portuguese, Spanish, Latin American Spanish, Italian, Danish, Norwegian, and Swedish all made available by Reuters, Ltd.
We follow the same cross-lingual document classification benchmark defined in Klementiev et al. (2012) and work on a multi-classification task with at most one single label per document among four high-level topic categories: CCAT (Corporate/Industrial), ECAT (Economics), GCAT (Government/Social), and MCAT (Markets). Table 1 shows the distribution of training, validation and testing instances per language which make up 60%, 20% and 20% out of the dataset respectively.
4.1.2 Cross-Lingual Churn Datasets
We use churn datasets from two languages: English and German. The English dataset Amiri and Daume (2015), , contains tweets mentioning the following telecommunication brands: Verizon, AT&T or T-Mobile. A churny tweet is one that mentions a particular brand that the Twitter user expresses an intent to leave. There are 4854 tweets in total with an annotation confidence above 0.7 out of which only 944 are churny. On the other hand, the German dataset Abbet et al. (2018), , contains a total of 4339 tweets where 611 are churny regarding telecommunication operators active in German-speaking countries.
4.1.3 Multilingual Parallel Sentences Corpus
We use a combination of Europarl Parallel Corpus v7.1 Koehn (2005), titles from Wikipedia, and parallel news commentary444http://220.127.116.11/multilingual/data/ as our sentence alignment dataset. Extracted from parliament proceedings, Europarl covers over 21 European languages. This extended corpus is chosen because it is commonly used in the literature due to its richness and its large number of instances. The whole dataset consists of around 2.9M, 3.1M and 2.6M sentence pairs for English-German, English-French, and English-Italian.
4.2 Experiment Design
For both CLDC and TCID, we design several experiments for the evaluation of different multilingual embeddings. We train several language specific and multilingual models using different text classification architectures. In both cases, models are trained for each language independently and are used as a baseline against different multilingual embeddings models. In the end, we report only on the best and average multilingual embeddings performances in each case.
For CLDC, we evaluate three models: Fine-Tuned MLP (FT-MLP), Multi-Filter CNN (MF-CNN) and Multi-tasking embeddings with the task (HAN+Sent-Ali). For TCID, we additionally investigate the performance of bidirectional GRU with Attention (bi-GRU-Att). It was not possible to investigate the performance of bi-GRU-Att on CLDC, due to the high number of training documents and the higher number of words per document which imposes a long training time.
Mono: Training on a specific language using monolingual embeddings and testing on
Multi: Training on languages (i.e. for CLDC and for TCID) using multilingual embeddings and testing on , , and for CLDC or and for TCID.
For all models except HAN+Sent-Ali, we run over the whole dataset. However, we only manage to run using 10K instances for HAN+Sent-Ali. This also enables us to test our hypothesis against a low data regime scenario where no language is predominant and how this impacts the gain in performance of multilingual over monolingual. On the other hand, we use the whole churn dataset in all experiments since it is already not that large.
To ensure a fair comparison between different monolingual and multilingual experiments, we use the same hyper-parameters in the design of each text classification architecture independently. In other words, we only change the parameters when switching between architectures but not when switching between monolingual and multilingual training modes. More details about the hyper-parameters used are available in Appendix D. The metrics used for performance evaluation are macro F1-scores, macro precision, and macro recall.
4.3 Pre-trained Embeddings
Monolingual word embeddings are obtained directly from FastText Bojanowski et al. (2017). Details of training and can be found in Appendix A. We obtain and from Ammar et al. (2016) 555We obtain pre-trained 512-dimensional embeddings for up to 13 languages from http://18.104.22.168/multilingual/data/.. The linear projection from bilingual spaces to one multilingual space for is optimized using Vowpal Wabbit tool as explained in Appendix B. Details for training can be found in Appendix C.
summarizes F1-score, precision and recall performance for CLDC task by comparing the different gains of the best multilingual over monolingual training for each text classification architecture. In general, for all languages and all text classification architectures, multilingual training wins over monolingual training with an average improvement in F1-score ofand and for FT-MLP and MF-CNN and HAN+Sent-Ali respectively.
After examining different multilingual embeddings (Appendix E.1 and E.2), we notice that the gain is more or less the same and not as significant as the fluctuations in gains when changing text classification architecture. For these reasons, we report only best performant multilingual model in each case, and we average over all multilingual embeddings for a more concise and clear analysis.
Using FT-MLP, the improvement is well pronounced mostly for Italian (the most resource scarce language) with an increase of in F1-score followed by French and German with increases of and respectively which matches the order of languages in terms of the number of training and validation instances according to Table 1. This finding is similar to MF-CNN and confirms our hypothesis that the less resourced a language is, the more likely it is to benefit from multilingual training. Although there is a gain in performance for English, it is marginal for both architectures (only at most). Obtaining a monolingual performance for English always on par with multilingual performance is not at all surprising as English is the dominant language accounting for more than of the training and validation data.
We notice that MF-CNN performs slightly better than FT-MLP with an across language average gain in performance of and has a lower gap between multilingual and monolingual, which is not counter-intuitive since MF-CNN is more complex than FT-MLP and it has more parameters to train which leads even monolingual models to converge better. This verifies the hypothesis that the gain that comes from multilingual aggregation is more pronounced the more shallow the model is.
On the other hand, performance when multi-Tasking embeddings training alongside with the classification task using HAN architecture is even lower compared to other shallower models like MF-CNN and FT-MLP. This can be explained by the low data regime adopted. The results support our assumption by showing a more significant gain of multilingual over monolingual since all languages are low resourced in this case. For example, higher gain in English in case of HAN+Sent-Ali compared to other models ( for HAN+Sent-Ali versus and for FT-MLP and MF-CNN respectively) is due to the fact that English, in this model, is treated as a low-resourced language as maximum of 10K instances from each language are used for training.
Table 3 compares between results obtained for TCID using different text classification architectures across different training modes and embeddings. The results show that in general multilingual models tend to outperform monolingual baselines for both English and German irrespective of the embeddings model used with an average increase of , and FT-MLP, MF-CNN, and bi-GRU-Att respectively.
We notice that the gap between multilingual and monolingual becomes smaller: , , and for the three architectures from less to more complex which matches our previous finding in CLDC. The difference between the degree of improvement of multilingual versus monolingual for English and German is due to the fact that English dataset has already what it takes to learn classification patterns while German benefits more from the aggregation of more languages to learn complex patterns that are not present in German alone. In all cases, we notice that multilingual embeddings performance are close to each other with an average of and far from monolingual performance for FT-MLP for example. Appendix E.1 and E.2 provide a fine-grained analysis over all multilingual embeddings for CLDC and TCID tasks respectively.
6 Conclusion and Future Work
In this paper, we put in place a systematic multi-dimensional comparative analysis of multilingual embeddings on two variations of Cross-Lingual Text Classification (CLTC) tasks. Our approach has the advantage of being unified for training across languages leveraging different multilingual embeddings methods and an end-to-end benchmark for their evaluation against their monolingual counterparts. The embeddings covered in our analysis span a diverse spectrum of methodologies covering those fine-tuned on top of monolingual embeddings, those trained from scratch, and those learned jointly with the task. We test both in an imbalanced data scenario with English being the most dominant language and in a low data regime and witnessed a consistent gain of multilingual approach especially for low-resource languages for all text classification architectures and for both datasets.
Although this study focuses on four languages at most: English, French, German and Italian, the described models and evaluation strategy can be extended to more languages. Testing more languages especially under-resourced ones can be explored in future work. It is also worth investigating ways of making multi-tasking architecture scalable to test it on the whole imbalanced document dataset.
- Abbet et al. (2018) Christian Abbet, Meryem M’hamdi, Athanasios Giannakopoulos, Robert West, Andreea Hossmann, Michael Baeriswyl, and Claudiu Musat. 2018. Churn intent detection in multilingual chatbot conversations and social media. In Association for Computational Linguistics.
- Amiri and Daume (2015) Hadi Amiri and Hal Daume. 2015. Target-dependent churn classification in microblogs. AAAI, pages 2361–2367.
- Ammar et al. (2016) Waleed Ammar, George Mulcaire, Yulia Tsvetkov, Guillaume Lample, Chris Dyer, and Noah A. Smith. 2016. Massively multilingual word embeddings. CoRR, abs/1602.01925.
- Bahdanau et al. (2014) Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473.
- Bel N. (2003) Villegas M. Bel N., Koster C.H.A. 2003. Cross-lingual text categorization. In European Conference on Research and Advanced Technology for Digital Libraries (ECDL).
- Bojanowski et al. (2017) Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. 2017. Enriching word vectors with subword information. In Transactions of the Association for Computational Linguistics, pages 135–146.
- Chung et al. (2014) Junyoung Chung, Çaglar Gülçehre, KyungHyun Cho, and Yoshua Bengio. 2014. Empirical evaluation of gated recurrent neural networks on sequence modeling. CoRR, abs/1412.3555.
- Collobert et al. (2011) Ronan Collobert, Jason Weston, Léon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel Kuksa. 2011. Natural language processing (almost) from scratch. J. Mach. Learn. Res., 12:2493–2537.
- Conneau et al. (2017) Alexis Conneau, Guillaume Lample, MarcÁurelio Ranzato, Ludovic Denoyer, and Hervé Jégou. 2017. Word translation without parallel data. CoRR, abs/1710.04087.
- Ferreira et al. (2016) Daniel C. Ferreira, André F. T. Martins, and Mariana S. C. Almeida. 2016. Jointly learning to embed and predict with multiple languages. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2019–2028. Association for Computational Linguistics.
- Kim (2014) Yoon Kim. 2014. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, EMNLP 2014, October 25-29, 2014, Doha, Qatar, A meeting of SIGDAT, a Special Interest Group of the ACL, pages 1746–1751.
Klementiev et al. (2012)
Alexandre Klementiev, Ivan Titov, and Binod Bhattarai. 2012.
Inducing crosslingual distributed representations of words.In Proceedings of COLING 2012: Technical Papers, pages 1459–1474, Mumbai, India.
- Koehn (2005) Philipp Koehn. 2005. Europarl: A Parallel Corpus for Statistical Machine Translation. In Conference Proceedings: the tenth Machine Translation Summit, pages 79–86, Phuket, Thailand. AAMT, AAMT.
- Lewis et al. (2004) David D. Lewis, Yiming Yang, Tony G. Rose, and Fan Li. 2004. Rcv1: A new benchmark collection for text categorization research. J. Mach. Learn. Res., 5:361–397.
- 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.
- Maas et al. (2011) Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies - Volume 1, HLT ’11, pages 142–150, Stroudsburg, PA, USA. Association for Computational Linguistics.
- McCann et al. (2017) Bryan McCann, James Bradbury, Caiming Xiong, and Richard Socher. 2017. Learned in translation: Contextualized word vectors. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30, pages 6294–6305. Curran Associates, Inc.
- Mrksic et al. (2017) Nikola Mrksic, Ivan Vulic, Diarmuid Ó Séaghdha, Ira Leviant, Roi Reichart, Milica Gasic, Anna Korhonen, and Steve J. Young. 2017. Semantic specialisation of distributional word vector spaces using monolingual and cross-lingual constraints. CoRR, abs/1706.00374.
- Smith et al. (2017) Samuel L. Smith, David H. P. Turban, Steven Hamblin, and Nils Y. Hammerla. 2017. Offline bilingual word vectors, orthogonal transformations and the inverted softmax. CoRR, abs/1702.03859.
- Upadhyay et al. (2016) Shyam Upadhyay, Manaal Faruqui, Chris Dyer, and Dan Roth. 2016. Cross-lingual models of word embeddings: An empirical comparison. arXiv preprint arXiv:1604.00425.
- Wang et al. (2017) Dingquan Wang, Nanyun Peng, and Kevin Duh. 2017. A multi-task learning approach to adapting bilingual word embeddings for cross-lingual named entity recognition. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 383–388. Asian Federation of Natural Language Processing.
- Wang et al. (2016) Zhibo Wang, Long Ma, and Yanqing Zhang. 2016. A novel method for document summarization using word2vec. 2016 IEEE 15th International Conference on Cognitive Informatics & Cognitive Computing (ICCI*CC), pages 523–529.
- Yan et al. (2016) Zhao Yan, Nan Duan, Junwei Bao, Peng Chen, Ming Zhou, Zhoujun Li, and Jianshe Zhou. 2016. Docchat: An information retrieval approach for chatbot engines using unstructured documents. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 516–525. Association for Computational Linguistics.
- Yang et al. (2016) Zichao Yang, Diyi Yang, Chris Dyer, Xiaodong He, Alexander J. Smola, and Eduard H. Hovy. 2016. Hierarchical attention networks for document classification. In HLT-NAACL.
- Zhou et al. (2015) Huiwei Zhou, Long Chen, Fulin Shi, and Degen Huang. 2015. Learning bilingual sentiment word embeddings for cross-language sentiment classification. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Conference on Natural Language Processing, pages 26–31, Beijing, China.
Appendix A Training Offline Embeddings
We build multilingual embeddings which map words from different languages into one joint vector space by learning translations of monolingual embeddings into a target space. We set English as the target space and we learn the transformation matrix that aligns other languages to English using bilingual translation pairs. In other words, this approach fine-tunes non-English embedding by applying a linear transformation that maps them into the English space.
We learn the alignment on top of monolingual embeddings using the training split of the expert bilingual dictionary where the problem of building bilingual embeddings reduces to learning the linear transformation matrix which maps the source monolingual space into the English space where . Formally, given X and Y monolingual word vector matrices for the source and target spaces, the goal is to learn that maximizes the cosine similarity defined by:
Smith et al. (2017) proves that this optimization objective can be solved directly and efficiently using SVD of the product of the paired dictionary matrices:
The resulting U and V vectors are orthonormal matrices whose product gives us the desired transformation matrix . We also apply dimensionality reduction by keeping only the first rows in matrices U and V which correspond to large values in the diagonal matrix .
We train two variants of this approach: and . For training , we use ground truth bilingual dictionaries as introduced in Conneau et al. (2017)666A large repository of up to 110 bilingual dictionaries covering high and low resource languages is available in https://github.com/facebookresearch/MUSE consisting of translation pairs for each pair of source and target languages (where the target language is always English). Only the train split (consisting of 5000 pairs) is used for training while 1500 pairs are used for testing the quality of the embeddings before feeding them to the downstream applications. For both and , we use dimensionality reduction on top of SVD by considering only the first significant rows corresponding to a value threshold of 1 in the diagonal vector.
Appendix B Training of Semantic Specialized Multilingual Embeddings using using Vowpal Wabbit
To learn the alignment from bilingual to multilingual space, we learn the weights for two linear projections: from EN-FR to EN-DE and from EN-IT to EN-DE to bring the French part of EN-FR and Italian part of EN-IT to the same joint space as EN-DE. We solve each linear projection using logistic regression optimized using stochastic gradient descent.
Here, we describe the approach for learning the mapping . The idea is to make use of the inherent parallelism between the two spaces in the sense that English vectors for words in space EN-FR should be aligned to vectors of the same words in space EN-DE. Formally, let and be the vectors of word i in space EN-FR and EN-DE respectively. So, we learn the matrix such that . This can be solved by minimizing the Euclidean distance between English words shared between the two spaces as follows:
where U and V are embeddings matrices where each row corresponds to vector in EN-FR and EN-DE of each word shared between the two spaces and is the Frobenius norm.
To solve this m-variate linear regression, we use stochastic gradient descent (SGD) which is solved using Vowpal Wabbit, a library that can handle large-scale data efficiently. To comply with VW inability to deal with multidimensional output, we split the problem to single output linear regression sub-problems. Therefore, for each sub-problem, we create a VW file for each embeddings dimensionof . The format of the file looks like:
where n is the number of words, m is the dimensionality of the embeddings. Running optimization for this file results in the column of the desired transformation . In the end, this transformation is applied to French vectors in EN-FR (and Italian vectors in EN-IT with the same methodology) leaving German and English vectors of EN-DE unchanged. We run for 100 passes and Vowpal Wabbit fines tunes by itself the learning parameters.
Appendix C Training Sentence Alignment
Training embeddings by optimizing the cross-lingual objective using sentence alignment means to train a model that maximizes the semantic similarity between parallel sentences. Formally, given pairs of parallel sentences in two languages and , the goal is to find the embeddings matrices and which transform sentences in and to one common space. For that purpose, we minimize the sum of the distances between the embeddings representation of aligned sentences as follows:
where is the total number of aligned sentences, , and and , ,
are regularization terms. Here l1-distance was chosen instead of l2-distance for its robustness against outliers.
We take advantage of monolingual embeddings to initialize with . and are optimized using gradient descent with steps and to optimize and respectively as follows:
where the gradients are computed as follows:
The list of parameters used for our experiment to generate embeddings is as detailed in table 4.
The multilingual extension is straightforward as the bilingual objective function is additive. Therefore, the multilingual objective consists of the sum of multiple bilingual objectives which is equivalent to one bilingual objective where the source language for sentences is any non-English language, and the target is English. Thus, we train multilingual embeddings using a concatenation of all sentences from German, French, and Italian to learn and English sentences to learn .
Appendix D Implementation and Hyperparameter Choices
shows the different hyperparameters used for each model. For FT-MLP, we use a first dense layer with 512 units and rectified linear unit activation prior to the second dense layer that directly precedes softmax activation, a dropout layer of 0.7, an Adam optimizer with learning rate 10-2. For MF-CNN, we use 3 types of filters with kernel sizes 3, 4 and 5 consisting of 200 filters each, a dropout of 0.3 and Adam optimizer with learning rate 10-3. bi-GRU-Att uses 150 GRU units with tanh as an activation function, dropout layer of 0.3 and Adam optimizer 10-3. For multi-tasking experiments, we design hierarchical attention network use bidirectional GRUs consisting of 50 units, and tanh activation function. We use dropout layer of rate 0.5 and alternate training of the two tasks with two different optimization learning rates in order to make them synchronized to each other.
Appendix E Fine Grained results
e.1 Cross-lingual Document Classification
Table 6 shows the fine grained analysis of the performance of different embeddings used for different neural architectures for document classification.
e.2 Cross-lingual Churn Detection
Table 7 shows the fine grained analysis of the performance of different embeddings used for different neural architectures for churn detection.