Improving the Downstream Performance of Mixture-of-Experts Transformers via Weak Vanilla Transformers

Xin Lu, Yanyan Zhao, Bing Qin, Ting Liu

TL;DR

Mixture-of-Experts (MoE) Transformers boast impressive pre-training capabilities but struggle to translate these gains to downstream tasks. This paper introduces "transfer capability distillation," a novel method where smaller, "vanilla" Transformer models (with weaker overall performance but strong transfer ability) act as teachers to guide larger MoE models. This distillation significantly boosts the MoE models' downstream performance, even surpassing their teacher models.

What Problem Does This Paper Address?

Large language models (LLMs) have shown remarkable progress, but scaling them up incurs substantial computational costs. Mixture-of-Experts (MoE) architectures offer a way to increase model capacity without a proportional increase in computation by using specialized "experts" for different inputs. While MoE models excel during pre-training (e.g., language modeling tasks), research has consistently shown they underperform compared to standard "vanilla" Transformer models when fine-tuned on downstream tasks, even when their pre-training performance is equivalent. This disconnect diminishes their practical value. The authors hypothesize that this gap arises not just from pre-training performance but also from a model's "transfer capability" – its ability to effectively leverage pre-trained knowledge for new tasks. They argue that MoE models, despite their capacity, possess weaker transfer capability than vanilla models.

Methods

The core innovation is Transfer Capability Distillation (TCD). The authors propose using a pre-trained vanilla Transformer model as a "teacher" to guide the pre-training of a larger MoE Transformer model, the "student." The key idea is that while vanilla models might be weaker overall, they possess stronger "transfer capability."

The TCD process involves:

  1. Teacher Model: A vanilla BERT model is pre-trained on a standard masked language modeling (MLM) objective.
  2. Student Model: An MoE-BERT model is pre-trained. Crucially, in addition to the standard MLM loss and an expert load balancing loss, an additional distillation loss is applied.
  3. Distillation Loss: This loss aims to align the relationships between intermediate-layer representations of the student and teacher models. Instead of directly matching representation values (which could harm pre-training performance), they focus on matching the cosine similarity of token pairs. This alignment is applied at three key locations:
  4. Model Trunk: After layer normalization in MHA and FFN layers.
  5. Residual Inner: Before layer normalization in MHA and FFN layers.
  6. Multi-Head Attention (MHA): Aligning query-key similarities within attention heads.

This approach aims to imbue the MoE model with the strong transfer capability of the vanilla teacher, while retaining its own strong pre-training performance.

Datasets

  • Pre-training: Wikipedia and BooksCorpus (standard datasets used in BERT pre-training).
  • Downstream Evaluation: GLUE benchmark.
  • Out-of-Distribution (OOD) Evaluation: The Pile dataset (including subsets like arXiv, DM Mathematics, GitHub, Stack Exchange, Ubuntu IRC) to assess masked language modeling capability on diverse domains.

Key Insights and Ideas

  • Transfer Capability is Distinct from Pre-training Performance: The paper strongly argues that downstream performance is a function of both pre-training performance and transfer capability, and that MoE models suffer from the latter.
  • Vanilla Models as "Weak" but Effective Teachers: Counterintuitively, smaller vanilla models, despite their lower overall performance, can serve as excellent teachers for distilling transfer capability into larger, more complex MoE models.
  • Relationship Alignment over Value Matching: Aligning the relationships (e.g., cosine similarity between token representations) between teacher and student models is more effective and less detrimental to pre-training than directly matching representation values. This offers more flexibility.
  • Multi-positional Distillation: Applying distillation constraints at multiple levels (trunk, inner, attention) is crucial for effectively transferring capabilities. The effectiveness of specific positions (like MHA) can be scale-dependent.
  • MoE OOD Performance Gap: Original MoE models show a significant drop in performance on out-of-distribution tasks compared to vanilla models, highlighting their weaker feature generalization. TCD helps bridge this gap.

Key Results

  • Improved Downstream Performance: MoE-BERT models enhanced with TCD consistently outperformed baseline MoE-BERT models on the GLUE benchmark across various tasks.
  • Surpassing Teacher: In many cases, the TCD-enhanced MoE-BERT models even surpassed the performance of their vanilla BERT teacher models on downstream tasks.
  • Scale-Dependent MHA Distillation: For larger models (H=768), MHA distillation provided a significant boost. For smaller models (H=128), it had a negative impact, leading the authors to omit it for that scale.
  • OOD Improvement: TCD significantly improved the out-of-distribution masked language modeling performance of MoE models, bringing them closer to vanilla BERT's performance.
  • Quantitative Gains: For example, in Table 1 (Pre-Training Performance Alignment, H=768), MoE-BERT w/ TCD achieved an average GLUE score of 84.83, compared to 83.81 for the baseline MoE-BERT and 83.81 for the vanilla BERT teacher.

Limitations and Future Work

  • Limited Scope of Validation: Experiments were primarily conducted on BERT architectures and the GLUE benchmark. Broader validation across other MoE variants, diverse datasets, and tasks is needed.
  • Hyperparameter Sensitivity: A sensitivity analysis of distillation loss hyperparameters was not performed, relying on a simplified strategy.
  • Mechanistic Understanding: The exact reasons why transfer capability differs between MoE and vanilla models, and why MHA distillation is scale-dependent, are not fully understood and require further investigation.
  • Future Directions: The authors suggest exploring a wider range of architectures, datasets, and tasks, as well as conducting more in-depth analyses of hyperparameters and theoretical underpinnings. They also plan to investigate the quality of learned features and their impact on transfer capability.

Summary updated

BibTeX
@inproceedings{lu2025improving,
  author = {Xin Lu and Yanyan Zhao and Bing Qin and Ting Liu},
  title = {{Improving the Downstream Performance of Mixture-of-Experts Transformers via Weak Vanilla Transformers}},
  booktitle = {Electronics},
  year = {2025},
  doi = {10.3390/electronics14214256},
}
Figure