S2-MLPv2: Improved Spatial-Shift MLP Architecture for Vision

Tan Yu, Xu Li, Yunfeng Cai, Mingming Sun, Ping LiarXiv 2021

Abstract

S2-MLPv2 represents a significant advancement in the development of Multi-Layer Perceptron (MLP) based architectures for computer vision. While Vision Transformers (ViTs) have dominated the field by leveraging self-attention for global context, they often suffer from high computational costs. S2-MLPv2 evolves the spatial-shift MLP paradigm by introducing three key innovations: channel expansion, asymmetric spatial shifts, and a split-attention fusion mechanism. These improvements allow the model to achieve a top-1 accuracy of 83.6% on ImageNet-1K, surpassing many Transformer-based models like Swin Transformer and ViT-B. This work demonstrates that pure MLP architectures, when properly designed to handle spatial dependencies, remain highly competitive and efficient alternatives to attention-based backbones.

Introduction

The search for the optimal computer vision backbone has transitioned from the local inductive biases of Convolutional Neural Networks (CNNs) to the global, data-driven perspective of Vision Transformers. Despite their success, the quadratic complexity of self-attention in ViTs remains a bottleneck for high-resolution tasks. This has spurred interest in MLP-based models, such as MLP-Mixer and ResMLP, which aim to achieve similar performance using only linear layers and non-linearities.

The original S2-MLP (Spatial-Shift MLP) introduced a novel way to communicate information between image patches by physically shifting feature map channels. However, early iterations were soon outpaced by hierarchical models that utilized multi-scale "pyramid" structures. S2-MLPv2 is designed to reclaim the performance lead by refining how spatial information is processed, shifted, and fused within the network.

Methodology: The S2-MLPv2 Block

The core innovation of S2-MLPv2 lies in its redesigned spatial-shift block. Unlike previous versions that applied uniform shifts, S2-MLPv2 utilizes a more complex branching strategy to capture diverse spatial relationships.

1. Channel Expansion and Splitting

The process begins by taking an input feature map with $c$ channels and expanding it to $3c$ channels using a linear MLP. This expansion provides a higher-dimensional space for feature manipulation. The expanded feature map is then split into three equal parts, each destined for a different spatial operation.

2. Asymmetric Spatial Shifts

The three split segments are processed in parallel:

  • Standard Shift: One segment undergoes the horizontal and vertical shifts established in the original S2-MLP.
  • Asymmetric Shift: A second segment undergoes a newly designed asymmetric shift. This operation is specifically engineered to be complementary to the standard shift, allowing the model to capture spatial dependencies that might be missed by symmetric operations.
  • Identity Mapping: The third segment is passed through without any shift. This preserves the original local information, ensuring that the model does not lose fine-grained details during the shifting process.
The evolution of spatial-shift operations from the original S2-MLP (a) to the multi-branch S2-MLPv2 (b), which incorporates asymmetric shifts and identity paths.

3. Split-Attention Fusion

After the shifting operations, the three branches are fused using a "split-attention" mechanism. Rather than a simple addition or concatenation, the model learns to dynamically weight the contribution of each branch. This allows the network to adaptively prioritize different spatial relationships based on the input content, effectively providing the benefits of an attention mechanism without the $O(N^2)$ complexity of global self-attention.

Experimental Setup and Pyramid Structure

S2-MLPv2 adopts a hierarchical pyramid structure, which has become a standard for modern vision backbones. This structure allows the model to process information at different scales, starting with coarse patches and moving to finer details.

Table detailing the architectural settings for S2-MLPv2-Small and Medium variants, showing the transition from 7x7 to 2x2 patch sizes and the 3x expansion ratio.

As shown in the configuration table, the model typically uses a two-stage approach. In the first stage, it processes $32^2$ tokens with a patch size of 7x7. In the second stage, it refines this to $16^2$ tokens with a patch size of 2x2. This multi-scale approach is crucial for tasks beyond simple classification, such as object detection and semantic segmentation.

Key Results and Performance

The S2-MLPv2 model was rigorously tested on the ImageNet-1K benchmark. The results highlight its superiority over both previous MLP models and popular Transformer architectures.

  • State-of-the-Art MLP Performance: S2-MLPv2-Medium achieves 83.6% top-1 accuracy, significantly outperforming MLP-Mixer (76.4%), ResMLP (79.4%), and the original S2-MLP-deep (80.7%).
  • Competitive with Transformers: The model outperforms Swin-B (83.3%) and ViT-B (79.7%). Notably, it achieves these results with 55 million parameters, compared to Swin-B's 88 million, demonstrating superior parameter efficiency.
  • Robustness and Scalability: The spatial-shift mechanism is inherently more flexible than fixed-kernel convolutions, allowing the model to generalize well across different image scales and downstream tasks.

Conclusion and Future Directions

S2-MLPv2 proves that MLP-based architectures can compete with and even outperform Transformers in vision tasks. While highly accurate, the current model uses a relatively coarse two-level pyramid structure. Future research will focus on integrating more sophisticated multi-level pyramids and exploring even smaller patch sizes. By further refining the spatial-shift logic and architectural hierarchy, the goal is to create a vision backbone that combines the simplicity of MLPs with the state-of-the-art performance of the most advanced hybrid models.

Summary updated

BibTeX
@misc{yu2021s,
  author = {Tan Yu and Xu Li and Yunfeng Cai and Mingming Sun and Ping Li},
  title = {{S2-MLPv2: Improved Spatial-Shift MLP Architecture for Vision}},
  year = {2021},
  eprint = {2108.01072},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.01072},
}
Figure