Skip to main content
QUICK REVIEW

[Paper Review] Sparse MLP for Image Recognition: Is Self-Attention Really Necessary?

Chuanxin Tang, Yucheng Zhao|arXiv (Cornell University)|Sep 12, 2021
Advanced Neural Network ApplicationsComputer Science13 citations
TL;DR

This paper proposes sMLPNet, an attention-free vision model that replaces self-attention with a sparse MLP (sMLP) module using axial global modeling and weight sharing. By reducing parameters and FLOPs while avoiding overfitting, sMLPNet achieves 83.4% top-1 accuracy on ImageNet-1K with only 65.9M parameters—matching Swin Transformer's performance at 25% smaller model size and 10% fewer FLOPs, demonstrating that self-attention is not essential for state-of-the-art image recognition.

ABSTRACT

Transformers have sprung up in the field of computer vision. In this work, we explore whether the core self-attention module in Transformer is the key to achieving excellent performance in image recognition. To this end, we build an attention-free network called sMLPNet based on the existing MLP-based vision models. Specifically, we replace the MLP module in the token-mixing step with a novel sparse MLP (sMLP) module. For 2D image tokens, sMLP applies 1D MLP along the axial directions and the parameters are shared among rows or columns. By sparse connection and weight sharing, sMLP module significantly reduces the number of model parameters and computational complexity, avoiding the common over-fitting problem that plagues the performance of MLP-like models. When only trained on the ImageNet-1K dataset, the proposed sMLPNet achieves 81.9% top-1 accuracy with only 24M parameters, which is much better than most CNNs and vision Transformers under the same model size constraint. When scaling up to 66M parameters, sMLPNet achieves 83.4% top-1 accuracy, which is on par with the state-of-the-art Swin Transformer. The success of sMLPNet suggests that the self-attention mechanism is not necessarily a silver bullet in computer vision. The code and models are publicly available at https://github.com/microsoft/SPACH

Motivation & Objective

  • Challenge the assumption that self-attention is essential for state-of-the-art performance in vision transformers.
  • Investigate whether MLP-based models can achieve competitive performance without self-attention by addressing their key limitations: overfitting and high parameter count.
  • Design a novel sparse MLP (sMLP) module that enables efficient global feature modeling through axial computation and weight sharing.
  • Build an attention-free network (sMLPNet) that matches or exceeds the performance of SOTA vision transformers like Swin Transformer.
  • Validate the effectiveness of sMLPNet on ImageNet-1K under standard training protocols without data augmentation or extra pretraining.

Proposed method

  • The sMLP module applies 1D MLPs along the row and column axes of 2D image tokens, enabling axial global dependency modeling.
  • Parameters are shared across all rows (or columns), drastically reducing model size and computational complexity.
  • Sparsity is introduced by limiting each token to interact only with its row and column neighbors in the sMLP layer, avoiding full quadratic attention.
  • The sMLP module is integrated into a ViT-like architecture, replacing the self-attention mechanism in the token-mixing block.
  • Depthwise convolution is used in the token-mixing block to preserve locality bias, while channel mixing remains unchanged from standard MLPs.
  • Model scaling is achieved by adjusting width and depth, with experiments conducted on ImageNet-1K at 224×224 resolution.

Experimental results

Research questions

  • RQ1Can an MLP-based vision model achieve state-of-the-art performance without using self-attention?
  • RQ2Does the self-attention mechanism in vision transformers provide a fundamental advantage over alternative global modeling mechanisms?
  • RQ3Can sparse connectivity and weight sharing in MLPs mitigate overfitting and reduce computational cost while preserving performance?
  • RQ4Is it possible to achieve competitive accuracy with smaller model sizes by combining locality bias and axial global modeling?
  • RQ5Does the success of Swin Transformer stem from locality or from self-attention, and can an attention-free model match its performance?

Key findings

  • sMLPNet achieves 81.9% top-1 accuracy on ImageNet-1K with only 24.1M parameters, outperforming most CNNs and vision Transformers under the same size constraint.
  • With 65.9M parameters, sMLPNet-B attains 83.4% top-1 accuracy, matching Swin-B’s performance while using 25% fewer parameters and 10% fewer FLOPs.
  • The model shows no signs of overfitting even at 66M parameters, unlike MLP-Mixer and other MLP-based models that suffer from severe overfitting.
  • sMLPNet-T (19.2M parameters) achieves 81.3% top-1 accuracy, the highest among models with under 5B FLOPs.
  • Compared to DeiT-S and DeiT-B, sMLPNet-T achieves higher accuracy with significantly fewer parameters and FLOPs.
  • The sMLP module reduces computational complexity from quadratic to linear in sequence length, enabling efficient processing of high-resolution inputs.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.