Condense, Don't Just Prune: Enhancing Efficiency and Performance in MoE Layer Pruning

Mingyu Cao, Gen Li, Jie Ji, Jiaqi Zhang, Ajay Jaiswal, Li Shen, Xiaolong Ma, Shiwei Liu, Lu Yin

TL;DR

Mixture-of-Experts (MoE) models offer impressive scalability but suffer from high memory demands. This paper introduces ConDense-MoE (CD-MoE), a novel approach that condenses MoE layers into smaller, denser structures by selectively retaining only a few crucial experts, significantly reducing memory usage and boosting inference speed without substantial accuracy loss. Furthermore, lightweight fine-tuning on these condensed layers can almost fully recover original performance.

What Problem Does This Paper Address?

Large Language Models (LLMs) are rapidly growing in size and capability, and Mixture-of-Experts (MoE) architectures have emerged as a key strategy to achieve this scale efficiently. MoEs work by selectively activating only a subset of "experts" (typically feed-forward networks) for each input token, allowing for massive model capacity without a proportional increase in computational cost. However, this sparsity doesn't solve the problem of massive memory requirements, which hinders their practical deployment, especially for LLMs. Existing methods that prune entire MoE layers often lead to significant performance degradation. This paper addresses the challenge of reducing the memory footprint of MoE models while preserving their performance, particularly for fine-grained MoE architectures that utilize shared experts.

Methods

The core of ConDense-MoE (CD-MoE) lies in its "condensation" approach, which differs from traditional pruning. Instead of removing entire MoE layers or individual experts outright, CD-MoE transforms sparse MoE layers into smaller, dense layers. This is achieved through a two-stage greedy search process:

  1. Expert Selection and Condensing: For each MoE layer, the method identifies and retains a small subset of the most critical experts (including always-activated shared experts) and discards the rest. This selection is guided by minimizing the Jensen-Shannon (JS) divergence between the output of the original MoE layer and the condensed layer, ensuring minimal impact on layer-wise output.
  2. Layer Selection and Condensing: The framework then identifies which MoE layers are most suitable for condensation. This is done by again using JS divergence to measure the impact of condensing each layer on the overall model output, prioritizing layers that cause the least deviation.

For inference, the routing mechanism is removed, and the selected experts are activated for all tokens, effectively creating a denser, more memory-efficient layer. The paper also proposes a lightweight fine-tuning strategy that only updates the parameters of these condensed layers to recover performance.

Datasets

  • Calibration Data: The primary calibration dataset used is the C4 dataset. The authors also experimented with audio-domain samples from the open-source Emilia dataset and found comparable results, suggesting CD-MoE is not highly dependent on a specific calibration dataset.
  • Evaluation Datasets: The models are evaluated on a suite of downstream tasks, including:
  • Commonsense Reasoning Benchmarks: ARC-Challenge, BoolQ, HellaSwag, OpenBookQA, PIQA, RTE, WinoGrande.
  • Massive Multitask Language Understanding (MMLU).
    • Mathematical Task: GSM8K.
  • Code Generation Task: HumanEval.

Key Insights and Ideas

  • Condensation over Pruning: The paper argues that simply removing experts or layers (pruning) is too aggressive. Condensing MoE layers into smaller dense structures by retaining a few key experts offers a better trade-off between efficiency and performance.
  • Shared Experts are Crucial: The findings suggest that shared experts play a significant role in maintaining model capability. CD-MoE-S, which retains only shared experts, performs comparably to CD-MOE-SR (which also retains some routed experts) in zero-shot settings.
  • JS Divergence as a Robust Metric: The Jensen-Shannon (JS) divergence proves to be an effective metric for guiding both expert and layer selection, accurately reflecting the impact of condensation on model outputs.
  • Lightweight Fine-tuning is Powerful: Even after significant condensation, a focused, lightweight fine-tuning on only the condensed layers can almost fully restore the model's original performance, demonstrating the recoverability of knowledge.

Key Results

  • DeepSeekMoE-16B:
    • Reduces memory usage by 27.5%.
  • Increases inference speed by 1.26x.
  • Maintains ~90% of the original zero-shot accuracy.
  • Lightweight fine-tuning recovers ~98% of the original performance.
  • Comparison to Baselines: CD-MOE consistently outperforms methods like Block Drop and Layer Drop, especially as pruning becomes more aggressive.
  • Comparison to Dense LLMs: Even without fine-tuning, condensed MoEs can surpass smaller dense LLMs of comparable size.
  • Efficiency: The greedy search algorithms for expert and layer selection are computationally efficient, requiring only a few hundred inferences per layer.

Limitations and Future Work

  • Limitations: The paper notes that all experiments were conducted in a single run due to resource constraints. While CD-MoE shows strong performance, the exact trade-off between memory reduction and accuracy can vary depending on the specific MoE architecture and the number of layers/experts condensed.
  • Future Work: The authors suggest exploring the synergy of CD-MoE with quantization and knowledge distillation. They also aim to extend the method to more diverse MoE structures that may lack shared experts. Further research could investigate optimal strategies for selecting the number of condensed layers and experts for different tasks and resource constraints.

Summary updated

BibTeX
@article{cao2025condense,
  author = {Mingyu Cao and Gen Li and Jie Ji and Jiaqi Zhang and Ajay Jaiswal and Li Shen and Xiaolong Ma and Shiwei Liu and Lu Yin},
  title = {{Condense, Don't Just Prune: Enhancing Efficiency and Performance in MoE Layer Pruning}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=BQe6j6sAu6},
}
Figure