通过压缩专家层提升MoE模型效率,兼顾性能与内存优化
Condense, Don't Just Prune: Enhancing Efficiency and Performance in MoE Layer Pruning
- 将稀疏的MoE层压缩为小规模稠密结构,仅激活少数专家
- 在DeepSeekMoE-16B上减少27.5%内存,推理速度提升26%
- 轻量微调即可恢复98%原始性能,适合部署场景
Mixture-of-Experts (MoE) 能在保持或减少活跃参数的情况下扩展神经网络,但并未缓解模型庞大的内存需求,限制了其在大语言模型(LLMs)时代实际应用的可行性。现有方法尝试移除整个MoE层以降低内存占用,但性能下降明显。本文提出ConDense-MoE(CD-MoE),不直接丢弃整个MoE层,而是将其压缩为更小、更密集的结构,仅对所有输入激活少数专家,同时保持硬件友好性。该方法专为细粒度共享专家设计,其中前馈网络被拆分为多个小型专家,部分专家作为始终激活的共享专家(如DeepSeekMoE和QwenMoE)。实验表明,对于DeepSeekMoE-16B模型,该方法在维持平均精度90%的同时,内存使用减少27.5%,推理速度提升1.26倍。此外,仅需在单张80G A100 GPU上进行5小时轻量级专家微调,即可恢复98%的原始性能。代码已开源。
原文摘要 · Abstract (English)
Mixture-of-Experts (MoE) has garnered significant attention for its ability to scale up neural networks while utilizing the same or even fewer active parameters. However, MoE does not alleviate the massive memory requirements of networks, which limits their practicality in real-world applications, especially in the era of large language models (LLMs). While recent work explores the possibility of removing entire layers of MoE to reduce memory, the performance degradation is still notable. In this paper, we propose ConDense-MoE (CD-MoE), which, instead of dropping the entire MoE layer, condenses the large, sparse MoE layer into a smaller, denser layer with only a few experts activated for all tokens, while maintaining hardware friendliness. Our approach is specifically designed for fine-grained MoE with shared experts, where Feed-Forward Networks are split into many small experts, with certain experts isolated to serve as shared experts that are always activated, such as DeepSeekMoE and QwenMoE. We demonstrate the effectiveness of our method. Specifically, for the DeepSeekMoE-16B model, our approach maintains 90% of the average accuracy while reducing memory usage by 27.5% and increasing inference speed by 1.26 times. Moreover, we show that by applying lightweight expert fine-tuning -- only to the condensed layers -- and using 5 hours on a single 80G A100 GPU, we can successfully recover 98% of the original performance. Our code is available at: https://github.com/duterscmy/CD-MoE/tree/main.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。