{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/metaformer-is-actually-what-you-need-for","title":"MetaFormer Is Actually What You Need for Vision","arxiv_id":"2111.11418","date":"2021-11-22","proceeding":"CVPR 2022 1","authors":["Weihao Yu","Mi Luo","Pan Zhou","Chenyang Si","Yichen Zhou","Xinchao Wang","Jiashi Feng","Shuicheng Yan"],"abstract":"Transformers have shown great potential in computer vision tasks. A common belief is their attention-based token mixer module contributes most to their competence. However, recent works show the attention-based module in Transformers can be replaced by spatial MLPs and the resulted models still perform quite well. Based on this observation, we hypothesize that the general architecture of the Transformers, instead of the specific token mixer module, is more essential to the model's performance. To verify this, we deliberately replace the attention module in Transformers with an embarrassingly simple spatial pooling operator to conduct only basic token mixing. Surprisingly, we observe that the derived model, termed as PoolFormer, achieves competitive performance on multiple computer vision tasks. For example, on ImageNet-1K, PoolFormer achieves 82.1% top-1 accuracy, surpassing well-tuned Vision Transformer/MLP-like baselines DeiT-B/ResMLP-B24 by 0.3%/1.1% accuracy with 35%/52% fewer parameters and 50%/62% fewer MACs. The effectiveness of PoolFormer verifies our hypothesis and urges us to initiate the concept of \"MetaFormer\", a general architecture abstracted from Transformers without specifying the token mixer. Based on the extensive experiments, we argue that MetaFormer is the key player in achieving superior results for recent Transformer and MLP-like models on vision tasks. This work calls for more future research dedicated to improving MetaFormer instead of focusing on the token mixer modules. Additionally, our proposed PoolFormer could serve as a starting baseline for future MetaFormer architecture design. Code is available at https://github.com/sail-sg/poolformer.","url_abs":"https://arxiv.org/abs/2111.11418v3","url_pdf":"https://arxiv.org/pdf/2111.11418v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/rwightman/pytorch-image-models","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/sail-sg/poolformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/DarshanDeshpande/jax-models","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/IMvision12/keras-vision-models","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/Westlake-AI/openmixup","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/facebookresearch/xformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/huggingface/transformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/martinsbruveris/tensorflow-image-models","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/sithu31296/image-classification","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/sithu31296/semantic-segmentation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/BR-IDL/PaddleViT/tree/develop/image_classification","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/MS-Mind/MS-Code-02/tree/main/configs/poolformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/Mind23-2/MindCode-108","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":{"status":"ok"}},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/MindCode-4/code-2/tree/main/poolformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/MindCode-4/code-4/tree/main/poolformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/dslisleedh/MetaFormer-flax","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok"}},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/shinya7y/UniverseNet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"metaformer-is-actually-what-you-need-for","repo_url":"https://github.com/yangyucheng000/University/tree/main/model-1/poolformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null}],"tasks":[{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"object-detection","task_name":"Object Detection"},{"task_slug":"recommendation-systems","task_name":"Recommendation Systems"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"metaformer","method_name":"MetaFormer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"poolformer","method_name":"PoolFormer"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[{"slug":"metaformer","name":"MetaFormer","full_name":"MetaFormer"},{"slug":"poolformer","name":"PoolFormer","full_name":"PoolFormer"}],"results":[{"leaderboard":"/sota/image-classification-on-imagenet","task":"Image Classification","dataset":"ImageNet","model":"MetaFormer PoolFormer-M48","rank_in_archive_order":533,"of":1060,"metrics":{"GFLOPs":"23.2","Number of params":"73M","Top 1 Accuracy":"82.5%"},"uses_additional_data":false},{"leaderboard":"/sota/object-detection-on-coco-minival","task":"Object Detection","dataset":"COCO minival","model":"PoolFormer-S36 (Mask R-CNN)","rank_in_archive_order":169,"of":220,"metrics":{"AP50":"63.1","AP75":"44.8","box AP":"41.0"},"uses_additional_data":false},{"leaderboard":"/sota/semantic-segmentation-on-ade20k","task":"Semantic Segmentation","dataset":"ADE20K","model":"PoolFormer-M48","rank_in_archive_order":214,"of":235,"metrics":{"Validation mIoU":"42.7"},"uses_additional_data":false},{"leaderboard":"/sota/semantic-segmentation-on-densepass","task":"Semantic Segmentation","dataset":"DensePASS","model":"PoolFormer (MiT-B1)","rank_in_archive_order":9,"of":36,"metrics":{"mIoU":"43.18%"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2111.11418","atlas_url":"https://app.syntology.ai/?focus=2111.11418","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2111.11418"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/rwightman/pytorch-image-models","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/huggingface/transformers","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Westlake-AI/openmixup","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MS-Mind/MS-Code-02/tree/main/configs/poolformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MindCode-4/code-2/tree/main/poolformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dslisleedh/MetaFormer-flax","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Mind23-2/MindCode-108","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/martinsbruveris/tensorflow-image-models","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/IMvision12/keras-vision-models","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MindCode-4/code-4/tree/main/poolformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/DarshanDeshpande/jax-models","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sail-sg/poolformer","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sithu31296/image-classification","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sithu31296/semantic-segmentation","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yangyucheng000/University/tree/main/model-1/poolformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/BR-IDL/PaddleViT/tree/develop/image_classification","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/xformers","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/shinya7y/UniverseNet","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_fixture":1,"ran_draft_wrong":1,"unverified":1},"by_repo_kind":{"listed":{"samples":3,"ran":2,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"02566da69866c48c","entry":"trunc_normal_","repo":"sithu31296/image-classification","repo_kind":"listed","path":"models/layers.py","file_url":"https://github.com/sithu31296/image-classification/blob/HEAD/models/layers.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"02566da69866c48c"}},{"code_sha256_prefix":"7b0d02f75bf6b439","entry":"window_reverse","repo":"sithu31296/image-classification","repo_kind":"listed","path":"models/davit.py","file_url":"https://github.com/sithu31296/image-classification/blob/HEAD/models/davit.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7b0d02f75bf6b439"}},{"code_sha256_prefix":"28e360c0b2fc5290","entry":"window_partition","repo":"sithu31296/image-classification","repo_kind":"listed","path":"models/davit.py","file_url":"https://github.com/sithu31296/image-classification/blob/HEAD/models/davit.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"28e360c0b2fc5290"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}