SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.04871 · 2022

Spurious Features Everywhere -- Large-Scale Detection of Harmful Spurious Features in ImageNet

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2212.04871.json · badge: /api/ran/2212.04871.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
yanneu/spurious_imagenet canonical (classifier label)
classifier basis not recorded on the link
8 ran · 1 no recorded run
FunctionStatusWhere it lives
Cifar100Wrapper Ran
ran; our contract draft was wrong, not the code
yanneu/spurious_imagenet/utils/model_normalization.py
code served (permissive licence) · get_code("5ee354f617a22064")
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 NormalizationWrapper. 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)

# Create a minimal model that accepts normalized input and returns output
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 2)
    
    def forward(self, x, *args, **kwargs):
        # x shape: (batch, 3, height, width)
        # Flatten spatial dimensions
        batch_size = x.shape[0]
        x_flat = x.view(batch_size, -1)
        return self.linear(x_flat)

model = SimpleModel()

ARGS = {
    'model': model
}
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 NormalizationWrapper — a NormalizationWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NormalizationWrapper 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
Cifar10Wrapper Ran
ran; our contract draft was wrong, not the code
yanneu/spurious_imagenet/utils/model_normalization.py
code served (permissive licence) · get_code("5d6dab57416051a2")
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 NormalizationWrapper. 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)

# Create a minimal model that satisfies how NormalizationWrapper uses it
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 4)
    
    def forward(self, x, *args, **kwargs):
        # x will be normalized input with shape (batch, channels, height, width)
        # Flatten and pass through linear layer
        batch_size = x.shape[0]
        x_flat = x.view(batch_size, -1)
        return self.linear(x_flat)

# Create a simple model instance
model = SimpleModel()

# ARGS maps the parameter 'model' to the model instance
ARGS = {
    'model': model
}
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 NormalizationWrapper — a NormalizationWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NormalizationWrapper 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
IdentityWrapper Ran
ran on a synthesized input
yanneu/spurious_imagenet/utils/model_normalization.py
code served (permissive licence) · get_code("5e4bc4339ac07e03")
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 NormalizationWrapper. 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)

# Create a minimal model that satisfies how IdentityWrapper uses it
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 5)
    
    def forward(self, x, *args, **kwargs):
        return self.linear(x)

# Instantiate the model
model = SimpleModel()

# Define ARGS with all parameters for IdentityWrapper
ARGS = {
    'model': model
}
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 NormalizationWrapper — a NormalizationWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NormalizationWrapper 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
get_devices Ran
ran on a synthesized input
yanneu/spurious_imagenet/dataset/evaluate_all_models.py
code served (permissive licence) · get_code("1c77b1953d1d020f")
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

torch.manual_seed(0)

# The function get_devices takes a single parameter 'gpus' which is a list/sequence
# It checks the length of gpus and processes it accordingly
# No actual GPU operations happen, just device object construction

ARGS = {
    'gpus': []
}
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
get_filename Ran
ran on a synthesized input
yanneu/spurious_imagenet/utils/load_trained_model.py
code served (permissive licence) · get_code("7d476c2ca8c4113d")
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

# Define ARGS dict with valid arguments for get_filename
ARGS = {
    'folder': 'model_data',
    'architecture_folder': 'models',
    'checkpoint': 'best_model',
    'load_temp': 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 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
get_imageNet_augmentation Ran
ran on a synthesized input
yanneu/spurious_imagenet/utils/datasets/augmentations/imagenet_augmentation.py
code served (permissive licence) · get_code("6beb22623078f3ab")
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 Compose. 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
from torchvision import transforms
from torchvision.transforms.functional import InterpolationMode

torch.manual_seed(0)

# Construct arguments for get_imageNet_augmentation
type_arg = 'default'
out_size_arg = 224
interpolation_arg = InterpolationMode.BICUBIC
config_dict_arg = {}

ARGS = {
    'type': type_arg,
    'out_size': out_size_arg,
    'interpolation': interpolation_arg,
    'config_dict': config_dict_arg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose 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
get_last_layer Ran
ran on a synthesized input
yanneu/spurious_imagenet/utils/get_last_layer.py
code served (permissive licence) · get_code("42944c69bbfd2e3e")
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 Linear. 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)

# Build a minimal model structure for 'resnet50'
class MinimalResNet50(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = nn.Module()
        self.model.fc = nn.Linear(2048, 1000)
        self.model.layer4 = nn.ModuleList([nn.Sequential(nn.Conv2d(2048, 2048, 3))])

# Build a minimal model structure for 'tf_efficientnet'
class MinimalEfficientNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = nn.Module()
        self.model.classifier = nn.Linear(1280, 1000)
        self.model.conv_head = nn.Conv2d(1280, 1280, 1)

# Build a minimal model structure for 'convnext'
class MinimalConvNext(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = nn.Module()
        self.model.head = nn.Module()
        self.model.head.fc = nn.Linear(768, 1000)
        self.model.stages = nn.ModuleList([
            nn.Module(),
            nn.Module(),
            nn.Module(),
            nn.Module()
        ])
        self.model.stages[3].blocks = nn.ModuleList([
            nn.Module(),
            nn.Module(),
            nn.Module()
        ])
        self.model.stages[3].blocks[2].conv_dw = nn.Conv2d(768, 768, 3)

# Build a minimal model structure for 'vit'
class MinimalViT(nn.Module):
    def __init__(self):
        super().__init__()
        self.model = nn.Module()
        self.model.head = nn.Linear(768, 1000)

# Use resnet50 as the base model
model = MinimalResNet50()
model_id = 'resnet50'

ARGS = {
    'model_id': model_id,
    'model': model,
    'multi_gpu': False,
    'return_gradcam': 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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
get_probabilities_targets Ran
ran on a synthesized input
yanneu/spurious_imagenet/dataset/spurious_score.py
code served (permissive licence) · get_code("dc454284a7278a38")
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. 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)

# Define a simple model that takes input and produces logits
class SimpleModel(nn.Module):
    def __init__(self, input_dim, num_classes):
        super().__init__()
        self.linear = nn.Linear(input_dim, num_classes)
    
    def forward(self, x):
        return self.linear(x)

# Create model
model = SimpleModel(input_dim=4, num_classes=3)
model.eval()

# Create a simple dataset as list of (data, target) tuples
# Batch size 2, input dim 4, 2 batches total
data_batch_1 = torch.randn(2, 4)
target_batch_1 = torch.tensor([0, 1], dtype=torch.long)

data_batch_2 = torch.randn(2, 4)
target_batch_2 = torch.tensor([2, 0], dtype=torch.long)

loader = [
    (data_batch_1, target_batch_1),
    (data_batch_2, target_batch_2),
]

# Add dataset attribute to loader so len(loader.dataset) works
class DatasetWrapper:
    def __init__(self, data_list):
        self.data = data_list
    
    def __len__(self):
        return sum(len(batch[0]) for batch in self.data)

loader_with_dataset = loader
loader_with_dataset_obj = type('Loader', (), {})()
loader_with_dataset_obj.dataset = DatasetWrapper(loader)

# Use a proper wrapper
class SimpleLoader:
    def __init__(self, batches):
        self.batches = batches
        self.dataset = type('Dataset', (), {'__len__': lambda self: sum(len(b[0]) for b in batches)})()
    
    def __iter__(self):
        return iter(self.batches)

loader = SimpleLoader([
    (data_batch_1, target_batch_1),
    (data_batch_2, target_batch_2),
])

device = 'cpu'

ARGS = {
    'loader': loader,
    'model': model,
    'device': device,
}
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 — a tuple output has no array shape of its own; none is 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_spurious_datasets_crop_resize Not yet run
unverified (harvested, no recorded run)
yanneu/spurious_imagenet/dataset/spurious_dataset.py
code served (permissive licence) · get_code("5c7055620a1580fd")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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
Cifar100Wrapper 1 other paper
1 dated earlier
2205.07972 (2022-05)
Sparse Visual Counterfactual Explanations in Image Space
Cifar10Wrapper 1 other paper
1 dated earlier
2205.07972 (2022-05)
Sparse Visual Counterfactual Explanations in Image Space
get_filename 1 other paper
1 dated earlier
2205.07972 (2022-05)
Sparse Visual Counterfactual Explanations in Image Space

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-22.

Repositories linked to this paper

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

Abstract

Benchmark performance of deep learning classifiers alone is not a reliable predictor for the performance of a deployed model. In particular, if the image classifier has picked up spurious features in the training data, its predictions can fail in unexpected ways. In this paper, we develop a framework that allows us to systematically identify spurious features in large datasets like ImageNet. It is based on our neural PCA components and their visualization. Previous work on spurious features often operates in toy settings or requires costly pixel-wise annotations. In contrast, we work with ImageNet and validate our results by showing that presence of the harmful spurious feature of a class alone is sufficient to trigger the prediction of that class. We introduce the novel dataset "Spurious ImageNet" which allows to measure the reliance of any ImageNet classifier on harmful spurious features. Moreover, we introduce SpuFix as a simple mitigation method to reduce the dependence of any ImageNet classifier on previously identified harmful spurious features without requiring additional labels or retraining of the model. We provide code and data at https://github.com/YanNeu/spurious_imagenet .

For agents

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

get_harvested_code_for_paper("2212.04871")
get_code_for_paper("2212.04871")
have("2212.04871")

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

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

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

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

Connect an agent — have() is free.