paper-with-me

홈 › Papers

MoEfication: Transformer Feed-forward Layers are Mixtures of Experts

2021-10-05 · Findings (ACL) 2022 5 · Zhengyan Zhang, Yankai Lin, Zhiyuan Liu, Peng Li, Maosong Sun, Jie zhou

Recent work has shown that feed-forward networks (FFNs) in pre-trained Transformers are a key component, storing various linguistic and factual knowledge. However, the computational patterns of FFNs are still unclear. In this work, we study the computational patterns of FFNs and observe that most inputs only activate a tiny ratio of neurons of FFNs. This phenomenon is similar to the sparsity of the human brain, which drives research on functional partitions of the human brain. To verify whether functional partitions also emerge in FFNs, we propose to convert a model into its MoE version with the same parameters, namely MoEfication. Specifically, MoEfication consists of two phases: (1) splitting the parameters of FFNs into multiple functional partitions as experts, and (2) building expert routers to decide which experts will be used for each input. Experimental results show that MoEfication can conditionally use 10% to 30% of FFN parameters while maintaining over 95% original performance for different models on various downstream tasks. Besides, MoEfication brings two advantages: (1) it significantly reduces the FLOPS of inference, i.e., 2x speedup with 25% of FFN parameters, and (2) it provides a fine-grained perspective to study the inner mechanism of FFNs. The source code of this paper can be obtained from https://github.com/thunlp/MoEfication.

📄 PDF Abstract BibTeX arXiv:2110.01786

Code (1)

thunlp/moefication 공식 구현 pytorch

Tasks

Machine Reading ComprehensionReading ComprehensionText Classification

Similar Papers 제목 키워드 기반

MoEfication: Conditional Computation of Transformer Models for Efficient Inference

2021-11-16 · ACL ARR November 2021 11 · Anonymous

Transformer-based pre-trained language models achieve superior performance on most NLP tasks due to large parameter capacity, but also lead to huge computation cost. Fortunately, we observe that most inputs only activate…

Mixture-of-Experts

PrunePath: Towards Highly Structured Sparse Language Models

2026-05-27 · Zhexuan Gu, Zixun Fu, Yancheng Yuan arxiv

Feed-forward networks (FFNs) dominate the parameter count and computation of modern language models, yet existing pruning methods often struggle to convert sparsity into hardware-friendly inference efficiency gains. We i…

Modularity in Transformers: Investigating Neuron Separability & Specialization

2024-08-30 · Nicholas Pochinkov, Thomas Jones, Mohammed Rashidur Rahman

Transformer models are increasingly prevalent in various applications, yet our understanding of their internal workings remains limited. This paper investigates the modularity and task specialization of neurons within tr…

Fast Feedforward Networks

2023-08-28 · Peter Belcak, Roger Wattenhofer

We break the linear link between the layer size and its inference cost by introducing the fast feedforward (FFF) architecture, a log-time alternative to feedforward networks. We demonstrate that FFFs are up to 220x faste…

Mixture-of-Experts

Transformers Can Overcome the Curse of Dimensionality: A Theoretical Study from an Approximation Perspective

2025-04-18 · Yuling Jiao, Yanming Lai, Yang Wang, Bokai Yan

The Transformer model is widely used in various application areas of machine learning, such as natural language processing. This paper investigates the approximation of the H\"older continuous function class $\mathcal{H}…