{"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/global-filter-networks-for-image","title":"Global Filter Networks for Image Classification","arxiv_id":"2107.00645","date":"2021-07-01","proceeding":"NeurIPS 2021 12","authors":["Yongming Rao","Wenliang Zhao","Zheng Zhu","Jiwen Lu","Jie zhou"],"abstract":"Recent advances in self-attention and pure multi-layer perceptrons (MLP) models for vision have shown great potential in achieving promising performance with fewer inductive biases. These models are generally based on learning interaction among spatial locations from raw data. The complexity of self-attention and MLP grows quadratically as the image size increases, which makes these models hard to scale up when high-resolution features are required. In this paper, we present the Global Filter Network (GFNet), a conceptually simple yet computationally efficient architecture, that learns long-term spatial dependencies in the frequency domain with log-linear complexity. Our architecture replaces the self-attention layer in vision transformers with three key operations: a 2D discrete Fourier transform, an element-wise multiplication between frequency-domain features and learnable global filters, and a 2D inverse Fourier transform. We exhibit favorable accuracy/complexity trade-offs of our models on both ImageNet and downstream tasks. Our results demonstrate that GFNet can be a very competitive alternative to transformer-style models and CNNs in efficiency, generalization ability and robustness. Code is available at https://github.com/raoyongming/GFNet","url_abs":"https://arxiv.org/abs/2107.00645v2","url_pdf":"https://arxiv.org/pdf/2107.00645v2.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":"global-filter-networks-for-image","repo_url":"https://github.com/raoyongming/GFNet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"global-filter-networks-for-image","repo_url":"https://github.com/liuruiyang98/Jittor-MLP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null},{"paper_slug":"global-filter-networks-for-image","repo_url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/master/gfnet.py","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"global-filter-networks-for-image","repo_url":"https://github.com/mindspore-courses/External-Attention-MindSpore/blob/main/model/attention/gfnet.py","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"domain-generalization","task_name":"Domain Generalization"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/domain-generalization-on-imagenet-a","task":"Domain Generalization","dataset":"ImageNet-A","model":"GFNet-S","rank_in_archive_order":31,"of":39,"metrics":{"Top-1 accuracy %":"14.3"},"uses_additional_data":false},{"leaderboard":"/sota/domain-generalization-on-imagenet-c","task":"Domain Generalization","dataset":"ImageNet-C","model":"GFNet-S","rank_in_archive_order":30,"of":47,"metrics":{"mean Corruption Error (mCE)":"53.8"},"uses_additional_data":false},{"leaderboard":"/sota/image-classification-on-cifar-10","task":"Image Classification","dataset":"CIFAR-10","model":"GFNet-H-B","rank_in_archive_order":25,"of":265,"metrics":{"Percentage correct":"99.0"},"uses_additional_data":true},{"leaderboard":"/sota/image-classification-on-cifar-100","task":"Image Classification","dataset":"CIFAR-100","model":"GFNet-H-B","rank_in_archive_order":23,"of":211,"metrics":{"PARAMS":"54M","Percentage correct":"90.3"},"uses_additional_data":true},{"leaderboard":"/sota/image-classification-on-flowers-102","task":"Image Classification","dataset":"Flowers-102","model":"GFNet-H-B","rank_in_archive_order":20,"of":52,"metrics":{"Accuracy":"98.8","PARAMS":"54M"},"uses_additional_data":true},{"leaderboard":"/sota/image-classification-on-imagenet","task":"Image Classification","dataset":"ImageNet","model":"GFNet-H-B","rank_in_archive_order":488,"of":1060,"metrics":{"GFLOPs":"8.6","Number of params":"54M","Top 1 Accuracy":"82.9%"},"uses_additional_data":false},{"leaderboard":"/sota/image-classification-on-stanford-cars","task":"Image Classification","dataset":"Stanford Cars","model":"GFNet-H-B","rank_in_archive_order":11,"of":24,"metrics":{"Accuracy":"93.2"},"uses_additional_data":true}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2107.00645","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2107.00645"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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":"deterministic:regex_extraction","url":"https://github.com/raoyongming/GFNet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/master/gfnet.py","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mindspore-courses/External-Attention-MindSpore/blob/main/model/attention/gfnet.py","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/liuruiyang98/Jittor-MLP","reach":null}],"summary":{"ran":4,"ran_draft_wrong":2,"unverified":4},"by_repo_kind":{"official":{"samples":5,"ran":5,"repositories":1},"listed":{"samples":5,"ran":1,"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":5,"samples":[{"code_sha256_prefix":"dff7a9ab8c3f50a9","entry":"Block","repo":"raoyongming/GFNet","repo_kind":"official","path":"gfnet.py","file_url":"https://github.com/raoyongming/GFNet/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dff7a9ab8c3f50a9"}},{"code_sha256_prefix":"51372e4eff26857f","entry":"FFN","repo":"dslisleedh/MLP_based_models-tensorflow2","repo_kind":"listed","path":"gfnet.py","file_url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"51372e4eff26857f"}},{"code_sha256_prefix":"81d69a569925b1bd","entry":"GFNet","repo":"raoyongming/GFNet","repo_kind":"official","path":"gfnet.py","file_url":"https://github.com/raoyongming/GFNet/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"81d69a569925b1bd"}},{"code_sha256_prefix":"71e71e6d0819c701","entry":"GlobalFilter","repo":"raoyongming/GFNet","repo_kind":"official","path":"gfnet.py","file_url":"https://github.com/raoyongming/GFNet/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"71e71e6d0819c701"}},{"code_sha256_prefix":"32f151ed58e2d272","entry":"checkpoint_filter_fn","repo":"raoyongming/GFNet","repo_kind":"official","path":"gfnet.py","file_url":"https://github.com/raoyongming/GFNet/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"32f151ed58e2d272"}},{"code_sha256_prefix":"0b1994de5d8cd41f","entry":"resize_pos_embed","repo":"raoyongming/GFNet","repo_kind":"official","path":"gfnet.py","file_url":"https://github.com/raoyongming/GFNet/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","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":"0b1994de5d8cd41f"}},{"code_sha256_prefix":"61598b6c0f788e3c","entry":"Droppath","repo":"dslisleedh/MLP_based_models-tensorflow2","repo_kind":"listed","path":"gfnet.py","file_url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"61598b6c0f788e3c"}},{"code_sha256_prefix":"92b83ac006fb234c","entry":"GFBlock","repo":"dslisleedh/MLP_based_models-tensorflow2","repo_kind":"listed","path":"gfnet.py","file_url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"92b83ac006fb234c"}},{"code_sha256_prefix":"c28756e840db40ee","entry":"GFNet","repo":"dslisleedh/MLP_based_models-tensorflow2","repo_kind":"listed","path":"gfnet.py","file_url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c28756e840db40ee"}},{"code_sha256_prefix":"84d40e6af39d20fc","entry":"GlobalFilterLayer","repo":"dslisleedh/MLP_based_models-tensorflow2","repo_kind":"listed","path":"gfnet.py","file_url":"https://github.com/dslisleedh/MLP_based_models-tensorflow2/blob/HEAD/gfnet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"84d40e6af39d20fc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}