Command Palette
Search for a command to run...
Weihao Yu Chenyang Si Pan Zhou Mi Luo Yichen Zhou Jiashi Feng Shuicheng Yan Xinchao Wang

Abstract
MetaFormer, the abstracted architecture of Transformer, has been found to play a significant role in achieving competitive performance. In this paper, we further explore the capacity of MetaFormer, again, without focusing on token mixer design: we introduce several baseline models under MetaFormer using the most basic or common mixers, and summarize our observations as follows: (1) MetaFormer ensures solid lower bound of performance. By merely adopting identity mapping as the token mixer, the MetaFormer model, termed IdentityFormer, achieves >80% accuracy on ImageNet-1K. (2) MetaFormer works well with arbitrary token mixers. When specifying the token mixer as even a random matrix to mix tokens, the resulting model RandFormer yields an accuracy of >81%, outperforming IdentityFormer. Rest assured of MetaFormer's results when new token mixers are adopted. (3) MetaFormer effortlessly offers state-of-the-art results. With just conventional token mixers dated back five years ago, the models instantiated from MetaFormer already beat state of the art. (a) ConvFormer outperforms ConvNeXt. Taking the common depthwise separable convolutions as the token mixer, the model termed ConvFormer, which can be regarded as pure CNNs, outperforms the strong CNN model ConvNeXt. (b) CAFormer sets new record on ImageNet-1K. By simply applying depthwise separable convolutions as token mixer in the bottom stages and vanilla self-attention in the top stages, the resulting model CAFormer sets a new record on ImageNet-1K: it achieves an accuracy of 85.5% at 224x224 resolution, under normal supervised training without external data or distillation. In our expedition to probe MetaFormer, we also find that a new activation, StarReLU, reduces 71% FLOPs of activation compared with GELU yet achieves better performance. We expect StarReLU to find great potential in MetaFormer-like models alongside other neural networks.
Code Repositories
Benchmarks
| Benchmark | Methodology | Metrics |
|---|---|---|
| domain-generalization-on-imagenet-a | CAFormer-B36 (IN-21K) | Number of params: 99M Top-1 accuracy %: 69.4 |
| domain-generalization-on-imagenet-a | CAFormer-B36 | Number of params: 99M Top-1 accuracy %: 48.5 |
| domain-generalization-on-imagenet-a | CAFormer-B36 (IN-21K, 384) | Number of params: 99M Top-1 accuracy %: 79.5 |
| domain-generalization-on-imagenet-a | ConvFormer-B36 (384) | Number of params: 100M Top-1 accuracy %: 55.3 |
| domain-generalization-on-imagenet-a | ConvFormer-B36 (IN-21K) | Number of params: 100M Top-1 accuracy %: 63.3 |
| domain-generalization-on-imagenet-a | CAFormer-B36 (384) | Number of params: 99M Top-1 accuracy %: 61.9 |
| domain-generalization-on-imagenet-a | ConvFormer-B36 (IN-21K, 384) | Number of params: 100M Top-1 accuracy %: 73.5 |
| domain-generalization-on-imagenet-a | ConvFormer-B36 | Number of params: 100M Top-1 accuracy %: 40.1 |
| domain-generalization-on-imagenet-c | CAFormer-B36 (IN21K, 384) | Number of params: 99M mean Corruption Error (mCE): 30.8 |
| domain-generalization-on-imagenet-c | CAFormer-B36 (IN21K) | mean Corruption Error (mCE): 31.8 |
| domain-generalization-on-imagenet-c | ConvFormer-B36 | mean Corruption Error (mCE): 46.3 |
| domain-generalization-on-imagenet-c | CAFormer-B36 | mean Corruption Error (mCE): 42.6 |
| domain-generalization-on-imagenet-c | ConvFormer-B36 (IN21K) | mean Corruption Error (mCE): 35.0 |
| domain-generalization-on-imagenet-r | ConvFormer-B36 | Top-1 Error Rate: 48.9 |
| domain-generalization-on-imagenet-r | ConvFormer-B36 (384) | Top-1 Error Rate: 47.8 |
| domain-generalization-on-imagenet-r | ConvFormer-B36 (IN21K, 384) | Top-1 Error Rate: 33.5 |
| domain-generalization-on-imagenet-r | CAFormer-B36 | Top-1 Error Rate: 46.1 |
| domain-generalization-on-imagenet-r | CAFormer-B36 (384) | Top-1 Error Rate: 45 |
| domain-generalization-on-imagenet-r | CAFormer-B36 (IN21K) | Top-1 Error Rate: 31.7 |
| domain-generalization-on-imagenet-r | CAFormer-B36 (IN21K, 384) | Top-1 Error Rate: 29.6 |
| domain-generalization-on-imagenet-r | ConvFormer-B36 (IN21K) | Top-1 Error Rate: 34.7 |
| domain-generalization-on-imagenet-sketch | CAFormer-B36 (IN21K, 384) | Top-1 accuracy: 54.5 |
| domain-generalization-on-imagenet-sketch | ConvFormer-B36 (IN21K, 384) | Top-1 accuracy: 52.9 |
| domain-generalization-on-imagenet-sketch | CAFormer-B36 | Top-1 accuracy: 42.5 |
| domain-generalization-on-imagenet-sketch | ConvFormer-B36 | Top-1 accuracy: 39.5 |
| domain-generalization-on-imagenet-sketch | CAFormer-B36 (IN21K) | Top-1 accuracy: 52.8 |
| domain-generalization-on-imagenet-sketch | ConvFormer-B36 (IN21K) | Top-1 accuracy: 52.7 |
| image-classification-on-imagenet | ConvFormer-S36 (224 res, 21K) | GFLOPs: 7.6 Number of params: 40M Top 1 Accuracy: 85.4% |
| image-classification-on-imagenet | CAFormer-M36 (224 res) | GFLOPs: 13.2 Number of params: 56M Top 1 Accuracy: 85.2% |
| image-classification-on-imagenet | ConvFormer-S18 (384 res, 21K) | GFLOPs: 11.6 Number of params: 27M Top 1 Accuracy: 85.0% |
| image-classification-on-imagenet | ConvFormer-S36 (384 res, 21K) | GFLOPs: 22.4 Number of params: 40M Top 1 Accuracy: 86.4% |
| image-classification-on-imagenet | CAFormer-S36 (224 res) | GFLOPs: 8.0 Number of params: 39M Top 1 Accuracy: 84.5% |
| image-classification-on-imagenet | CAFormer-S36 (224 res, 21K) | GFLOPs: 8.0 Number of params: 39M Top 1 Accuracy: 85.8% |
| image-classification-on-imagenet | CAFormer-S18 (224 res) | GFLOPs: 4.1 Number of params: 26M Top 1 Accuracy: 83.6% |
| image-classification-on-imagenet | ConvFormer-B36 (384 res) | GFLOPs: 66.5 Number of params: 100M Top 1 Accuracy: 85.7% |
| image-classification-on-imagenet | ConvFormer-M36 (224 res) | GFLOPs: 12.8 Number of params: 57M Top 1 Accuracy: 84.5% |
| image-classification-on-imagenet | ConvFormer-S36 (224 res) | GFLOPs: 7.6 Number of params: 40M Top 1 Accuracy: 84.1% |
| image-classification-on-imagenet | ConvFormer-S18 (224 res) | GFLOPs: 3.9 Number of params: 27M Top 1 Accuracy: 83.0% |
| image-classification-on-imagenet | ConvFormer-B36 (384 res, 21K) | GFLOPs: 66.5 Number of params: 100M Top 1 Accuracy: 87.6% |
| image-classification-on-imagenet | ConvFormer-S18 (224 res, 21K) | GFLOPs: 3.9 Number of params: 27M Top 1 Accuracy: 83.7% |
| image-classification-on-imagenet | CAFormer-S18 (384 res) | GFLOPs: 13.4 Number of params: 26M Top 1 Accuracy: 85.0% |
| image-classification-on-imagenet | ConvFormer-M36 (224 res, 21K) | GFLOPs: 12.8 Number of params: 57M Top 1 Accuracy: 86.1% |
| image-classification-on-imagenet | CAFormer-S18 (384 res, 21K) | GFLOPs: 13.4 Number of params: 26M Top 1 Accuracy: 85.4% |
| image-classification-on-imagenet | CAFormer-B36 (384 res) | GFLOPs: 72.2 Number of params: 99M Top 1 Accuracy: 86.4% |
| image-classification-on-imagenet | CAFormer-M36 (224 res, 21K) | GFLOPs: 13.2 Number of params: 56M Top 1 Accuracy: 86.6% |
| image-classification-on-imagenet | ConvFormer-S36 (384 res) | GFLOPs: 22.4 Number of params: 40M Top 1 Accuracy: 85.4% |
| image-classification-on-imagenet | CAFormer-S36 (384 res, 21K) | GFLOPs: 26.0 Number of params: 39M Top 1 Accuracy: 86.9% |
| image-classification-on-imagenet | CAFormer-S18 (224 res, 21K) | GFLOPs: 4.1 Number of params: 26M Top 1 Accuracy: 84.1% |
| image-classification-on-imagenet | CAFormer-M36 (384 res, 21K) | GFLOPs: 42 Number of params: 56M Top 1 Accuracy: 87.5% |
| image-classification-on-imagenet | CAFormer-M36 (384 res) | GFLOPs: 42.0 Number of params: 56M Top 1 Accuracy: 86.2% |
| image-classification-on-imagenet | ConvFormer-B36 (224 res, 21K) | GFLOPs: 22.6 Number of params: 100M Top 1 Accuracy: 87.0% |
| image-classification-on-imagenet | ConvFormer-B36 (224 res) | GFLOPs: 22.6 Number of params: 100M Top 1 Accuracy: 84.8% |
| image-classification-on-imagenet | ConvFormer-M36 (384 res, 21K) | GFLOPs: 37.7 Number of params: 57M Top 1 Accuracy: 86.9% |
| image-classification-on-imagenet | ConvFormer-S18 (384 res) | GFLOPs: 11.6 Number of params: 27M Top 1 Accuracy: 84.4% |
| image-classification-on-imagenet | CAFormer-B36 (224 res) | GFLOPs: 23.2 Number of params: 99M Top 1 Accuracy: 85.5% |
| image-classification-on-imagenet | CAFormer-B36 (384 res, 21K) | GFLOPs: 72.2 Number of params: 99M Top 1 Accuracy: 88.1% |
| image-classification-on-imagenet | CAFormer-B36 (224 res, 21K) | GFLOPs: 23.2 Number of params: 99M Top 1 Accuracy: 87.4% |
| image-classification-on-imagenet | ConvFormer-M36 (384 res) | GFLOPs: 37.7 Number of params: 57M Top 1 Accuracy: 85.6% |
| image-classification-on-imagenet | CAFormer-S36 (384 res) | GFLOPs: 26.0 Number of params: 39M Top 1 Accuracy: 85.7% |
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.