Task-Based MoE for Multitask Multilingual Machine Translation

Hai Pham, Young Jin Kim, Subhabrata Mukherjee, David P. Woodruff, Barnabás Póczos, Hany Hassan AwadallaarXiv 2023

Abstract

Mixture-of-experts (MoE) architecture has been proven a powerful method for diverse tasks in training deep models in many applications. However, current MoE implementations are task agnostic, treating all tokens from different tasks in the same manner. In this work, we instead design a novel method that incorporates task information into MoE models at different granular levels with shared dynamic task-based adapters. Our experiments and analysis show the advantages of our approaches over the dense and canonical MoE models on multi-task multilingual machine translations. With task-specific adapters, our models can additionally generalize to new tasks efficiently.

TL;DR

This paper introduces a "task-aware" Mixture-of-Experts (MoE) architecture designed to solve the interference problem in multitask multilingual translation. By incorporating task-specific information into the routing process via shared dynamic adapters, the model learns to group similar tasks together, significantly outperforming standard task-agnostic MoE and dense models.

What Problem Does This Paper Address?

Mixture-of-Experts (MoE) has become a go-to strategy for scaling deep learning models. By replacing dense layers with a collection of "experts" and only activating a few for any given input, researchers can create massive models that remain computationally efficient.

However, current MoE implementations are usually task-agnostic. They treat every token the same way, regardless of whether it belongs to a French-to-English translation task or a Hindi-to-English one. In a multitask setting, this leads to "interference"—where data from very different tasks competes for the same experts, muddling the learning process. The authors aim to bridge the gap between high-level task information and low-level system routing to make models more specialized and efficient.

Methods

The authors propose a novel architecture that adds a Task Layer on top of the standard MoE layers within a Transformer-based framework. This design allows the model to leverage task-specific knowledge at multiple levels of the network.

Overall architecture of the task-aware MoE model, showing the integration of task information into both MoE and Task layers.

Their approach involves several key components:

  • Task-based Adapters: Instead of just routing tokens to experts, the model routes them to specific "adapters" that hold task-specific knowledge.
  • Three Routing Variants:
    1. Static: Each task gets its own dedicated adapter. This is simple but doesn't scale well to new, unseen tasks.
  • Dynamic: The number of adapters is smaller than the number of tasks ($L < M$). A "Task Gate" learns to route similar tasks to the same shared adapters, encouraging the model to learn cross-task representations.
  • Shared-Dynamic: The most advanced version, where the Task Gate and the MoE Gate share the same task embedding representation to make routing decisions.
Comparison of the three proposed routing strategies: (a) Static, (b) Dynamic, and (c) Shared-Dynamic.
  • End-to-End Training: Unlike previous methods that required offline clustering of tasks, this model learns task similarities and routing strategies dynamically during training.

Datasets

The researchers evaluated their model on Multitask Multilingual Machine Translation (MMMT) using data from the WMT corpus.

  • Languages: 10 languages ranging from high-resource (English, French, German) to low-resource (Estonian, Hindi, Gujarati, Latvian).
  • Tasks: 18 distinct translation directions (9 "English to X" and 9 "X to English").
  • Scale: Training sets ranged from 0.3 million (Hindi-English) to 10.3 million (Czech-English) sentence pairs.

Key Insights and Ideas

  • Task Awareness is Key: Standard MoE routing (token-level) actually performed worse than a standard dense model in some multilingual settings. Adding task information was the "secret sauce" that allowed MoE to finally flex its muscles.
  • Similarity-Based Grouping: By using fewer adapters than tasks (the "Dynamic" approach), the model naturally learns which languages are linguistically similar. Similar tasks are routed to the same experts, reducing the "noise" that comes from unrelated data.
  • Modular Flexibility: The adapter-based design makes the model highly extensible. To add a new language, you can potentially just fine-tune a new adapter rather than retraining the entire massive MoE backbone.
  • Model Merging: The authors demonstrated that they could take two models trained on different sets of languages and merge them by averaging weights and combining adapters, with the merged model quickly recovering the performance of both parents.

Key Results

The task-based MoE models showed clear superiority over both dense baselines and standard MoE:

  • BLEU Score Gains: On "X to English" (XE) tasks, the MoE Task-Static model achieved an average BLEU score of 28.1, compared to 26.4 for the Dense model and only 24.0 for the standard MoE Token model.
  • High vs. Low Resource: The gains were consistent across most languages. For example, in Romanian-to-English, the task-based MoE outperformed the dense baseline by 2.7 BLEU points.
  • Efficiency: The "Shared-Dynamic" variant proved particularly effective for low-resource pairs, as it allowed them to "borrow" expertise from related high-resource languages.

Limitations and Future Work

  • The Gujarati Challenge: The model still struggled with extremely low-resource and linguistically distinct languages like Gujarati. In these cases, the dense model sometimes still performed better, likely due to the MoE model's tendency to undersample rare data.
  • Data Imbalance: The authors noted that their training routine concatenated all data into one big pool. Without sophisticated sampling strategies, high-resource languages still dominate the experts.
  • Future Directions: The team plans to explore contrastive representation learning to better distinguish between tasks and custom sampling techniques to help the model perform better on the "long tail" of low-resource languages.

Summary updated

BibTeX
@misc{pham2023task,
  author = {Hai Pham and Young Jin Kim and Subhabrata Mukherjee and David P. Woodruff and Barnabás Póczos and Hany Hassan Awadalla},
  title = {{Task-Based MoE for Multitask Multilingual Machine Translation}},
  year = {2023},
  eprint = {2308.15772},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.15772},
}
Figure