{"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-up-your-kernels-to-31x31-revisiting","title":"Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs","arxiv_id":"2203.06717","date":"2022-03-13","proceeding":"CVPR 2022 1","authors":["Xiaohan Ding","Xiangyu Zhang","Yizhuang Zhou","Jungong Han","Guiguang Ding","Jian Sun"],"abstract":"We revisit large kernel design in modern convolutional neural networks (CNNs). Inspired by recent advances in vision transformers (ViTs), in this paper, we demonstrate that using a few large convolutional kernels instead of a stack of small kernels could be a more powerful paradigm. We suggested five guidelines, e.g., applying re-parameterized large depth-wise convolutions, to design efficient high-performance large-kernel CNNs. Following the guidelines, we propose RepLKNet, a pure CNN architecture whose kernel size is as large as 31x31, in contrast to commonly used 3x3. RepLKNet greatly closes the performance gap between CNNs and ViTs, e.g., achieving comparable or superior results than Swin Transformer on ImageNet and a few typical downstream tasks, with lower latency. RepLKNet also shows nice scalability to big data and large models, obtaining 87.8% top-1 accuracy on ImageNet and 56.0% mIoU on ADE20K, which is very competitive among the state-of-the-arts with similar model sizes. Our study further reveals that, in contrast to small-kernel CNNs, large-kernel CNNs have much larger effective receptive fields and higher shape bias rather than texture bias. Code & models at https://github.com/megvii-research/RepLKNet.","url_abs":"https://arxiv.org/abs/2203.06717v4","url_pdf":"https://arxiv.org/pdf/2203.06717v4.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-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/DingXiaoH/RepLKNet-pytorch","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/megvii-research/replknet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/edwardchasel/spatial-mamba","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/mit-han-lab/litepose","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/2024-MindSpore-1/Code3/tree/main/replknet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/BR-IDL/PaddleViT/tree/develop/image_classification/RepLKNet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":null},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/shkarupa-alex/tfreplknet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"scaling-up-your-kernels-to-31x31-revisiting","repo_url":"https://github.com/towhee-io/towhee","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"image-classification","task_name":"Image Classification"}],"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":"large-kernel-size","method_name":"Large Kernel Size"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"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":"stochastic-depth","method_name":"Stochastic Depth"},{"method_slug":"swin-transformer","method_name":"Swin Transformer"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-classification-on-imagenet","task":"Image Classification","dataset":"ImageNet","model":"RepLKNet-XL","rank_in_archive_order":71,"of":1060,"metrics":{"GFLOPs":"128.7","Number of params":"335M","Top 1 Accuracy":"87.8%"},"uses_additional_data":false}],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2203.06717","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.06717"}},"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/megvii-research/replknet","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/edwardchasel/spatial-mamba","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mit-han-lab/litepose","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/shkarupa-alex/tfreplknet","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/DingXiaoH/RepLKNet-pytorch","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/BR-IDL/PaddleViT/tree/develop/image_classification/RepLKNet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/2024-MindSpore-1/Code3/tree/main/replknet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/towhee-io/towhee","reach":null}],"summary":{"ran":1,"ran_fixture":1,"unverified":6},"by_repo_kind":{"official":{"samples":4,"ran":2,"repositories":2},"listed":{"samples":4,"ran":0,"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":"b4613da968a83fc8","entry":"get_bn","repo":"DingXiaoH/RepLKNet-pytorch","repo_kind":"official","path":"replknet.py","file_url":"https://github.com/DingXiaoH/RepLKNet-pytorch/blob/HEAD/replknet.py","link_basis":"harvester_set","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":"b4613da968a83fc8"}},{"code_sha256_prefix":"31a9326964e3158c","entry":"get_conv2d","repo":"DingXiaoH/RepLKNet-pytorch","repo_kind":"official","path":"replknet.py","file_url":"https://github.com/DingXiaoH/RepLKNet-pytorch/blob/HEAD/replknet.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"31a9326964e3158c"}},{"code_sha256_prefix":"dbf2077cabf601ed","entry":"benchmark_torch","repo":"megvii-research/replknet","repo_kind":"official","path":"main_benchmark.py","file_url":"https://github.com/megvii-research/replknet/blob/HEAD/main_benchmark.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dbf2077cabf601ed"}},{"code_sha256_prefix":"16475b9bcc0dad35","entry":"conv_bn","repo":"DingXiaoH/RepLKNet-pytorch","repo_kind":"official","path":"replknet.py","file_url":"https://github.com/DingXiaoH/RepLKNet-pytorch/blob/HEAD/replknet.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":"16475b9bcc0dad35"}},{"code_sha256_prefix":"16c6217306c29734","entry":"convert_name","repo":"shkarupa-alex/tfreplknet","repo_kind":"listed","path":"convert_weights.py","file_url":"https://github.com/shkarupa-alex/tfreplknet/blob/HEAD/convert_weights.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":"16c6217306c29734"}},{"code_sha256_prefix":"37dddb08e5c51831","entry":"convert_weight","repo":"shkarupa-alex/tfreplknet","repo_kind":"listed","path":"convert_weights.py","file_url":"https://github.com/shkarupa-alex/tfreplknet/blob/HEAD/convert_weights.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":"37dddb08e5c51831"}},{"code_sha256_prefix":"d8971d3d6d5dede6","entry":"preprocess_input_bl","repo":"shkarupa-alex/tfreplknet","repo_kind":"listed","path":"tfreplknet/prep.py","file_url":"https://github.com/shkarupa-alex/tfreplknet/blob/HEAD/tfreplknet/prep.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":"d8971d3d6d5dede6"}},{"code_sha256_prefix":"253d978d04cd92c2","entry":"preprocess_input_xl","repo":"shkarupa-alex/tfreplknet","repo_kind":"listed","path":"tfreplknet/prep.py","file_url":"https://github.com/shkarupa-alex/tfreplknet/blob/HEAD/tfreplknet/prep.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":"253d978d04cd92c2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}