arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.16554cs.CL
收藏

LLaMA-MoE: 基于LLaMA通过持续预训练构建混合专家模型

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

Soochow University(苏州大学);Shanghai AI Laboratory(上海人工智能实验室);Shanghai Jiao Tong University(上海交通大学);Fudan University(复旦大学);The Chinese University of Hong Kong(香港中文大学)

Tong Zhu, Xiaoye Qu, Daize Dong, Jiacheng Ruan, Jingqi Tong, Conghui He, Yu Cheng

AI总结:

针对从零训练MoE大模型数据需求高、不稳定的问题,研究基于LLaMA-2 7B通过专家划分与持续预训练构建LLaMA-MoE,在激活参数量相近的情况下性能显著优于稠密模型。

摘要:

混合专家(Mixture-of-Experts, MoE)作为一种极具前景的大语言模型(large language models, LLMs)扩展框架,正日益受到关注。然而,大规模从零开始训练MoE仍存在数据需求高、训练不稳定的问题。受此局限启发,我们研究基于现有稠密大语言模型构建MoE模型的方法。具体而言,我们以知名的LLaMA-2 7B模型为基础,通过两个步骤得到MoE模型:(1)专家构建:将原始前馈网络(Feed-Forward Networks, FFNs)的参数划分为多个专家;(2)持续预训练:对转换后的MoE模型及新增的门控网络进行进一步训练。本文全面探究了不同的专家构建方法,以及适用于持续预训练的各类数据采样策略。经过这些阶段,我们的LLaMA-MoE模型能够保持语言能力,且仅激活部分参数即可将输入词元路由至特定专家。实验表明,在训练200B词元后,LLaMA-MoE-3.5B模型的性能显著优于激活参数量相近的稠密模型。源代码与模型可在https://github.com/pjlab-sys4nlp/llama-moe 获取。

英文摘要:

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 .

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑