Cross-Lingual Transfer with MAML on Trees (2021)

Abstract: In meta-learning, the knowledge learned from previous tasks is transferred to new ones, but this transfer only works if tasks are related. Sharing information between unrelated tasks might hurt performance, and it is unclear how to transfer knowledge across tasks that have a hierarchical structure. Our research extends a meta-learning model, MAML, by exploiting hierarchical task relationships. Our algorithm, TreeMAML, adapts the model to each task with a few gradient steps, but the adaptation follows the hierarchical tree structure: in each step, gradients are pooled across tasks clusters and subsequent steps follow down the tree. We also implement a clustering algorithm that generates the tasks tree without previous knowledge of the task structure, allowing us to make use of implicit relationships between the tasks. We show that TreeMAML successfully trains natural language processing models for cross-lingual Natural Language Inference by taking advantage of the language phylogenetic tree. This result is useful since most languages in the world are under-resourced and the improvement on cross-lingual transfer allows the internationalization of NLP models.

## introduction deep learning models require a large amount of data in order to perform well when trained from scratch. when data is scarce for a given task, we can transfer the knowledge gained in a source task to quickly learn a target task, if the two tasks are related. multi-task learning studies how to learn multiple tasks simultaneously with a single model, by taking advantage of task relationships @xcite . however, in multitask learning models, a set of tasks is fixed in advance and they do not generalize to new tasks. instead, meta-learning is inspired by the human abil-ity to learn how to quickly learn new tasks by using the knowledge of previously learned ones. meta-learning has been widely used in multiple domains, especially in recent years since the advent of deep learning @xcite . a successful model for meta-learning, maml @xcite , does not diversify task relationships according to their similarity and it is unclear how to modify it for that purpose. furthermore, there is still a lack of methods for sharing information across tasks that have a hierarchical structure, and the goal of our work is to fill this gap. the use of maml-like algorithms in nlp has just recently been proved successful for natural language inference (nli) and question answering (qa) @xcite . these results represent a practical meta-learning solution to the fundamental problem of applying nlp models to under-resourced languages where data annotation is scarce. this work, combined with the fact that languages can be organized hierarchically using their phylogenetic tree @xcite , motivated us to develop a hierarchical meta-learning algorithm, that we call treemaml. in this work, we make the following contributions: ## related work the problem of quantifying and exploiting task relationships has a long history in multi-task learning and is usually approached by parameter sharing, see @xcite ; @xcite for reviews. however, multi-task learning is fundamentally different from meta-learning as it does not consider the problem of generalizing to new tasks @xcite . recent work includes @xcite , who studies a large number of computer vision tasks and quantifies the transfer between all pairs of tasks. achille et al. (2019) proposes a novel measure of task representation by assigning an importance score to each model parameter in each task. the score is based on each task's loss function gradients with respect to each model parameter. this work suggests that gradients can be used as a measure of task similarity and we use this insight in our proposed algorithm. in meta-learning, a few papers have been recently published on learning and using task relationships. the work of @xcite applies hierarchical clustering to task representations learned by an autoencoder and uses those clusters to adapt the parameters to each task. the model of @xcite maps the classes of each task into the edges of a graph, it meta-learns relationships between classes and how to allocate new classes by using a graph neural network with attention. however, these algorithms are not model-agnostic; they have a fixed backbone and loss function and are thus difficult to apply to new problems. instead, we design our algorithm as a straightforward generalization of model-agnostic meta-learning @xcite ) and it can be applied to any loss function and backbone. a couple of studies looked into modifying maml to account for task similarities. the work of @xcite finds a different initial condition for each cluster of tasks and applies the algorithm to the problem of continual learning. the work of @xcite defines parameter updates for a task by aggregating gradients from other tasks according to their similarity. however, in contrast with our algorithm, both of these models are not hierarchical, tasks are clustered on one level only and cannot be represented by a tree structure. recently, maml has been applied to crosslingual meta-learning @xcite . in particular, the implementation by nooralahzadeh et al. (2020), called xmaml, obtained good results on nli and qa tasks. as in the previously mentioned computer vision studies, some of these nlp algorithms looked into the relationships among languages to select the support languages used in their meta-learning algorithm, but they do not use the hierarchical structure of the languages. ## the meta-learning problem we follow the notation of @xcite . we assume the existence of a distribution over tasks τ and, for each task, a distribution over data points d and a loss function l. the loss function of the meta-learning problem, l meta , is defined as an average across both distributions of tasks and data points: the goal of meta-learning is to minimize the loss function with respect to a vector of metaparameters ω. the vector of parameters θ is taskspecific and depends on the meta-parameters ω. different meta-learning algorithms correspond to a different choice of θ τ (ω). we describe below the choice of maml that will also be followed by treemaml. during meta-training, the loss is evaluated on a sample of m tasks and n v validation data points for each task. ## discussion and conclusion this paper presents a method to exploit the data hierarchy in the meta-learning framework, treemaml. this algorithm can use a priory knowledge of the data set (fixed treemaml), or learn the hierarchical structure using our modification of the otd clustering algorithm (learned treemaml). since languages follow a hierarchical phylogenetic tree, we hypothesized that we could use treemaml to meta-train models for cross-lingual understanding. we applied treemaml to the cross-lingual xnli problem and show an improvement in accuracy ∼ 3% with respect to the state of the art obtained by xmaml @xcite ( how much each auxiliary language contributes to the target language's performance may depend on its relative position in the language tree. these results are especially encouraging for meta-training of cross-lingual understanding tasks for underresourced languages. future work may include an improved algorithm that takes into account not only the position of a language in the tree, but also the distances between languages in a branch by, for example, introducing weighted averaging of the gradients. in our nli experiments, learned treemaml is in most cases as good or even better than fixed treemaml. one possible explanation is that clustering learns the tree for each batch of data at each gradient step, which allows it to pick up nlirelevant similarities that are not described by a phylogenetic tree, as the genre of the task in the xnli data set, structural similarities and lexical similarity, which can be the result of language contact, as for example lexical borrowings. this may help with cross-lingual understanding tasks for uncommon languages for which the exact position in the tree may be unclear or not enough data may be available. as discussed in section 4.2, the lack of improvement in accuracy in the greek language and the low performance in thai can be rooted in the experimental design's naive assumptions about: which languages to include in the experiment, and the correctness of the language tree. the results in which treemaml performs worse than the other algorithms speak in favour of the robustness of this algorithm to properly learn cross-lingual relationships and exploit them to perform natural language understanding tasks. therefore, the use of learned treemaml could help with the internationalization of the nlp models.