Lory: Fully Differentiable Mixture-of-Experts for Autoregressive Language Model Pre-training

Read original: arXiv:2405.03133 - Published 8/20/2024 by Zexuan Zhong, Mengzhou Xia, Danqi Chen, Mike Lewis
Total Score

0

💬

Sign in to get full access

or

If you already have an account, we'll log you in

Overview

  • Mixture-of-Experts (MoE) models can efficiently scale, but training the router network is challenging
  • Recently, a fully-differentiable MoE architecture called SMEAR was proposed, but its effectiveness was only shown in downstream fine-tuning tasks
  • This paper introduces Lory, the first approach that scales such architectures to autoregressive language model pre-training

Plain English Explanation

Mixture-of-Experts (MoE) models are a type of AI model that use a collection of specialized "experts" to handle different parts of a task. This can help the model scale efficiently. However, training the part of the model that decides which expert to use (the "router" network) is challenging because it involves optimizing a non-differentiable, discrete objective.

Recently, researchers proposed a new MoE architecture called SMEAR that avoids this issue by "softly" merging the experts in the parameter space. But SMEAR's effectiveness was only demonstrated on classification tasks, not on the more complex task of training large language models from scratch.

This paper introduces "Lory", a new approach that adapts the SMEAR architecture to enable efficient pre-training of large language models with multiple experts. Lory uses two key techniques:

  1. A "causal segment routing strategy" that efficiently merges experts while preserving the autoregressive nature of language models.
  2. A "similarity-based data batching method" that encourages the experts to specialize by grouping similar documents together during training.

The researchers show that Lory models trained on 150 billion tokens can outperform dense (non-MoE) models with the same number of parameters on both perplexity and a variety of downstream tasks. Importantly, Lory achieves this while still being competitive with state-of-the-art MoE models that use a more complex token-level routing approach.

Technical Explanation

Mixture-of-experts (MoE) models facilitate efficient scaling; however, training the router network introduces the challenge of optimizing a non-differentiable, discrete objective. Recently, a fully-differentiable MoE architecture, SMEAR, was proposed, which softly merges experts in the parameter space; nevertheless, its effectiveness was only demonstrated in downstream fine-tuning on classification tasks.

In this paper, the authors present Lory, the first approach that scales such architectures to autoregressive language model pre-training. Lory introduces two key techniques:

  1. A causal segment routing strategy that achieves high efficiency for expert merging operations while preserving the autoregressive nature of language models.
  2. A similarity-based data batching method that encourages expert specialization by grouping similar documents in training instances.

The researchers pre-train a series of Lory models on 150B tokens from scratch, with up to 32 experts and 30B (1.5B active) parameters. Experimental results show significant performance gains over parameter-matched dense models on both perplexity (+13.9%) and a variety of downstream tasks (+1.5%-11.1%). Despite segment-level routing, Lory models achieve competitive performance compared to state-of-the-art MoE models with token-level routing. The authors further demonstrate that the trained experts in Lory capture domain-level specialization without supervision.

Critical Analysis

The paper presents a novel and promising approach for scaling MoE architectures to language model pre-training. The proposed techniques, such as causal segment routing and similarity-based data batching, appear to be effective in enabling efficient expert merging and specialization.

However, the paper does not delve into the potential limitations or caveats of the Lory approach. For example, it would be valuable to understand the computational and memory overhead associated with the proposed routing and batching methods, especially as the number of experts scales up. Additionally, the paper does not discuss the potential challenges in interpreting and understanding the learned expert specialization, which could be an important consideration for certain applications.

Furthermore, the paper focuses on the performance of Lory on standard benchmarks, but it would be interesting to see an analysis of the model's behavior and robustness in more challenging or adversarial settings. Toward Inference-Optimal Mixture-of-Experts for Large Language Models provides a useful perspective on considering the inference-time properties of MoE models, which could be a relevant avenue for future research.

Overall, the Lory approach represents a significant advancement in the field of scaling MoE architectures to large language models, and the results are highly promising. However, further exploration of the method's limitations and robustness would strengthen the work and provide a more comprehensive understanding of its potential and practical implications.

Conclusion

This paper introduces Lory, a novel approach for scaling fully-differentiable Mixture-of-Experts (MoE) architectures to the pre-training of large autoregressive language models. Lory employs a causal segment routing strategy and a similarity-based data batching method to enable efficient expert merging and specialization, respectively.

The experimental results demonstrate that Lory models can outperform parameter-matched dense models on both perplexity and a variety of downstream tasks, while remaining competitive with state-of-the-art MoE models that use more complex token-level routing. Importantly, the trained experts in Lory are shown to capture domain-level specialization without explicit supervision.

This work highlights the potential of fully-differentiable MoE architectures for language model pre-training and advocates for further research in this area. By addressing the challenges of scaling MoE models to this domain, the Lory approach opens up new avenues for building more efficient and specialized large language models, with potential implications for a wide range of natural language processing applications.



This summary was produced with help from an AI and may contain inaccuracies - check out the links to read the original source documents!

Follow @aimodelsfyi on 𝕏 →

Related Papers

💬

Total Score

0

Lory: Fully Differentiable Mixture-of-Experts for Autoregressive Language Model Pre-training

Zexuan Zhong, Mengzhou Xia, Danqi Chen, Mike Lewis

Mixture-of-experts (MoE) models facilitate efficient scaling; however, training the router network introduces the challenge of optimizing a non-differentiable, discrete objective. Recently, a fully-differentiable MoE architecture, SMEAR, was proposed (Muqeeth et al., 2023), which softly merges experts in the parameter space; nevertheless, its effectiveness was only demonstrated in downstream fine-tuning on classification tasks. In this paper, we present Lory, the first approach that scales such architectures to autoregressive language model pre-training. Lory introduces two key techniques: (1) a causal segment routing strategy that achieves high efficiency for expert merging operations while preserving the autoregressive nature of language models; (2) a similarity-based data batching method that encourages expert specialization by grouping similar documents in training instances. We pre-train a series of Lory models on 150B tokens from scratch, with up to 32 experts and 30B (1.5B active) parameters. Experimental results show significant performance gains over parameter-matched dense models on both perplexity (+13.9%) and a variety of downstream tasks (+1.5%-11.1%). Despite segment-level routing, Lory models achieve competitive performance compared to state-of-the-art MoE models with token-level routing. We further demonstrate that the trained experts in Lory capture domain-level specialization without supervision. Our work highlights the potential of fully-differentiable MoE architectures for language model pre-training and advocates future research in this area.

Read more

8/20/2024

Layerwise Recurrent Router for Mixture-of-Experts
Total Score

0

Layerwise Recurrent Router for Mixture-of-Experts

Zihan Qiu, Zeyu Huang, Shuang Cheng, Yizhi Zhou, Zili Wang, Ivan Titov, Jie Fu

The scaling of large language models (LLMs) has revolutionized their capabilities in various tasks, yet this growth must be matched with efficient computational strategies. The Mixture-of-Experts (MoE) architecture stands out for its ability to scale model size without significantly increasing training costs. Despite their advantages, current MoE models often display parameter inefficiency. For instance, a pre-trained MoE-based LLM with 52 billion parameters might perform comparably to a standard model with 6.7 billion parameters. Being a crucial part of MoE, current routers in different layers independently assign tokens without leveraging historical routing information, potentially leading to suboptimal token-expert combinations and the parameter inefficiency problem. To alleviate this issue, we introduce the Layerwise Recurrent Router for Mixture-of-Experts (RMoE). RMoE leverages a Gated Recurrent Unit (GRU) to establish dependencies between routing decisions across consecutive layers. Such layerwise recurrence can be efficiently parallelly computed for input tokens and introduces negotiable costs. Our extensive empirical evaluations demonstrate that RMoE-based language models consistently outperform a spectrum of baseline models. Furthermore, RMoE integrates a novel computation stage orthogonal to existing methods, allowing seamless compatibility with other MoE architectures. Our analyses attribute RMoE's gains to its effective cross-layer information sharing, which also improves expert selection and diversity. Our code is at https://github.com/qiuzh20/RMoE

Read more

8/14/2024

LocMoE: A Low-Overhead MoE for Large Language Model Training
Total Score

0

LocMoE: A Low-Overhead MoE for Large Language Model Training

Jing Li, Zhijie Sun, Xuan He, Li Zeng, Yi Lin, Entong Li, Binfan Zheng, Rongqian Zhao, Xin Chen

The Mixtures-of-Experts (MoE) model is a widespread distributed and integrated learning method for large language models (LLM), which is favored due to its ability to sparsify and expand models efficiently. However, the performance of MoE is limited by load imbalance and high latency of All-to-All communication, along with relatively redundant computation owing to large expert capacity. Load imbalance may result from existing routing policies that consistently tend to select certain experts. The frequent inter-node communication in the All-to-All procedure also significantly prolongs the training time. To alleviate the above performance problems, we propose a novel routing strategy that combines load balance and locality by converting partial inter-node communication to that of intra-node. Notably, we elucidate that there is a minimum threshold for expert capacity, calculated through the maximal angular deviation between the gating weights of the experts and the assigned tokens. We port these modifications on the PanGu-Sigma model based on the MindSpore framework with multi-level routing and conduct experiments on Ascend clusters. The experiment results demonstrate that the proposed LocMoE reduces training time per epoch by 12.68% to 22.24% compared to classical routers, such as hash router and switch router, without impacting the model accuracy.

Read more

5/24/2024

MoE-LPR: Multilingual Extension of Large Language Models through Mixture-of-Experts with Language Priors Routing
Total Score

0

MoE-LPR: Multilingual Extension of Large Language Models through Mixture-of-Experts with Language Priors Routing

Hao Zhou, Zhijun Wang, Shujian Huang, Xin Huang, Xue Han, Junlan Feng, Chao Deng, Weihua Luo, Jiajun Chen

Large Language Models (LLMs) are often English-centric due to the disproportionate distribution of languages in their pre-training data. Enhancing non-English language capabilities through post-pretraining often results in catastrophic forgetting of the ability of original languages. Previous methods either achieve good expansion with severe forgetting or slight forgetting with poor expansion, indicating the challenge of balancing language expansion while preventing forgetting. In this paper, we propose a method called MoE-LPR (Mixture-of-Experts with Language Priors Routing) to alleviate this problem. MoE-LPR employs a two-stage training approach to enhance the multilingual capability. First, the model is post-pretrained into a Mixture-of-Experts (MoE) architecture by upcycling, where all the original parameters are frozen and new experts are added. In this stage, we focus improving the ability on expanded languages, without using any original language data. Then, the model reviews the knowledge of the original languages with replay data amounting to less than 1% of post-pretraining, where we incorporate language priors routing to better recover the abilities of the original languages. Evaluations on multiple benchmarks show that MoE-LPR outperforms other post-pretraining methods. Freezing original parameters preserves original language knowledge while adding new experts preserves the learning ability. Reviewing with LPR enables effective utilization of multilingual knowledge within the parameters. Additionally, the MoE architecture maintains the same inference overhead while increasing total model parameters. Extensive experiments demonstrate MoE-LPR's effectiveness in improving expanded languages and preserving original language proficiency with superior scalability. Code and scripts are freely available at https://github.com/zjwang21/MoE-LPR.git.

Read more

8/22/2024