{"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/scaling-local-self-attention-for-parameter","title":"Scaling Local Self-Attention for Parameter Efficient Visual Backbones","arxiv_id":"2103.12731","date":"2021-03-23","proceeding":"CVPR 2021 1","authors":["Ashish Vaswani","Prajit Ramachandran","Aravind Srinivas","Niki Parmar","Blake Hechtman","Jonathon Shlens"],"abstract":"Self-attention has the promise of improving computer vision systems due to parameter-independent scaling of receptive fields and content-dependent interactions, in contrast to parameter-dependent scaling and content-independent interactions of convolutions. Self-attention models have recently been shown to have encouraging improvements on accuracy-parameter trade-offs compared to baseline convolutional models such as ResNet-50. In this work, we aim to develop self-attention models that can outperform not just the canonical baseline models, but even the high-performing convolutional models. We propose two extensions to self-attention that, in conjunction with a more efficient implementation of self-attention, improve the speed, memory usage, and accuracy of these models. We leverage these improvements to develop a new self-attention model family, HaloNets, which reach state-of-the-art accuracies on the parameter-limited setting of the ImageNet classification benchmark. In preliminary transfer learning experiments, we find that HaloNet models outperform much larger models and have better inference performance. On harder tasks such as object detection and instance segmentation, our simple local self-attention and convolutional hybrids show improvements over very strong baselines. These results mark another step in demonstrating the efficacy of self-attention models on settings traditionally dominated by convolutional models.","url_abs":"https://arxiv.org/abs/2103.12731v3","url_pdf":"https://arxiv.org/pdf/2103.12731v3.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":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/kevin-ssy/ViP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/lucidrains/halonet-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/rwightman/pytorch-image-models","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/BR-IDL/PaddleViT/tree/develop/image_classification/HaloNet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":null},{"paper_slug":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/leondgarse/keras_cv_attention_models/tree/main/keras_cv_attention_models/halonet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/qwopqwop200/halonet-tf2","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"scaling-local-self-attention-for-parameter","repo_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/master/attention/HaloAttention.py","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"instance-segmentation","task_name":"Instance Segmentation"},{"task_slug":"object-detection","task_name":"Object Detection"},{"task_slug":"semantic-segmentation","task_name":"Semantic Segmentation"},{"task_slug":"transfer-learning","task_name":"Transfer Learning"},{"task_slug":"object-detection-1","task_name":"object-detection"}],"methods":[{"method_slug":"halonet","method_name":"HaloNet"}],"datasets_introduced":[],"methods_introduced":[{"slug":"halonet","name":"HaloNet","full_name":"HaloNet"}],"results":[{"leaderboard":"/sota/image-classification-on-imagenet","task":"Image Classification","dataset":"ImageNet","model":"HaloNet4 (base 128, Conv-12)","rank_in_archive_order":223,"of":1060,"metrics":{"Number of params":"87M","Top 1 Accuracy":"85.5%"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2103.12731","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2103.12731"}},"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":"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/kevin-ssy/ViP","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/qwopqwop200/halonet-tf2","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/halonet-pytorch","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/leondgarse/keras_cv_attention_models/tree/main/keras_cv_attention_models/halonet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/master/attention/HaloAttention.py","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/BR-IDL/PaddleViT/tree/develop/image_classification/HaloNet","reach":null}],"summary":{"ran":4,"ran_draft_wrong":2,"ran_fixture":5,"ran_honours":1,"unverified":8},"by_repo_kind":{"listed":{"samples":20,"ran":12,"repositories":4}},"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":"2e1c36d6346e85e2","entry":"HaloAttention","repo":"xmu-xiaoma666/External-Attention-pytorch","repo_kind":"listed","path":"model/attention/HaloAttention.py","file_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/HEAD/model/attention/HaloAttention.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":"2e1c36d6346e85e2"}},{"code_sha256_prefix":"e672b9aa56a1370e","entry":"HaloAttention","repo":"qwopqwop200/halonet-tf2","repo_kind":"listed","path":"halonet.py","file_url":"https://github.com/qwopqwop200/halonet-tf2/blob/HEAD/halonet.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":"e672b9aa56a1370e"}},{"code_sha256_prefix":"84902fc5aa98fdd2","entry":"RelPosEmb","repo":"xmu-xiaoma666/External-Attention-pytorch","repo_kind":"listed","path":"model/attention/HaloAttention.py","file_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/HEAD/model/attention/HaloAttention.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":"84902fc5aa98fdd2"}},{"code_sha256_prefix":"f84f90d761d35986","entry":"RelPosEmb","repo":"qwopqwop200/halonet-tf2","repo_kind":"listed","path":"halonet.py","file_url":"https://github.com/qwopqwop200/halonet-tf2/blob/HEAD/halonet.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":"f84f90d761d35986"}},{"code_sha256_prefix":"042da966a79899bf","entry":"expand_dim","repo":"xmu-xiaoma666/External-Attention-pytorch","repo_kind":"listed","path":"model/attention/HaloAttention.py","file_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/HEAD/model/attention/HaloAttention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"042da966a79899bf"}},{"code_sha256_prefix":"c408fb0e411bf284","entry":"expand_dim","repo":"qwopqwop200/halonet-tf2","repo_kind":"listed","path":"halonet.py","file_url":"https://github.com/qwopqwop200/halonet-tf2/blob/HEAD/halonet.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c408fb0e411bf284"}},{"code_sha256_prefix":"3e27684df29ad41d","entry":"pair","repo":"lucidrains/halonet-pytorch","repo_kind":"listed","path":"halonet_pytorch/halonet_pytorch.py","file_url":"https://github.com/lucidrains/halonet-pytorch/blob/HEAD/halonet_pytorch/halonet_pytorch.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3e27684df29ad41d"}},{"code_sha256_prefix":"1e87e34e9818520d","entry":"rel_to_abs","repo":"xmu-xiaoma666/External-Attention-pytorch","repo_kind":"listed","path":"model/attention/HaloAttention.py","file_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/HEAD/model/attention/HaloAttention.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1e87e34e9818520d"}},{"code_sha256_prefix":"de5b53fe2be91d13","entry":"rel_to_abs","repo":"qwopqwop200/halonet-tf2","repo_kind":"listed","path":"halonet.py","file_url":"https://github.com/qwopqwop200/halonet-tf2/blob/HEAD/halonet.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"de5b53fe2be91d13"}},{"code_sha256_prefix":"f0386252d04dce23","entry":"relative_logits_1d","repo":"xmu-xiaoma666/External-Attention-pytorch","repo_kind":"listed","path":"model/attention/HaloAttention.py","file_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/HEAD/model/attention/HaloAttention.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f0386252d04dce23"}},{"code_sha256_prefix":"d72140427ae8af3b","entry":"relative_logits_1d","repo":"qwopqwop200/halonet-tf2","repo_kind":"listed","path":"halonet.py","file_url":"https://github.com/qwopqwop200/halonet-tf2/blob/HEAD/halonet.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d72140427ae8af3b"}},{"code_sha256_prefix":"0bb26a83df4e7b0b","entry":"to","repo":"xmu-xiaoma666/External-Attention-pytorch","repo_kind":"listed","path":"model/attention/HaloAttention.py","file_url":"https://github.com/xmu-xiaoma666/External-Attention-pytorch/blob/HEAD/model/attention/HaloAttention.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0bb26a83df4e7b0b"}},{"code_sha256_prefix":"27b31e965ef896f1","entry":"addmm_flop_jit","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/flop_count/jit_handles.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/flop_count/jit_handles.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":"27b31e965ef896f1"}},{"code_sha256_prefix":"24b72f9389954e2e","entry":"apply_pos","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"models/vip_layers.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/models/vip_layers.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":"24b72f9389954e2e"}},{"code_sha256_prefix":"1cf1c5e0f9a581ba","entry":"create_loader","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/loader.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/loader.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":"1cf1c5e0f9a581ba"}},{"code_sha256_prefix":"b2ada9fb7de2d355","entry":"dist_init","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/distributed_utils.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/distributed_utils.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":"b2ada9fb7de2d355"}},{"code_sha256_prefix":"29724655612e3ef9","entry":"generic_activation_jit","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/flop_count/jit_handles.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/flop_count/jit_handles.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":"29724655612e3ef9"}},{"code_sha256_prefix":"653ac611901cfc1c","entry":"get_shape","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/flop_count/jit_handles.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/flop_count/jit_handles.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":"653ac611901cfc1c"}},{"code_sha256_prefix":"5d8cf2436bdfc77b","entry":"init_device","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/distributed_utils.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/distributed_utils.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":"5d8cf2436bdfc77b"}},{"code_sha256_prefix":"a512212dfdd82da0","entry":"load_ext","repo":"kevin-ssy/ViP","repo_kind":"listed","path":"utils/ext_loader.py","file_url":"https://github.com/kevin-ssy/ViP/blob/HEAD/utils/ext_loader.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":"a512212dfdd82da0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}