CMoE: Fast Carving of Mixture-of-Experts for Efficient LLM Inference

Zehua Pei, Lancheng Zou, Hui-Ling Zhen, Xianzhi Yu, Wulong Liu, Sinno Jialin Pan, Mingxuan Yuan, Bei Yu · DOI

Abstract

Large Language Models (LLMs) face significant deployment challenges due to the high computational and memory costs of their dense Feed-Forward Networks (FFNs). This paper introduces CMoE, a framework designed to convert dense LLMs into efficient Mixture-of-Experts (MoE) models without the need for expensive retraining. By analytically grouping neurons and constructing a router based on activation statistics, CMoE achieves up to 1.5x inference speedups while maintaining strong performance. This method offers a practical path for deploying high-capacity LLMs on constrained compute budgets.

Introduction

As Large Language Models scale, their inference costs grow proportionally, with Feed-Forward Networks (FFNs) consuming approximately 70% of compute and memory resources. Mixture-of-Experts (MoE) architectures mitigate this by activating only a specialized subset of parameters for each token. However, traditional MoE conversion requires massive compute for continual pre-training to teach the routing mechanism. CMoE addresses this by restructuring dense models into sparse MoEs through a training-free pipeline that takes less than five minutes on a single GPU.

The CMoE Framework

The CMoE conversion process consists of three primary stages:

  1. Neuron Activation Profiling: Using a small calibration dataset, CMoE identifies "shared experts" (frequently active neurons) and "routed experts" (sparsely active neurons) using an Absolute TopK metric.
  2. Expert Grouping: Routed experts are clustered using a constrained balanced K-means algorithm to group neurons that tend to activate simultaneously.
  3. Analytical Router Construction: Instead of gradient-based training, CMoE analytically derives a router based on the activation statistics of representative neurons in each cluster.
The CMoE framework overview, illustrating the three-step conversion pipeline and the resulting inference architecture.

Experimental Results

Evaluations on Llama-2 7B and Llama-3 8B demonstrate CMoE's effectiveness. At a 25% activation ratio, CMoE provides a 1.5x end-to-end latency reduction in memory-bound scenarios. While the model is functional immediately after conversion, performance can be further enhanced with lightweight LoRA fine-tuning. For instance, just one hour of fine-tuning on 2,000 samples allows the model to recover over 76% of its original downstream accuracy.

Inference speedup metrics for CMoE configurations across memory-bound and compute-bound environments.

Key Insights

  • Skewed Activation Patterns: FFN neurons exhibit highly non-uniform activation, justifying the split between shared and routed experts.
  • Mathematical Initialization: Deriving the router analytically prevents the model collapse typically seen in training-free MoE conversions, where perplexity often explodes.
  • Efficiency vs. Performance: CMoE allows for a flexible trade-off; at 75% activation, it achieves lossless precision with a modest speedup, while 25% activation maximizes efficiency for compute-constrained environments.

Limitations and Future Work

The quality of CMoE's expert grouping is dependent on the calibration dataset. If the calibration data is not representative of the target domain, the expert grouping may be suboptimal. Future research will focus on improving the analytical router's nuances to close the performance gap at high sparsity levels and extending the framework to a wider variety of model architectures.

Conclusion

CMoE provides a robust and efficient method for transforming dense LLMs into MoEs. By replacing expensive retraining with analytical carving, it democratizes the use of MoE architectures, allowing practitioners to achieve significant inference speedups with minimal computational overhead.

Summary updated

BibTeX
@misc{pei2025cmoe,
  author = {Zehua Pei and Lancheng Zou and Hui-Ling Zhen and Xianzhi Yu and Wulong Liu and Sinno Jialin Pan and Mingxuan Yuan and Bei Yu},
  title = {{CMoE: Fast Carving of Mixture-of-Experts for Efficient LLM Inference}},
  year = {2025},
  eprint = {2502.04416},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.04416},
}
Figure