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

ConDense-MoE (CD-MoE) is a new framework for compressing Mixture-of-Experts (MoE) models that "condenses" sparse layers into small, dense ones instead of pruning them entirely. By removing the routing mechanism at selected layers and keeping only the most critical experts, it achieves a 27.5% memory reduction and 1.26x speedup on DeepSeekMoE-16B while retaining 98% of original performance after a few hours of fine-tuning.

What Problem Does This Paper Address?

Mixture-of-Experts (MoE) architectures are the secret sauce behind many state-of-the-art Large Language Models (LLMs) like DeepSeek and Qwen. They allow models to scale to massive parameter counts while keeping "active" parameters (and thus compute costs) low.

However, MoE models have a massive memory footprint. Even if only two experts are used for a specific token, all 64+ experts must be stored in GPU memory. Previous attempts to solve this usually involved "Layer Pruning"—simply dropping entire MoE layers. While this saves memory, it often causes a significant drop in accuracy because the model loses the specialized knowledge stored in those experts.

Methods

The authors introduce CD-MoE, which targets "fine-grained" MoEs that use shared experts (experts that are always active for every token).

1. From Sparse to Dense

Instead of deleting a layer, CD-MoE transforms it. It removes the "router" (the part that decides which experts to use) and selects a small subset of the most important experts to be always active. This turns a sparse MoE layer into a standard, hardware-friendly dense layer.

The transition from a standard MoE layer with a router to a condensed dense layer.

2. Greedy Selection Algorithms

The paper proposes two greedy search algorithms to minimize performance loss:

  • Expert Selection: For a given layer, which experts should we keep? The algorithm iteratively adds experts that minimize the Jensen-Shannon (JS) divergence between the original layer's output and the new condensed output.
  • Layer Selection: Which layers in the model are the safest to condense? They found that the first layer and the last few layers are often the most sensitive and should be left alone.

3. Fixed Gate Values

In a normal MoE, the router provides a weight (gate value) for each expert. In a condensed layer, the authors use a fixed weight for each expert, calculated as the average activation value from a calibration dataset.

Datasets

  • Calibration: The authors used 100 samples from the C4 (Colossal Clean Crawled Corpus) dataset to guide the greedy selection process.
  • Evaluation: The models were tested on a wide battery of benchmarks, including MMLU (general knowledge), ARC-Challenge, HellaSwag, BoolQ (reasoning), GSM8K (math), and HumanEval (coding).

Key Insights and Ideas

  • Shared Experts are Anchors: In models like DeepSeekMoE, shared experts already do a lot of the heavy lifting. CD-MoE leverages this by keeping these shared experts and adding just a few "top" routing experts to maintain the layer's representational power.
  • Condensing > Pruning: Simply removing the routing mechanism while keeping a few experts (Condensing) results in much lower output distortion than removing the experts entirely (Pruning).
  • Layer Sensitivity varies: As shown in Figure 2, the impact of condensing a layer isn't uniform. The "middle" layers of an LLM are generally more redundant and easier to condense than the very early or very late layers.
Fluctuations in JS divergence, KL divergence, and Perplexity across different layers when condensed.

Key Results

The authors evaluated CD-MoE on DeepSeekMoE-16B and Qwen1.5-MoE-A2.7B:

  • Efficiency: On DeepSeekMoE-16B, they reduced memory usage by 27.5% and increased inference speed by 1.26x.
  • Zero-Shot Performance: Without any fine-tuning, the condensed model retained roughly 90% of its original accuracy, significantly outperforming standard "LayerDrop" baselines.
  • Performance Recovery: By performing "lightweight supervised fine-tuning" (SFT) only on the condensed layers—which took only 5 hours on a single A100 GPU—they recovered 98% of the original model's performance.
Comparison of CD-MoE variants against baselines. CD-MoE maintains higher accuracy at lower memory ratios and higher speedups.

Limitations and Future Work

  • Architecture Specificity: The current method is specifically optimized for MoE architectures with shared experts. While these are becoming the industry standard, the method might need adjustments for "classic" MoEs (like Mixtral) that lack shared experts.
  • Future Synergy: The authors suggest that CD-MoE could be combined with other compression techniques like quantization (reducing bit-precision) and knowledge distillation to push efficiency even further.
  • Scaling: While tested on models up to 57B parameters, testing on even larger "frontier" models remains a direction for future research.

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