Sparse-MLP: A Fully-MLP Architecture with Conditional Computation

Yuxuan Lou, Fuzhao Xue, Zangwei Zheng, Yang You

Abstract

Mixture-of-Experts (MoE), a conditional computation architecture, achieved promising performance by scaling local module (i.e. feed-forward network) of transformer. However, scaling the cross-token module (i.e. self-attention) is challenging due to the unstable training. This work proposes Sparse-MLP, an all-MLP model which applies sparsely-activated MLPs to cross-token modeling. Specifically, in each Sparse block of our all-MLP model, we apply two stages of MoE layers: one with MLP experts mixing information within channels along image patch dimension, the other with MLP experts mixing information within patches along the channel dimension. In addition, by proposing importance-score routing strategy for MoE and redesigning the image representation shape, we further improve our model's computational efficiency. Experimentally, we are more computation-efficient than Vision Transformers with comparable accuracy. Also, our models can outperform MLP-Mixer by 2.5% on ImageNet Top-1 accuracy with fewer parameters and computational cost. On downstream tasks, i.e. Cifar10 and Cifar100, our models can still achieve better performance than baselines.

Introduction

Mixture-of-Experts (MoE) is a powerful "conditional computation" technique that scales model capacity without a proportional increase in compute cost by activating only a subset of neural network "experts" for each input. While MoE is commonly applied to local feed-forward networks (FFNs) in Transformer architectures, applying it to cross-token modules like self-attention is notoriously unstable and prone to training divergence.

Sparse-MLP addresses this by designing a stable, highly scalable all-MLP architecture. By replacing self-attention with sparsely activated MLPs across both spatial and channel dimensions, Sparse-MLP overcomes the scaling limitations of dense all-MLP models like MLP-Mixer, which often struggle with overfitting or high computational costs as they grow.

Methods

The Sparse-MLP architecture interleaves standard "Dense blocks" with novel "Sparse blocks." The architecture's core innovation lies in its two-stage MoE design and structural optimizations for routing efficiency.

Two-Stage MoE Design

Inside each Sparse block, the model applies MoE in two distinct directions:

  1. Token-mixing MoE ($\text{MoE}_S$): This layer mixes information across spatial locations (image patches) within channels. It serves as a computationally efficient, sparse alternative to the self-attention mechanism found in Transformers.
  2. Channel-mixing MoE ($\text{MoE}_C$): This layer mixes information within individual patches along the channel dimension.
Overview of the Sparse-MLP architecture, detailing the Sparse block structure and the routing of tokens and channels to MLP experts.

Structural and Routing Optimizations

To improve efficiency, the authors introduced Rescale Sub-layers. Standard vision representations often have few tokens but massive channel dimensions, which is inefficient for token-mixing MoE routing. By using linear layers to increase the number of tokens and decrease channels before Sparse blocks (and reversing the process afterward), the authors reduced pre-training computation costs by 30.5% while improving accuracy.

Furthermore, the model utilizes Importance-Score Routing. Unlike standard routing that evaluates every token or channel, this strategy scores channels based on their highest routing weight and drops the bottom 10% from the allocation process, saving compute without sacrificing model capacity.

Experimental Setup

The models were pre-trained on ImageNet-1k using the MoCo v3 self-supervised learning algorithm. The authors found that self-supervised pre-training acts as a crucial regularizer, preventing the severe overfitting that occurs when training massive MLP models from scratch. Evaluation was conducted on ImageNet-1k, CIFAR-10, and CIFAR-100.

Key Results

Sparse-MLP demonstrates superior performance and efficiency compared to both Vision Transformers (ViTs) and dense MLP-Mixers.

  • ImageNet-1k Performance: Sparse-B (Base) achieved 77.9% top-1 accuracy, outperforming Mixer-B/16 by 2.0% and ViT-B/16 by 1.2%. Sparse-L (Large) reached 79.4% accuracy, outperforming Mixer-L/16 by 3.3% while using only 62.8% of the parameters and 85.5% of the pre-training cost.
  • Efficiency: The importance-score routing strategy reduced total pre-training time by up to 4.1% with zero drop in validation accuracy.
  • Downstream Tasks: Sparse-MLP consistently outperformed MLP-Mixer baselines on CIFAR-10 (96.2% vs 95.6% for Base models) and CIFAR-100.
Quantitative comparison of Sparse-MLP against ViT and MLP-Mixer baselines, highlighting improvements in accuracy, parameter count, and throughput.

Discussion and Conclusion

Sparse-MLP proves that two-dimensional MoE is a viable and stable path for scaling vision models. A key insight is that representation shape dictates MoE efficiency; actively reshaping tensors to balance token and channel counts is essential for performance.

While the model shows great promise, the authors noted that scaling the number of experts eventually leads to overfitting on ImageNet-1k. Future work will involve pre-training on larger datasets like JFT-300M and adapting this fully-MLP MoE architecture for Natural Language Processing (NLP) tasks.

Summary updated

BibTeX
@misc{lou2021sparse,
  author = {Yuxuan Lou and Fuzhao Xue and Zangwei Zheng and Yang You},
  title = {{Sparse-MLP: A Fully-MLP Architecture with Conditional Computation}},
  year = {2021},
  eprint = {2109.02008},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.02008},
}
Figure