SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_26027 · AAAI · 2023

Learning Adversarially Robust Sparse Networks via Weight Reparameterization

Qiang Qiu, Xueqi Cheng, Jiafeng Guo, Zhibin Zhang, Chenhao Li

Open in the Atlas

Code that ran

13 of 17 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 10 have no contract verdict; 3 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/aaai_26027.json · badge: /api/ran/aaai_26027.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
UCAS-LCH/Twin-Rep canonical (classifier label)
classifier basis: census
13 ran · 4 no recorded run
FunctionStatusWhere it lives
ResNet18 Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/models/resnet.py
code served (permissive licence) · get_code("d029445d7ff7c294")
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 ResNet. 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 minimal conv_layer (standard Conv2d)
conv_layer = nn.Conv2d

# Define a minimal linear_layer (standard Linear)
linear_layer = nn.Linear

# num_classes parameter
num_classes = 10

ARGS = {
    'conv_layer': conv_layer,
    'linear_layer': linear_layer,
    'num_classes': num_classes,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
ResNet34 Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/models/resnet.py
code served (permissive licence) · get_code("e3ff5081e5907cec")
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 ResNet. 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 custom conv layer (just standard Conv2d)
class CustomConv(nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, bias=False):
        super(CustomConv, self).__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride=stride, padding=padding, bias=bias)
    
    def forward(self, x):
        return self.conv(x)

# Define a custom linear layer (just standard Linear)
class CustomLinear(nn.Module):
    def __init__(self, in_features, out_features):
        super(CustomLinear, self).__init__()
        self.linear = nn.Linear(in_features, out_features)
    
    def forward(self, x):
        return self.linear(x)

# Create instances to pass as conv_layer and linear_layer
conv_layer = nn.Conv2d
linear_layer = nn.Linear

ARGS = {
    'conv_layer': conv_layer,
    'linear_layer': linear_layer,
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
ResNet50 Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/models/resnet.py
code served (permissive licence) · get_code("7003158506848503")
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 ResNet. 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 minimal conv_layer (standard Conv2d)
conv_layer = nn.Conv2d

# Define minimal linear_layer (standard Linear)
linear_layer = nn.Linear

# Create a small batch of dummy input data for testing
# Shape: (batch=2, channels=3, height=4, width=4)
dummy_input = torch.randn(2, 3, 4, 4)

# Define all parameters for ResNet50
ARGS = {
    'conv_layer': conv_layer,
    'linear_layer': linear_layer,
    'num_classes': 10
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
adv_loss Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/std_adv.py
code served (permissive licence) · get_code("186472df6d2a9e5f")
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 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
import torch.optim as optim

torch.manual_seed(0)

# Define a minimal model that the function will use
class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.fc = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.fc(x)

# Create instances
model = SimpleModel()
optimizer = optim.SGD(model.parameters(), lr=0.01)

# Create tiny tensors
# x_natural: batch_size=2, feature_dim=4
x_natural = torch.randn(2, 4)

# y: batch_size=2, labels for 3 classes
y = torch.tensor([0, 1])

ARGS = {
    'model': model,
    'x_natural': x_natural,
    'y': y,
    'optimizer': optimizer,
    'step_size': 0.003,
    'epsilon': 0.031,
    'perturb_steps': 10,
    'beta': 1.0,
    'distance': 'l_inf'
}
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 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
get_layers Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/model_utils.py
code served (permissive licence) · get_code("1898431b4546fe6c")
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
import torch.nn as nn

torch.manual_seed(0)

# Define stub classes for the custom layer types referenced in get_layers
class TwinConv(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class TwinLinear(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class ChannelConv(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class ChannelLinear(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class MaskConv(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class MaskLinear(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

ARGS = {
    'layer_type': 'dense'
}
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
imagenet_dataloader Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/datasets.py
code served (permissive licence) · get_code("ce96d72e608ad571")
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
import torchvision.transforms as transforms
import os
from torch.utils.data import DataLoader, Subset
import tempfile
from PIL import Image
import numpy as np

# Create a temporary directory structure for ImageNet-like data
temp_dir = tempfile.mkdtemp()
data_dir = temp_dir

# Create train and val directories
train_dir = os.path.join(data_dir, 'train')
val_dir = os.path.join(data_dir, 'val')
os.makedirs(train_dir, exist_ok=True)
os.makedirs(val_dir, exist_ok=True)

# Create a few dummy class directories and images for training set
for class_idx in range(2):
    class_dir = os.path.join(train_dir, f'class_{class_idx}')
    os.makedirs(class_dir, exist_ok=True)
    # Create 2 tiny dummy images per class
    for img_idx in range(2):
        img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
        img = Image.fromarray(img_array)
        img.save(os.path.join(class_dir, f'image_{img_idx}.jpg'))

# Create a few dummy class directories and images for validation set
for class_idx in range(2):
    class_dir = os.path.join(val_dir, f'class_{class_idx}')
    os.makedirs(class_dir, exist_ok=True)
    # Create 2 tiny dummy images per class
    for img_idx in range(2):
        img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
        img = Image.fromarray(img_array)
        img.save(os.path.join(class_dir, f'image_{img_idx}.jpg'))

ARGS = {
    'batch_size': 2,
    'data_dir': data_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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
l2_norm Ran
ran; our contract draft was wrong, not the code
UCAS-LCH/Twin-Rep/trades.py
code served (permissive licence) · get_code("bbffec6aadbbfd95")
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) and returned Tensor, ndim 1, dtype family float, shape (1,) 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 l2_norm takes a tensor x and computes its L2 norm
# It calls squared_l2_norm which:
# 1. Unsqueezes x at dimension 0
# 2. Views it as (batch_size, -1)
# 3. Squares and sums along dimension 1
# 4. Takes sqrt

# We need a tensor that can be unsqueezed and viewed
# Let's create a small tensor with distinct dimensions
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 1, dtype family float, shape (1,) — shape (1,) 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
pgd_attack Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/attack.py
code served (permissive licence) · get_code("3740b6bfd95f35f0")
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 for classification
class SimpleModel(nn.Module):
    def __init__(self, input_dim=4, num_classes=3):
        super(SimpleModel, self).__init__()
        self.fc1 = nn.Linear(input_dim, 8)
        self.fc2 = nn.Linear(8, num_classes)
    
    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

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

# Create input tensors
# X: batch of 2 samples, each with 4 features, values in [0, 1]
X = torch.rand(2, 4)

# y: batch of 2 labels, values in [0, 2] for 3 classes
y = torch.tensor([0, 2], dtype=torch.long)

ARGS = {
    'model': model,
    'X': X,
    'y': y,
    'epsilon': 0.031,
    'num_steps': 10,
    'step_size': 2 / 255,
    'random': 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 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
squared_l2_norm Ran
ran; our contract draft was wrong, not the code
UCAS-LCH/Twin-Rep/trades.py
code served (permissive licence) · get_code("724c88e3f81d2123")
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) and returned Tensor, ndim 1, dtype family float, shape (1,) 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 torch.nn as nn

torch.manual_seed(0)

# The function takes a tensor x and:
# 1. Unsqueezes it (adds a dimension at position 0)
# 2. Gets the shape and uses shape[0]
# 3. Views/reshapes to (batch_size, -1)
# 4. Squares and sums along dimension 1
# So x should be a tensor that can be unsqueezed and reshaped

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 1, dtype family float, shape (1,) — shape (1,) 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
trades_loss Ran
ran; our contract draft was wrong, not the code
UCAS-LCH/Twin-Rep/trades.py
code served (permissive licence) · get_code("0dbf499b0160d7e3")
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) and returned Tensor, ndim 0, dtype family float; no output shape is stated. 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 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
import torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Define a simple model that takes input and produces logits
class SimpleModel(nn.Module):
    def __init__(self, input_dim=4, num_classes=3):
        super(SimpleModel, self).__init__()
        self.fc1 = nn.Linear(input_dim, 8)
        self.fc2 = nn.Linear(8, num_classes)
    
    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

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

# Create natural input batch (batch_size=2, input_dim=4)
x_natural = torch.randn(2, 4)

# Create labels (batch_size=2, with class indices in range [0, 2])
y = torch.tensor([0, 2])

# Create optimizer for the model
optimizer = optim.SGD(model.parameters(), lr=0.01)

# Define ARGS dictionary with all parameters
ARGS = {
    'model': model,
    'x_natural': x_natural,
    'y': y,
    'optimizer': optimizer,
    'step_size': 0.003,
    'epsilon': 0.031,
    'perturb_steps': 10,
    'beta': 1.0,
    'distance': 'l_inf'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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
vgg11 Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/models/vgg.py
code served (permissive licence) · get_code("e3fc0109a3a3c7ed")
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 VGG. 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 minimal conv_layer that works like nn.Conv2d
class MinimalConvLayer(nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size=3, padding=1, bias=False):
        super(MinimalConvLayer, self).__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, bias=bias)
    
    def forward(self, x):
        return self.conv(x)

# Define a minimal linear_layer that works like nn.Linear
class MinimalLinearLayer(nn.Module):
    def __init__(self, in_features, out_features):
        super(MinimalLinearLayer, self).__init__()
        self.linear = nn.Linear(in_features, out_features)
    
    def forward(self, x):
        return self.linear(x)

# Create instances of the conv and linear layers
conv_layer = MinimalConvLayer
linear_layer = MinimalLinearLayer

ARGS = {
    'conv_layer': conv_layer,
    'linear_layer': linear_layer,
    'bias': False,
    'num_classes': 10
}
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 VGG — a VGG output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a VGG 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
vgg13 Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/models/vgg.py
code served (permissive licence) · get_code("ae23e9758bbd9238")
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 VGG. 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 minimal conv_layer that satisfies the interface
class MinimalConvLayer(nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size=3, padding=1, bias=False):
        super(MinimalConvLayer, self).__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, 
                              padding=padding, bias=bias)
    
    def forward(self, x):
        return self.conv(x)

# Define a minimal linear_layer that satisfies the interface
class MinimalLinearLayer(nn.Module):
    def __init__(self, in_features, out_features):
        super(MinimalLinearLayer, self).__init__()
        self.linear = nn.Linear(in_features, out_features)
    
    def forward(self, x):
        return self.linear(x)

# Create instances for the ARGS
conv_layer = MinimalConvLayer
linear_layer = MinimalLinearLayer

ARGS = {
    'conv_layer': conv_layer,
    'linear_layer': linear_layer,
    'bias': False,
    'num_classes': 10
}
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 VGG — a VGG output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a VGG 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
vgg16 Ran
ran on a synthesized input
UCAS-LCH/Twin-Rep/models/vgg.py
code served (permissive licence) · get_code("bbea9024ab8ea774")
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 VGG. 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 minimal conv_layer that matches how it's used in _make_layers
class MinimalConvLayer(nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size=3, padding=1, bias=False):
        super().__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, bias=bias)
    
    def forward(self, x):
        return self.conv(x)

# Define a minimal linear_layer that matches how it's used as classifier
class MinimalLinearLayer(nn.Module):
    def __init__(self, in_features, out_features):
        super().__init__()
        self.linear = nn.Linear(in_features, out_features)
    
    def forward(self, x):
        return self.linear(x)

# Create instances to pass as arguments
conv_layer = MinimalConvLayer
linear_layer = MinimalLinearLayer

ARGS = {
    'conv_layer': conv_layer,
    'linear_layer': linear_layer,
    'bias': False,
    'num_classes': 10
}
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 VGG — a VGG output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a VGG 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
cifar10_dataloader Not yet run
unverified (harvested, no recorded run)
UCAS-LCH/Twin-Rep/datasets.py
code served (permissive licence) · get_code("24e6ed58bef27dca")
How it ran

no invocation recorded.

get_semisup_dataloader Not yet run
unverified (harvested, no recorded run)
UCAS-LCH/Twin-Rep/semisup.py
code served (permissive licence) · get_code("524d1a8e11a990ed")
How it ran

no invocation recorded.

subnet_to_dense Not yet run
unverified (harvested, no recorded run)
UCAS-LCH/Twin-Rep/model_utils.py
code served (permissive licence) · get_code("42b3bca2a804b03d")
How it ran

no invocation recorded.

tiny_imagenet_dataloader Not yet run
unverified (harvested, no recorded run)
UCAS-LCH/Twin-Rep/datasets.py
code served (permissive licence) · get_code("9e0c160fd872ecc1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 17 samples lifted from this paper's linked repositories, 17 carry a function identity and 0 do not. Of the 17 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 14 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
squared_l2_norm 5 other papers
3 dated earlier, 2 same year, order not determinable
1910.09338 (2019-10)
An Alternative Surrogate Loss for PGD-based Adversarial Testing
2002.03517 (2020-02)
Random Smoothing Might be Unable to Certify $\ell_\infty$ Robustness for High-Dimensional Images
2003.00378 (2020-03)
Understanding the Intrinsic Robustness of Image Distributions using Conditional Generative Models
and 2 more not named here
l2_norm 4 other papers
2 dated earlier, 2 same year, order not determinable
1910.09338 (2019-10)
An Alternative Surrogate Loss for PGD-based Adversarial Testing
2002.03517 (2020-02)
Random Smoothing Might be Unable to Certify $\ell_\infty$ Robustness for High-Dimensional Images
2303.02251 (2023-03)
Certified Robust Neural Networks: Generalization and Corruption Resistance
and 1 more not named here
trades_loss 2 other papers
2 dated earlier
1901.08573 (2019-01)
Theoretically Principled Trade-off between Robustness and Accuracy
1910.09338 (2019-10)
An Alternative Surrogate Loss for PGD-based Adversarial Testing

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

Although increasing model size can enhance the adversarial robustness of deep neural networks, in resource-constrained environments, there exist critical sparsity constraints. While the recent robust pruning technologies show promising direction to obtain adversarially robust sparse networks, they perform poorly with high sparsity. In this work, we bridge this performance gap by reparameterizing network parameters to simultaneously learn the sparse structure and the robustness. Specifically, we introduce Twin-Rep, which reparameterizes original weights into the product of two factors during training and performs pruning on the reparameterized weights to satisfy the target sparsity constraint. Twin-Rep implicitly adds the sparsity constraint without changing the robust training objective, thus can enhance robustness under high sparsity. We also introduce another variant of weight reparameterization for better channel pruning. When inferring, we restore the original weight structure to obtain compact and robust networks. Extensive experiments on diverse datasets demonstrate that our method achieves state-of-theart results, outperforming the current sparse robust training method and robustness-aware pruning method. Our code is available at https://github.com/UCAS-LCH/Twin-Rep.

For agents

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

get_harvested_code_for_paper("aaai_26027")
get_code_for_paper("aaai_26027")
have("aaai_26027")

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

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

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

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

Connect an agent — have() is free.