Skip to main content
QUICK REVIEW

[论文解读] A Closer Look into Mixture-of-Experts in Large Language Models

Ka Man Lo, Zeyu Huang|arXiv (Cornell University)|Jun 26, 2024
Computational and Text Analysis Methods被引用 4
一句话总结

本文对大型语言模型中的专家混合(Mixture-of-Experts, MoE)进行了全面的实证分析,考察了三种模型——Mixtral 8x7B、DeepSeekMoE 和 Grok-1——的参数与行为特性。研究发现,神经元作为细粒度专家发挥作用,路由机制倾向于选择输出范数更高的专家,且专家多样性随深度增加而提升,但最后一层表现出异常。研究结果表明,从零开始训练有助于提升专家多样性,并为路由设计与专家分配策略提供指导。

ABSTRACT

Mixture-of-experts (MoE) is gaining increasing attention due to its unique properties and remarkable performance, especially for language tasks. By sparsely activating a subset of parameters for each token, MoE architecture could increase the model size without sacrificing computational efficiency, achieving a better trade-off between performance and training costs. However, the underlying mechanism of MoE still lacks further exploration, and its modularization degree remains questionable. In this paper, we make an initial attempt to understand the inner workings of MoE-based large language models. Concretely, we comprehensively study the parametric and behavioral features of three popular MoE-based models and reveal some intriguing observations, including 1) Neurons act like fine-grained experts; 2) The router of MoE usually selects experts with larger output norms; 3) The expert diversity increases as the layer increases, while the last layer is an outlier, which is further validated by an initial experiment. Based on the observations, we also provide suggestions for a broad spectrum of MoE practitioners, such as router design and expert allocation. We hope this work could shed light on future research on the MoE framework and other modular architectures. Code is available at https://github.com/kamanphoebe/Look-into-MoEs.

研究动机与目标

  • 探究基于 MoE 的大型语言模型是否通过异构专家专业化实现真正的模块化,还是仍为同质化集成。
  • 分析近期 MoE 模型中专家的参数与行为特征,重点关注参数相关性、路由行为以及输出相似性。
  • 识别影响 MoE 模型中专家多样性与专业化的架构与训练层面因素。
  • 基于实证观察,为路由设计、专家分配与训练方案提供可操作的洞见。

提出的方法

  • 对三款近期 MoE 模型(Mixtral 8x7B、DeepSeekMoE 和 Grok-1)进行实证分析,使用其公开可用的权重。
  • 通过在不同输入下计算权重矩阵与输出特征向量之间的余弦相似度,评估专家参数相似性。
  • 通过将门控分数与专家输出范数及激活模式相关联,分析路由机制的行为。
  • 可视化并分析神经元级别的激活热力图,以评估细粒度专家行为及不同专家间的相似性。
  • 对比不同训练方式下的模型——具体而言,Mixtral(可能通过升级方式训练)与 DeepSeek 和 Grok-1(从零开始训练)——以评估其对专家相关性的影响。
  • 采用基于范数的路由监督与相关性度量,评估路由效率与专家独特性。
Figure 5: Intermediate state values of Mixtral experts. The top $k$ experts are shown on top of each heat map. Each number in the vertical axis refers to an expert index while the horizontal axis represents the number of neurons.
Figure 5: Intermediate state values of Mixtral experts. The top $k$ experts are shown on top of each heat map. Each number in the vertical axis refers to an expert index while the horizontal axis represents the number of neurons.

实验结果

研究问题

  • RQ1MoE 基础的大型语言模型中的专家在参数与行为上是否表现出有意义的异质性,还是高度相关?
  • RQ2MoE 模型中的路由机制如何选择专家?是否存在对输出范数更高的专家的偏好?
  • RQ3专家多样性如何随模型深度变化?为何最后一层显示出相似性趋势的反转?
  • RQ4从零开始训练与特定初始化方式在多大程度上影响专家多样性与相关性?
  • RQ5权重矩阵相似性能否作为跨专家输出特征相似性的代理指标?

主要发现

  • 前馈网络中的神经元充当细粒度专家,门控嵌入与门控投影矩阵表现出相关激活模式,表明存在神经元级别的专业化。
  • Mixtral 8x7B 与 DeepSeekMoE 中的路由机制始终选择输出范数更高的专家,表明基于范数的路由是一种稳健且有效的策略。
  • 专家相似性随层深增加而降低,表明多样性逐渐提升,但最后一层显示出相似性显著上升,成为层级中的异常值。
  • 专家权重矩阵之间的相似性与跨 token 的平均输出相似性存在强相关性,表明基于权重的分析可高效替代输出层面的评估。
  • 从零开始训练的模型(如 DeepSeekMoE 和 Grok-1)其专家参数与行为之间的相关性弱于 Mixtral,暗示从零开始训练可能更有利于促进专家多样性。
  • Mixtral 中观察到的强烈参数与行为相关性表明,其可能采用如从基础模型升级的特殊初始化方案进行训练,而非从零开始。
A Closer Look into Mixture-of-Experts in Large Language Models

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。