LLaMA-MoE: Building Mixture-of-Experts from LLaMA with Continual Pre-training

Tong Zhu, Xiaoye Qu, Daize Dong, Jiacheng Ruan, Jingqi Tong +2 more
6/24/2024
cs.CL

Official code: pjlab-sys4nlp/llama-moe (1,004 stars, Apache-2.0, last commit 2024-12-06).

Abstract

Mixture-of-Experts (MoE) has gained increasing popularity as a promising framework for scaling up large language models (LLMs). However, training MoE from scratch in a large-scale setting still suffers from data-hungry and instability problems. Motivated by this limit, we investigate building MoE models from existing dense large language models. Specifically, based on the well-known LLaMA-2 7B model, we obtain an MoE model by: (1) Expert Construction, which partitions the parameters of original Feed-Forward Networks (FFNs) into multiple experts; (2) Continual Pre-training, which further trains the transformed MoE model and additional gate networks. In this paper, we comprehensively explore different methods for expert construction and various data sampling strategies for continual pre-training. After these stages, our LLaMA-MoE models could maintain language abilities and route the input tokens to specific experts with part of the parameters activated. Empirically, by training 200B tokens, LLaMA-MoE-3.5B models significantly outperform dense models that contain similar activation parameters. The source codes and models are available at https://github.com/pjlab-sys4nlp/llama-moe .

View on arXivView PDF

Code Implementations(1)

Apache-2.0

⛷️ LLaMA-MoE: Building Mixture-of-Experts from LLaMA with Continual Pre-training (EMNLP 2024)

1,00461Shell, PythonJul 24, 20231 years agoApache-2.0
continual-pre-trainingexpert-partitionllamallmmixture-of-experts+1 more

Similar Papers

Cite this paper

@article{zhu2024llamamoe,
  title  = {LLaMA-MoE: Building Mixture-of-Experts from LLaMA with Continual Pre-training},
  author = {Tong Zhu and Xiaoye Qu and Daize Dong and Jiacheng Ruan and Jingqi Tong and Conghui He and Yu Cheng},
  year   = {2024},
  eprint = {2406.16554},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.16554v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.16554.svg)](https://codeofpaper.com/paper/2406.16554)

Discussion