负载最少的专家并行:不平衡专家混合模型的负载平衡
Least-Loaded Expert Parallelism: Load Balancing An Imbalanced Mixture-of-Experts
AI总结:
本文提出LLEP算法,通过动态路由减少MoE模型中专家负载不平衡,提升训练和推理效率,实现5倍速度提升和4倍内存减少。
摘要:
混合专家(MoE)模型通常在预训练时使用显式的负载平衡约束,以确保统计上平衡的专家路由。尽管如此,我们发现即使经过良好训练的MoE模型仍表现出显著的路由不平衡。这种行为可能是自然的,甚至是有益的,因为不平衡的路由允许模型在一小部分专家中集中领域特定的知识。专家并行(EP)旨在通过将专家分布在多个设备上扩展MoE模型,但其假设了平衡的路由。在极端不平衡的情况下,EP可能会将不成比例的令牌集中在少数专家上,导致在训练或推理过程中过载设备出现计算和内存瓶颈,而显式负载平衡通常不可用。我们提出了一种新的EP算法,即最少负载的专家并行(LLEP),该算法动态地将超载设备上的多余令牌和相关专家参数路由到未充分利用的设备上。这确保了所有设备在最小的集体延迟内完成其工作负载,同时遵守内存约束。在不同模型规模下,LLEP相比标准EP实现了高达5倍的速度提升和4倍的峰值内存使用减少。这使训练和推理更快且更高吞吐量,对于gpt-oss-120b模型,速度提高了约1.9倍。我们通过广泛的理论分析和全面的实证评估,包括消融研究,支持我们的方法。这些结果揭示了关键的权衡,并为硬件特定的超参数调优提供了原则性的框架,以实现最佳性能。
英文摘要:
Mixture-of-Experts (MoE) models are typically pre-trained with explicit load-balancing constraints to ensure statistically balanced expert routing. Despite this, we observe that even well-trained MoE models exhibit significantly imbalanced routing. This behavior is arguably natural-and even desirable - as imbalanced routing allows models to concentrate domain-specific knowledge within a subset of experts. Expert parallelism (EP) is designed to scale MoE models by distributing experts across multiple devices, but with a less-discussed assumption of balanced routing. Under extreme imbalance, EP can funnel a disproportionate number of tokens to a small number of experts, leading to compute- and memory-bound failures on overloaded devices during post-training or inference, where explicit load balancing is often inapplicable. We propose Least-Loaded Expert Parallelism (LLEP), a novel EP algorithm that dynamically reroutes excess tokens and associated expert parameters from overloaded devices to underutilized ones. This ensures that all devices complete their workloads within the minimum collective latency while respecting memory constraints. Across different model scales, LLEP achieves up to 5x speedup and 4x reduction in peak memory usage compared to standard EP. This enables faster and higher-throughput post-training and inference, with ~1.9x faster for gpt-oss-120b. We support our method with extensive theoretical analysis and comprehensive empirical evaluations, including ablation studies. These results illuminate key trade-offs and enable a principled framework for hardware-specific hyper-parameter tuning to achieve optimal performance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。