[论文解读] MoEfication: Conditional Computation of Transformer Models for Efficient Inference
本文提出 MoEfication,一种通过将标准模型转换为稀疏专家混合(MoE)架构来加速 Transformer 推理的方法,且模型参数量不增加。通过将前馈网络(FFN)参数拆分为多个专家,并利用路由器根据输入条件仅激活其中一小部分,MoEfication 将计算量最多减少 80%——例如,在 7 亿参数模型中仅激活 20% 的 FFN 参数——且在文本分类和阅读理解任务上未造成性能下降。
Transformer-based pre-trained language models can achieve superior performance on most NLP tasks due to large parameter capacity, but also lead to huge computation cost. Fortunately, we find by empirical study that, most inputs only activate a tiny ratio of neurons during inference. Hence, we explore to accelerate large-model inference by conditional computation based on the sparse activation phenomenon. We propose to transform a large model into its mixture-of-experts (MoE) version with equal model size, namely MoEfication. Model MoEfication consists of two steps: (1) splitting the parameters of feed-forward neural networks (FFNs) into multiple parts as experts, and (2) building expert routers to decide which experts will be used for each input. To further improve the performance of MoEfied models, we can also fine-tune the models on downstream tasks, namely parameter calibration. Experimental results show that the MoEfied models can significantly reduce computation cost, e.g., only activating 20% FFN parameters of a 700-million-parameter model without performance degradation on several downstream tasks including text classification and reading comprehension.
研究动机与目标
- 解决大型预训练 Transformer 模型在推理阶段计算成本过高的问题。
- 利用每输入仅激活少量神经元的实证观察,实现稀疏计算。
- 设计一种方法,将标准模型转换为与原始模型参数量相同的 MoE 架构,以保持模型容量。
- 在不降低下游 NLP 任务性能的前提下提升推理效率。
- 通过在真实世界基准上的微调和定量评估,验证 MoEfication 的有效性。
提出的方法
- 将 Transformer 的前馈网络(FFN)参数拆分为多个专家子网络。
- 引入专家路由器,根据输入依赖的路由机制动态选择每个输入 token 应激活的专家。
- 通过在专家间分配参数而不增加总大小,保持与原始模型相同的总参数量。
- 通过在下游任务上进行微调(参数校准)来提升 MoEfied 模型的性能。
- 利用条件计算仅激活每个输入的少量专家子集,从而在推理过程中减少 FLOPs。
- 利用标准模型中观察到的稀疏激活模式,指导专家路由与效率提升。
实验结果
研究问题
- RQ1我们能否通过利用稀疏激活模式,在大型 Transformer 模型中实现显著的推理效率提升?
- RQ2将标准 Transformer 转换为与原始参数量相同的专家混合(MoE)架构,是否能保持模型性能?
- RQ3在不造成性能下降的前提下,条件计算能在多大程度上减少推理过程中的 FLOPs?
- RQ4通过微调进行的参数校准在多大程度上能有效提升 MoEfied 模型的性能?
- RQ5MoEfication 是否能在包括文本分类和阅读理解在内的多种 NLP 任务中有效应用?
主要发现
- MoEfication 在推理过程中将计算成本最多降低 80%,在 7 亿参数模型中仅激活 20% 的 FFN 参数。
- MoEfied 模型在下游任务(包括文本分类和阅读理解)上的性能与原始模型相比未出现任何下降。
- 由于总参数量与原始模型相同,该方法在保持模型容量的同时实现了显著的效率提升。
- 微调(参数校准)有效提升了 MoEfied 模型在下游任务上的性能,证实了其有效性。
- 实证分析表明,大多数输入仅激活少量神经元,验证了 MoEfication 中条件计算的基础合理性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。