SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.03452 · 2022

Can CNNs Be More Robust Than Transformers?

arXiv · PDF · Open in the Atlas

Code that ran

10 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 5 have no contract verdict; 2 failures of our instrument; 5 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2206.03452.json · badge: /api/ran/2206.03452.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ucsc-vlaa/robustcnn canonical (classifier label)
classifier basis not recorded on the link
10 ran · 5 no recorded run
FunctionStatusWhere it lives
adapt_input_conv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ucsc-vlaa/robustcnn/timm/models/helpers.py
code served (permissive licence) · get_code("c58578dcfe39d5e3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# Test case 1: in_chans=1, I > 3 (divisible by 3)
in_chans_1 = 1
conv_weight_1 = torch.randn(2, 9, 4, 4)  # O=2, I=9, J=4, K=4

# Test case 2: in_chans=1, I <= 3
in_chans_2 = 1
conv_weight_2 = torch.randn(2, 3, 4, 4)  # O=2, I=3, J=4, K=4

# Test case 3: in_chans=5 (not 1, not 3), I=3
in_chans_3 = 5
conv_weight_3 = torch.randn(2, 3, 4, 4)  # O=2, I=3, J=4, K=4

# Using test case 1
ARGS = {
    "in_chans": 1,
    "conv_weight": torch.randn(2, 9, 4, 4, dtype=torch.float32)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
downsample_avg Ran
ran on a synthesized input
ucsc-vlaa/robustcnn/timm/models/robust_resnet.py
code served (permissive licence) · get_code("9f91aef11975b7e7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class AvgPool2dSame(nn.Module):
    def __init__(self, kernel_size, stride, ceil_mode=False, count_include_pad=False):
        super().__init__()
        self.kernel_size = kernel_size
        self.stride = stride
        self.ceil_mode = ceil_mode
        self.count_include_pad = count_include_pad
    
    def forward(self, x):
        return nn.functional.avg_pool2d(
            x, 
            kernel_size=self.kernel_size, 
            stride=self.stride,
            ceil_mode=self.ceil_mode,
            count_include_pad=self.count_include_pad
        )

ARGS = {
    'in_channels': 3,
    'out_channels': 64,
    'kernel_size': 3,
    'stride': 2,
    'dilation': 1,
    'first_dilation': None,
    'norm_layer': nn.BatchNorm2d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
downsample_conv Ran
ran on a synthesized input
ucsc-vlaa/robustcnn/timm/models/robust_resnet.py
code served (permissive licence) · get_code("ae25309d30fc2b83")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'in_channels': 3,
    'out_channels': 64,
    'kernel_size': 3,
    'stride': 2,
    'dilation': 1,
    'first_dilation': None,
    'norm_layer': nn.BatchNorm2d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_padding Ran
ran, honoured the contract we drafted
ucsc-vlaa/robustcnn/timm/models/robust_resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from xslidi/EfficientNets_ddl_apex, is pointer only (licence: NONE) · get_code("9b02c1068795fd5b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from xslidi/EfficientNets_ddl_apex, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

is_model Ran
ran, violated the contract we drafted
ucsc-vlaa/robustcnn/timm/models/registry.py
pointer only (licence: MIT); the stored copy get_code serves, from Yuzhe-Fu/FlashFPS, is pointer only (licence: NOASSERTION) · get_code("cd2a47ded9dd84cf")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Yuzhe-Fu/FlashFPS, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

list_models Ran
ran, honoured the contract we drafted
ucsc-vlaa/robustcnn/timm/models/registry.py
pointer only (licence: MIT); the stored copy get_code serves, from Yuzhe-Fu/FlashFPS, is pointer only (licence: NOASSERTION) · get_code("d14a6ca5ff9d530e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Yuzhe-Fu/FlashFPS, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_state_dict Ran
ran on a synthesized input
ucsc-vlaa/robustcnn/timm/models/helpers.py
code served (permissive licence) · get_code("a5729ac034a0df02")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned OrderedDict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import os
import tempfile
from collections import OrderedDict

torch.manual_seed(0)

# Create a temporary checkpoint file
temp_dir = tempfile.mkdtemp()
checkpoint_path = os.path.join(temp_dir, "checkpoint.pt")

# Create a sample state dict with small tensors
state_dict = OrderedDict()
state_dict['layer1.weight'] = torch.randn(2, 3)
state_dict['layer1.bias'] = torch.randn(2)
state_dict['layer2.weight'] = torch.randn(4, 2)

# Create checkpoint with different possible keys
checkpoint_full = {
    'state_dict': state_dict,
    'epoch': 1,
    'optimizer': {}
}

# Save the checkpoint
torch.save(checkpoint_full, checkpoint_path)

ARGS = {
    'checkpoint_path': checkpoint_path,
    'use_ema': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
register_model Ran
ran; our contract draft was wrong, not the code
ucsc-vlaa/robustcnn/timm/models/registry.py
pointer only (licence: MIT); the stored copy get_code serves, from Yuzhe-Fu/FlashFPS, is pointer only (licence: NOASSERTION) · get_code("e13039fb1c347452")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Yuzhe-Fu/FlashFPS, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

safe_model_name Ran
ran on a synthesized input
ucsc-vlaa/robustcnn/timm/models/factory.py
code served (permissive licence) · get_code("dcad83d71e6ab634")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

ARGS = {
    'model_name': 'timm:resnet50',
    'remove_source': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
split_model_name Ran
ran on a synthesized input
ucsc-vlaa/robustcnn/timm/models/factory.py
code served (permissive licence) · get_code("8b170a922ca9e2f3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def split_model_name(model_name):
    model_split = model_name.split(':', 1)
    if len(model_split) == 1:
        return ('', model_split[0])
    else:
        source_name, model_name = model_split
        assert source_name in ('timm', 'hf_hub')
        return (source_name, model_name)

# Test case 1: model_name without source prefix
ARGS = {
    'model_name': 'resnet50'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
create_model Not yet run
unverified (harvested, no recorded run)
ucsc-vlaa/robustcnn/timm/models/factory.py
code served (permissive licence) · get_code("983c6a8ed9b9f1e3")
How it ran

no invocation recorded.

download_cached_file Not yet run
unverified (harvested, no recorded run)
ucsc-vlaa/robustcnn/timm/models/hub.py
code served (permissive licence) · get_code("32933dcf801320f2")
How it ran

no invocation recorded.

get_cache_dir Not yet run
unverified (harvested, no recorded run)
ucsc-vlaa/robustcnn/timm/models/hub.py
code served (permissive licence) · get_code("da3ccccf419f89e7")
How it ran

no invocation recorded.

has_hf_hub Not yet run
unverified (harvested, no recorded run)
ucsc-vlaa/robustcnn/timm/models/hub.py
code served (permissive licence) · get_code("4169528fccdf4859")
How it ran

no invocation recorded.

resume_checkpoint Not yet run
unverified (harvested, no recorded run)
ucsc-vlaa/robustcnn/timm/models/helpers.py
pointer only (licence: MIT); the stored copy get_code serves, from Wenhao-Chi/UNIEGO, is pointer only (licence: NOASSERTION) · get_code("102b75f3481035d1")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Wenhao-Chi/UNIEGO, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 6 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
is_model 22 other papers
10 dated earlier, 12 later
1409.4842 (2014-09)
Going deeper with convolutions
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
1608.06993 (2016-08)
Densely Connected Convolutional Networks
and 19 more not named here
list_models 12 other papers
2 dated earlier, 10 later
2105.01601 (2021-05)
MLP-Mixer: An all-MLP Architecture for Vision
2205.10528 (2022-05)
PointVector: A Vector Representation In Point Cloud Analysis
and 9 more not named here
register_model 11 other papers
2 dated earlier, 9 later
2105.01601 (2021-05)
MLP-Mixer: An all-MLP Architecture for Vision
2205.10528 (2022-05)
PointVector: A Vector Representation In Point Cloud Analysis
and 8 more not named here
get_padding 10 other papers
4 dated earlier, 6 later
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
2110.07641 (2021-10)
Non-deep Networks
2203.12827 (2022-03)
Sparse Instance Activation for Real-Time Instance Segmentation
and 7 more not named here
adapt_input_conv 6 other papers
3 dated earlier, 3 later
2110.05069 (2021-10)
Efficient Training of Audio Transformers with Patchout
2110.07641 (2021-10)
Non-deep Networks
2204.07683 (2022-04)
Safe Self-Refinement for Transformer-based Domain Adaptation
and 3 more not named here
resume_checkpoint 6 other papers
2 dated earlier, 4 later
2110.07641 (2021-10)
Non-deep Networks
2203.10233 (2022-03)
DirecFormer: A Directed Attention in Transformer Approach to Robust Action Recognition
2210.04135 (2022-10)
VoLTA: Vision-Language Transformer with Weakly-Supervised Local-Feature Alignment
and 3 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The recent success of Vision Transformers is shaking the long dominance of Convolutional Neural Networks (CNNs) in image recognition for a decade. Specifically, in terms of robustness on out-of-distribution samples, recent research finds that Transformers are inherently more robust than CNNs, regardless of different training setups. Moreover, it is believed that such superiority of Transformers should largely be credited to their self-attention-like architectures per se. In this paper, we question that belief by closely examining the design of Transformers. Our findings lead to three highly effective architecture designs for boosting robustness, yet simple enough to be implemented in several lines of code, namely a) patchifying input images, b) enlarging kernel size, and c) reducing activation layers and normalization layers. Bringing these components together, we are able to build pure CNN architectures without any attention-like operations that are as robust as, or even more robust than, Transformers. We hope this work can help the community better understand the design of robust neural architectures. The code is publicly available at https://github.com/UCSC-VLAA/RobustCNN.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2206.03452")
get_code_for_paper("2206.03452")
have("2206.03452")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2206.03452.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2206.03452.svg)](https://syntology.ai/paper/2206.03452)

Connect an agent — have() is free.