通过拆分专家模块提升大模型推理效率,降低显存压力
MegaScale-Infer: Serving Mixture-of-Experts at Scale with Disaggregated Expert Parallelism
- 将注意力与专家模块分离部署,独立扩展并灵活并行
- 采用乒乓流水线实现请求微批调度,吞吐量最高提升1.9倍
- 专为稀疏激活设计通信库,减少数据传输开销,适合大规模部署
Mixture-of-Experts(MoE)在提升大语言模型性能的同时降低计算复杂度,但其稀疏激活特性使前馈网络在推理阶段由计算密集转为内存密集,导致GPU利用率下降和运营成本上升。本文提出MegaScale-Infer,一种高效低成本的大规模MoE模型服务系统。该系统将每层模型中的注意力与前馈网络模块解耦,支持独立扩展、定制并行策略及异构部署。为充分挖掘解耦后的优势,MegaScale-Infer引入乒乓流水线并行,将请求批次划分为微批次,在注意力与前馈模块间往返处理。结合各模块特有的模型并行方式,有效隐藏通信开销并最大化GPU利用率。此外,系统提供高性能的M2N通信库,消除不必要的显存到内存拷贝、组初始化开销及显存同步。实验表明,MegaScale-Infer相较当前最优方案,单卡吞吐量最高提升1.90倍。
原文摘要 · Abstract (English)
Mixture-of-Experts (MoE) showcases tremendous potential to scale large language models (LLMs) with enhanced performance and reduced computational complexity. However, its sparsely activated architecture shifts feed-forward networks (FFNs) from being compute-intensive to memory-intensive during inference, leading to substantially lower GPU utilization and increased operational costs. We present MegaScale-Infer, an efficient and cost-effective system for serving large-scale MoE models. MegaScale-Infer disaggregates attention and FFN modules within each model layer, enabling independent scaling, tailored parallelism strategies, and heterogeneous deployment for both modules. To fully exploit disaggregation in the presence of MoE's sparsity, MegaScale-Infer introduces ping-pong pipeline parallelism, which partitions a request batch into micro-batches and shuttles them between attention and FFNs for inference. Combined with distinct model parallelism for each module, MegaScale-Infer effectively hides communication overhead and maximizes GPU utilization. To adapt to disaggregated attention and FFN modules and minimize data transmission overhead (e.g., token dispatch), MegaScale-Infer provides a high-performance M2N communication library that eliminates unnecessary GPU-to-CPU data copies, group initialization overhead, and GPU synchronization. Experimental results indicate that MegaScale-Infer achieves up to 1.90x higher per-GPU throughput than state-of-the-art solutions.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。