Source-linked AI summary

Beyond Distillation: Task-level Mixture-of-Experts for Efficient Inference

Sneha Kudugunta, Yanping Huang, Ankur Bapna, Maxim Krikun, Dmitry Lepikhin, Minh-Thang Luong, Orhan Firat

arXiv:2110.03742v1cs.CLcs.LG

TL;DR

Training massive models on large amounts of data can almost guarantee improved quality, but practicality and applicability depend on training efficiency and inference efficiency. The paper proposes MoE routing algorithms that use multilingual task boundaries to route examples and serve task-associated subnetworks. Across WMT with 30 language pairs and an in-house dataset with 200, task-based routing performs as well as or better than token-based routing in BLEU; on WMT it gains +2.1 BLEU over the distilled student at comparable inference cost.

  • Problem

    Training massive models on large amounts of data can almost guarantee improved quality, but practicality and applicability depend on training efficiency and inference efficiency.

    Source: §1 · p. 1
  • Method

    The paper proposes MoE routing algorithms that use multilingual task boundaries to route examples and serve task-associated subnetworks.

    Source: §1 · p. 2, §7 · p. 9
  • Results

    Across WMT with 30 language pairs and an in-house dataset with 200, task-based routing performs as well as or better than token-based routing in BLEU; on WMT it gains +2.1 BLEU over the distilled student at comparable inference cost.

    Source: §1 · p. 2, §7 · p. 9
  • Takeaways & Limitations

    Task-based routing is more inference-friendly than serving token-based MoE as-is and outperforms distillation from a large MoE in BLEU.

    Source: §7 · p. 9

    The evaluation set uses sentences that are semantically identical across languages.

    Source: §5.1 · p. 6

Abstract

from arXiv · show

Sparse Mixture-of-Experts (MoE) has been a successful approach for scaling multilingual translation models to billions of parameters without a proportional increase in training computation. However, MoE models are prohibitively large and practitioners often resort to methods such as distillation for serving. In this work, we investigate routing strategies at different granularity (token, sentence, task) in MoE models to bypass distillation. Experiments on WMT and a web-scale dataset suggest that task-level routing (task-MoE) enables us to extract smaller, ready-to-deploy sub-networks from large sparse models. On WMT, our task-MoE with 32 experts (533M parameters) outperforms the best performing token-level MoE model (token-MoE) by +1.0 BLEU on average across 30 language pairs. The peak inference throughput is also improved by a factor of 1.9x when we route by tasks instead of tokens. While distilling a token-MoE to a smaller dense model preserves only 32% of the BLEU gains, our sub-network task-MoE, by design, preserves all the gains with the same inference cost as the distilled student model. Finally, when scaling up to 200 language pairs, our 128-expert task-MoE (13B parameters) performs competitively with a token-level counterpart, while improving the peak inference throughput by a factor of 2.6x.

1 Introduction

Token-level sparse MoEs reduce computation per token but can be costly to serve, motivating routing that uses multilingual task boundaries. The paper proposes task-level routing and reports translation-quality and inference-efficiency gains.

  • Token-level routing can require model-parallel serving, inter-device communication during autoregressive decoding, and large batches to avoid device under-utilization.Source: §1 · p. 1
  • For multilingual translation, the goal is to preserve cross-language transfer while reducing task interference and extracting per-language-pair subnetworks for inference.Source: §1 · p. 2
  • Prior work cited in the introduction found that distillation preserved only a small fraction of large sparse models' quality gains.Source: §1 · p. 2
  • The proposed routing sends all tokens for a task collectively to the same experts, then decodes each task using only its associated expert subset.Source: §1 · p. 2
  • +3.6 BLEU over the multilingual model trained from scratch and +2.1 BLEU over the distilled dense student at comparable inference cost are reported for task-level routing.The comparison is reported for the multilingual WMT task.Source: §1 · p. 2
  • Comparable quality gains to token-MoE come with 1.9x peak throughput and 6.3% of the decoder size.Source: §1 · p. 2
  • On the in-house dataset, task-level routing reports +3.6 BLEU over the dense baseline and comparable quality gain to token-level routing with 2.6x higher peak throughput.The task-level model uses 1.6% of the token-level model's decoder size.Source: §1 · p. 2
  • The paper also analyzes MoE routing decisions to motivate its method.Source: §1 · p. 2

2 Scaling Transformers with Mixture-of-Experts

The paper uses a Transformer architecture and places Mixture-of-Experts layers in its feed-forward networks. A gating network selects experts for each token, with the top two weights used in this work.

  • A Transformer sequence-to-sequence model contains an encoder and decoder, each with multiple Transformer layers.Source: §2 · p. 2
  • Each MoE layer contains E feed-forward networks, with expert outputs combined according to the gating network's selected weights.Source: §2 · p. 2
  • The gating network routes each input token to selected experts, and this work chooses the top two weights for each example.The gating function must balance expert utilization and remain efficient to implement at scale.Source: §2 · p. 2

3 Methods

The methods compare token-, sentence-, and task-level routing in multilingual translation, where expert sharing must balance transfer and interference. Task-level routing assigns experts by task and can reduce the expert set needed during inference.

3 Methods

  • Task-level routing is motivated by balancing cross-language transfer with interference from extensive parameter sharing in multilingual translation.MoE variants partition parameters across languages or tasks; the authors study routing to mitigate interference while enabling transfer and efficient inference.Source: §3 · p. 3

3.1 Routing Strategies

  • Sentence-level routing sends every token in a sentence to experts selected from the sentence's average token representation.Token-level routing instead makes routing decisions independently for each token.Source: §3.1 · p. 3
  • Task-level routing selects experts at task boundaries, defined in multilingual translation by target language or language pair.For example, French-to-English and German-to-English can count as the same task under target-language routing or separate tasks under language-pair routing.Source: §3.1 · p. 3

3.2 Inference Implications of Routing Strategies

  • For large MoEs, host-to-device expert loading incurs communication costs, while model parallelism introduces inter-device communication overhead.Task-specific sub-networks are presented as an alternative to complex serving strategies or compression.Source: §3.2 · p. 4
  • Token- and sentence-level routing may require loading all E experts when inputs choose disjoint experts, whereas task-level top-K routing preloads only K experts.The task-level assignment is static for tokens in an input sentence; token- and sentence-level decisions are dynamic.Source: §3.2 · p. 4

4 Experiments on 30 Language Pairs

On WMT, decoder-only task-level routing outperforms token-level routing across language directions and resource groups, while increasing peak throughput. Compared with distillation at similar inference cost, the best Task-MoE model also achieves higher average BLEU.

4.1 Experimental Setup

  • WMT experiments cover 15 languages to and from English, with training data ranging from more than 60 million sentence pairs (en-cs) to roughly 150k (en-gu).The models use the 142M Transformer Base architecture or enhanced versions with MoE layers.Source: §4.1 · p. 4

4.2 Comparison of different Routing Strategies on WMT

  • 1 BLEU over Token MoE, decoder-only Task MoE (Token/Target) works best, with gains consistent across directions, resource levels, and two zero-shot pairs.The routing strategies were compared at identical network size: 32 experts and 533M parameters.Source: §4.2 · p. 5

4.3 Comparison of Throughput of Sparse Models

  • 1.87 times higher peak throughput for Task-MoE than Token-MoE, with 3.75 times less decoder parameters (142M vs 533M) and 0.0% versus 26.9% of step time in communication overhead.The throughput comparison decodes the WMT14 English-German test set on 32 Cloud TPU V3 cores; decoder-only task routing has roughly the same inference cost as routing on both encoder and decoder.Source: Figure 2 · p. 5, §4.3 · pp. 5–6

4.4 Comparison of Extracting Task MoE Models to Distillation

  • 29.0 average BLEU for best-performing Task-MoE versus 26.9 for distilled Token-MoE (+2.1 BLEU); distillation preserves only 32.25% of gains over dense multilingual baselines.The comparison uses models with similar inference cost and covers several language pairs.Source: Table 2 · p. 6, §4.4 · p. 6

5 Scaling up to 200 Language Pairs

On the 200-language-pair dataset, scaled sparse models outperform dense baselines, with routing quality varying by translation direction. Task-MoE also achieves higher peak throughput, while routing decisions show task preferences in the decoder.

5.1 Experimental Setup

  • The experiments scale to 204 direct language pairs and 25 billion sentence pairs, using a 473M Transformer Big architecture and comparing token and task routing configurations.The web-crawled corpus is diverse, noisy, and heavily imbalanced across language pairs; scaled models use encoder token routing and decoder routing by target language or language pair.Source: §5 · p. 6, §5.1 · p. 6, §5.2 · p. 7

5.2 Results

  • Hybrid task-level routing performs slightly better on En-Xx pairs, while pure token-level routing performs slightly better on Xx-En pairs.Both scaled sparse models outperform their dense baselines; the authors hypothesize that leaving decoder experts undivided by task improves transfer for Xx-En.Source: §5.2 · p. 7
  • At inference, token-level decoder routing uses 200M parameters, although both routing forms have 13B parameters at training time.The paper also points to practical serving considerations discussed in Section 3.1.Source: §5.2 · p. 7

5.3 Comparison of Throughput on Massive Models

  • 2.6 times higher peak throughput is achieved by Task-MoE, using 201M decoder parameters versus Token-MoE's 6.5B.On 128 Cloud TPU V3 cores, communication overhead was 0.2% of step time for Task-MoE versus 36% for Token-MoE.Source: §5.3 · p. 7, Figure 4 · p. 8

5.4 A Closer Look at the Routing Decisions

  • Encoder tokens across Xx-En tasks slightly prefer the same few experts, while decoder tasks slightly prefer different experts.Related languages appear to have similar expert distributions; the authors interpret decoder task preferences as evidence that task-level decisions emerge naturally under token routing.Source: §5.4 · p. 8

6 Related Work

Related work covers conditional computation and task-based parameter sharing, including multilingual NMT approaches. This paper positions its approach as parameter sharing designed to scale models without harming inference efficiency.

6 Related Work

  • Conditional computation routes examples through only a sub-network, with routing based on input, computational budget, or simplified expert allocation.Prior work applied conditional computation in NLP and computer vision.Source: §6 · p. 8
  • Multi-task learning activates sub-networks according to task and can share parameters; prior applications include classification, recommender systems, and NLP.Some approaches were designed with inference benefits in mind.Source: §6 · p. 8
  • Multilingual NMT work explores language-specific components and language-group parameter sharing, while this approach targets scaling without harming inference efficiency.A related inference-focused method learns language-specific layer combinations; this work instead focuses on inference efficiency in mixture-of-experts models.Source: §6 · p. 8

7 Conclusions

The paper concludes that task-based routing performs as well as or better than token-based routing on WMT and a large internal dataset. It reports advantages over serving token-based MoE as-is and over distilling it to a dense model, and identifies hybrid routing as a direction for further study.

7 Conclusions

  • Task-based routing performs as well as or better than token-based routing on WMT's 30 language pairs and an internal dataset covering 200 pairs, measured with BLEU.The conclusion compares translation quality across the two datasets.Source: §7 · p. 9
  • Task-based routing is superior to token-based MoE serving in peak throughput and to distillation in BLEU.The authors compare throughput across routing approaches and distilled models.Source: §7 · p. 9
  • The authors identify more granular hybrid or hierarchical routing as future research directions for large, sparsely gated, multi-task networks.They characterize inference-friendly routing that retains MoE quality gains as a promising direction.Source: §7 · p. 9

A.1 WMT Model and Training Details

The WMT models use a shared-vocabulary Transformer setup and Adafactor training. The appendix also specifies a reduced learning rate for distillation.

A.1 WMT Model and Training Details

  • The multilingual Transformer Base model has 142M parameters, with parameters shared across language pairs, including embeddings and the softmax layer.The model uses a 64k-token vocabulary.Source: §A.1 · p. 12
  • A shared 64k-token Sentence Piece vocabulary is learned using temperature-based sampling with T = 5.Source: §A.1 · p. 12
  • Training uses Adafactor with momentum factorization, norm clipping at 1.0, and 40K warm-up steps; distillation uses a reduced learning rate of 0.2.BLEU scores are calculated with SacreBLEU on WMT test sets.Source: §A.1 · p. 12

A.2 WMT Dataset Details

The WMT 4 setup is described through training-set details, including data sizes and the WMT years used for Train, Dev, and Test.

A.2 WMT Dataset Details

  • The section presents training-set details for the WMT 4 setup used in the experiments.Source: §A.2 · p. 12
  • It reports data sizes for the training setup.Source: §A.2 · p. 12
  • It identifies the WMT years used for the Train, Dev, and Test sets.Source: §A.2 · p. 12

A.3 Individual WMT BLEU Scores

This block points readers to individual WMT BLEU scores, model parameter breakdowns, aggregate results for scaled-up MoEs, and expert-gating visualizations.

A.3 Individual WMT BLEU Scores

A.7 Gating Decisions for task-level and token-level MoEs

  • Position-wise MoE figures show broadly distributed token routing, with later layers preferring a few experts slightly; decoder figures also show similar distributions for some related language pairs.Source: Figure 6 · p. 14, Figure 7 · p. 15, Figure 8 · p. 16
  • In the target-language-wise decoder, some language pairs share experts, while English-Spanish and English-Catalan have different experts.Source: Figure 11 · p. 19

A.4 Detailed Breakdown of Parameter Counts on WMT

A.5 Detailed Breakdown of Parameter Counts

A.6 Results on Large MoE Model

  • Table 9 summarizes aggregate BLEU results for the scaled-up 128-expert MoE models, grouped into High-25, Low-25, and Mid-52 language averages.High-25 and Low-25 are the 25 highest- and lowest-resource languages; Mid-52 covers the remaining 52.Source: §A.6 · p. 13, Table 9 · p. 23
Loading 2110.03742v1…