专家并行是把稀疏混合专家模型中的专家网络分散到不同设备、让每个令牌只路由到少数专家上计算的并行技术,核心是通过全互换通信把令牌送到对应专家所在的设备并把结果取回,能力包括专家切分与冗余、多种路由策略、负载均衡机制以及与其他并行维度的组合。它解决的是稀疏专家模型参数量巨大但每次只需激活少数专家带来的存储压力问题,并不解决路由不均造成的热点问题。
专家并行的核心是把专家分散到设备上,它可以帮助企业实现以下目标:
让总参数量与实际计算量解耦。模型可以拥有极大的参数规模,而每个令牌只经过被选中的少数专家,单次推理的算力开销接近小模型。
让计算量可以按任务调节。针对复杂请求路由到更多专家,简单请求只走少量专家,资源消耗随任务复杂度伸缩。
让专家按领域分工。长尾领域与多语言场景可以配置专门负责的专家,通用能力与专项能力在同一模型内并存。
让大规模稀疏模型具备工程可行性。千亿参数级别的稀疏模型得以在有限集群上完成训练与在线服务调度。
总之,专家并行可以帮助企业用稀疏结构同时获得大模型的知识容量与接近小模型的推理成本,把专家分工与动态路由引入生产服务,并通过与张量、流水线并行组合支撑超大稀疏模型落地,同时需要为负载均衡与全互换通信带来的网络敏感性留出优化余量。
翻译
Expert parallelism spreads the expert networks of a sparse mixture-of-experts model across different devices so that each token is computed only by a few selected experts. Its core is using all-to-all communication to send tokens to the device holding the relevant expert and bring the results back, with capabilities covering expert splitting and redundancy, several routing strategies, load balancing mechanisms and combination with other parallelism dimensions. It solves the storage pressure that comes from huge parameter counts in sparse expert models while only a few experts are activated per token, but it does not solve hot-spot experts caused by unbalanced routing.
At the heart of expert parallelism is spreading experts across devices, which can help companies achieve the following:
Decouple total parameters from active computation. A model can hold an enormous parameter count while each token passes through only a handful of experts, keeping per-request inference cost close to that of a small model.
Let compute scale with task complexity. Complicated requests are routed to more experts while simple ones use only a few, so resource consumption follows the difficulty of the task.
Let experts specialize by domain. Long-tail verticals and multilingual cases can be assigned dedicated experts, so general capability and specialized capability coexist inside one model.
Make large sparse models engineering-feasible. Sparse models with hundreds of billions of parameters can be trained and served online on a limited cluster.
In short, expert parallelism can help enterprises use sparse structure to obtain both the knowledge capacity of a large model and inference cost close to a small one, bring expert specialization and dynamic routing into production services, and support very large sparse models by combining with tensor and pipeline parallelism, while leaving room to optimize the load imbalance and the network sensitivity introduced by all-to-all communication.