SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2202.09844 · 2022

Sparsity Winning Twice: Better Robust Generalization from More Efficient Training

arXiv · PDF · Open in the Atlas

Code that ran

4 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 2 have no contract verdict; 2 failures of our instrument; 5 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/2202.09844.json · badge: /api/ran/2202.09844.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
vita-group/sparsity-win-robust-generalization canonical (classifier label)
classifier basis not recorded on the link
4 ran · 5 no recorded run
FunctionStatusWhere it lives
clamp Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vita-group/sparsity-win-robust-generalization/Robust-Bird/utils/function.py
code served (permissive licence) · get_code("0beec913c324c82a")
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 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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

torch.manual_seed(0)

# Create a small tensor with shape (2, 4)
X = torch.randn(2, 4)

# Define lower and upper bounds as floats
l = -1.0
u = 1.0

# Set cuda to False since we're CPU-only
cuda = False

ARGS = {
    "X": X,
    "l": l,
    "u": u,
    "cuda": cuda
}
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 2, dtype family float, shape (2, 4) — shape (2, 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
vita-group/sparsity-win-robust-generalization/Robust-Bird/models/resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from lixiaotong97/DSU, is pointer only (licence: NONE) · get_code("fac5364e2f53c6db")
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 lixiaotong97/DSU, 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.

reshape_transform Ran
ran on a synthesized input
vita-group/sparsity-win-robust-generalization/grad_carm.py
code served (permissive licence) · get_code("c10449a1b159ff70")
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, 5, 4, 3) 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

torch.manual_seed(0)

# The function takes a tensor and performs two transpose operations
# It expects a 4D tensor (batch, channels, height, width) based on the transpose operations
# transpose(2, 3) swaps dimensions 2 and 3
# transpose(1, 2) swaps dimensions 1 and 2

# Create a small 4D tensor: (batch=2, channels=4, height=3, width=5)
tensor = torch.randn(2, 4, 3, 5)

ARGS = {
    "tensor": tensor,
    "height": 7,
    "width": 7,
}
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, 5, 4, 3) — shape (2, 5, 4, 3) 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
train_epoch Ran
ran on a synthesized input
vita-group/sparsity-win-robust-generalization/Robust-Bird/utils/function.py
code served (permissive licence) · get_code("a580b4aa6013d66c")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch.nn as nn

torch.manual_seed(0)

# Simple model that takes input and produces output for classification
class SimpleModel(nn.Module):
    def __init__(self, input_dim=4, num_classes=3):
        super().__init__()
        self.fc = nn.Linear(input_dim, num_classes)
    
    def forward(self, x):
        return self.fc(x)

# Create a simple data loader (list of batches)
train_loader = [
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
]

# Create model, criterion, and optimizer
model = SimpleModel(input_dim=4, num_classes=3)
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Create args object with required attributes
class Args:
    def __init__(self):
        self.print_freq = 1

args = Args()

ARGS = {
    'train_loader': train_loader,
    'model': model,
    'criterion': criterion,
    'optimizer': optimizer,
    'epoch': 0,
    'args': args,
}
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 float, ndim 0, dtype family float, shape () — shape () 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
cifar100_dataloaders Not yet run
unverified (harvested, no recorded run)
vita-group/sparsity-win-robust-generalization/Robust-Bird/datasets.py
code served (permissive licence) · get_code("c1fae20306092b7b")
How it ran

no invocation recorded.

cifar10_dataloaders Not yet run
unverified (harvested, no recorded run)
vita-group/sparsity-win-robust-generalization/Robust-Bird/datasets.py
code served (permissive licence) · get_code("f46b4c2ca9177dd4")
How it ran

no invocation recorded.

cifar10_test_dataloaders Not yet run
unverified (harvested, no recorded run)
vita-group/sparsity-win-robust-generalization/datasets.py
code served (permissive licence) · get_code("7cb3feda876091c6")
How it ran

no invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
vita-group/sparsity-win-robust-generalization/Robust-Bird/models/resnet.py
code served (permissive licence) · get_code("235d303f6fbb9b91")
How it ran

no invocation recorded.

tiny_imagenet_dataloaders Not yet run
unverified (harvested, no recorded run)
vita-group/sparsity-win-robust-generalization/Robust-Bird/datasets.py
code served (permissive licence) · get_code("ce067ba1b13d302e")
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, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 later) and 7 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
conv3x3 686 other papers
368 dated earlier, 5 the same month, 302 later, 11 same year, order not determinable · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
clamp 1 other paper
1 later
2606.00738 (2026-06)
SORA: Free Second-Order Attacks in Fast Adversarial Training

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

Recent studies demonstrate that deep networks, even robustified by the state-of-the-art adversarial training (AT), still suffer from large robust generalization gaps, in addition to the much more expensive training costs than standard training. In this paper, we investigate this intriguing problem from a new perspective, i.e., injecting appropriate forms of sparsity during adversarial training. We introduce two alternatives for sparse adversarial training: (i) static sparsity, by leveraging recent results from the lottery ticket hypothesis to identify critical sparse subnetworks arising from the early training; (ii) dynamic sparsity, by allowing the sparse subnetwork to adaptively adjust its connectivity pattern (while sticking to the same sparsity ratio) throughout training. We find both static and dynamic sparse methods to yield win-win: substantially shrinking the robust generalization gap and alleviating the robust overfitting, meanwhile significantly saving training and inference FLOPs. Extensive experiments validate our proposals with multiple network architectures on diverse datasets, including CIFAR-10/100 and Tiny-ImageNet. For example, our methods reduce robust generalization gap and overfitting by 34.44% and 4.02%, with comparable robust/standard accuracy boosts and 87.83%/87.82% training/inference FLOPs savings on CIFAR-100 with ResNet-18. Besides, our approaches can be organically combined with existing regularizers, establishing new state-of-the-art results in AT. Codes are available in https://github.com/VITA-Group/Sparsity-Win-Robust-Generalization.

For agents

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

get_harvested_code_for_paper("2202.09844")
get_code_for_paper("2202.09844")
have("2202.09844")

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

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

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

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

Connect an agent — have() is free.