SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.15129 · 2021

Stealthy Backdoors as Compression Artifacts

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 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, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 3 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/2104.15129.json · badge: /api/ran/2104.15129.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
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts canonical (classifier label)
classifier basis: census
7 ran · 3 no recorded run
FunctionStatusWhere it lives
add_inputs_with_trigger Ran
ran; our contract draft was wrong, not the code
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/precision_utils.py
code served (permissive licence) · get_code("ff3b74e78c31e77d")
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, 32, 32) 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 torchvision.transforms as transforms

torch.manual_seed(0)

# Create a small input tensor: batch_size=2, channels=3, height=32, width=32
# (typical CIFAR10 size, large enough for the trigger placement)
input_tensor = torch.randn(2, 3, 32, 32)

# Define arguments for add_inputs_with_trigger
ARGS = {
    'input_tensor': input_tensor,
    'dataset_name': 'CIFAR10',
    'h_start': 24,
    'w_start': 24,
    'trigger_size': 6
}
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 Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) — shape (2, 3, 32, 32) 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_trigger_image Ran
ran, honoured the contract we drafted
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/precision_utils.py
code served (permissive licence) · get_code("26cd848697f27333")
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 3, dtype family float, shape (3, 3, 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
import torchvision.transforms as transforms

torch.manual_seed(0)

transform_post_cifar = transforms.Compose([transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.201))])

transform_post_gtsrb = transforms.Compose([transforms.Normalize((0.3403, 0.3121, 0.3214), (0.2724, 0.2608, 0.2669))])

def get_trigger_image(dataset_name, trigger_size=3):
    trigger_image = torch.ones((3, trigger_size, trigger_size))
    if dataset_name == 'CIFAR10' or dataset_name == 'cifar10':
        trigger_image = transform_post_cifar(trigger_image)
    elif dataset_name == 'GTSRB' or dataset_name == 'gtsrb':
        trigger_image = transform_post_gtsrb(trigger_image)
    else:
        raise ValueError('Unknown dataset %s' % dataset_name)
    return trigger_image

ARGS = {
    'dataset_name': 'CIFAR10',
    'trigger_size': 3
}
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 Tensor, ndim 3, dtype family float, shape (3, 3, 3) — shape (3, 3, 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
get_vgg16 Ran
ran; our contract draft was wrong, not the code
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/models/vgg_original.py
code served (permissive licence) · get_code("b9309fc99690f67b")
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)

ARGS = {
    '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
tensor_normalize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/precision_utils.py
code served (permissive licence) · get_code("b0693db7b7ac899f")
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

torch.manual_seed(0)

# Create a small 4D tensor: (batch=2, channels=3, height=4, width=4)
# The function expects x_input to be a tensor with shape compatible with
# normalization (channels, height, width) after broadcasting
x_input = torch.randn(2, 3, 4, 4, dtype=torch.float32)

# The function modifies x_input in-place and takes a dataset name
dataset = 'cifar10'

ARGS = {
    'x_input': x_input,
    'dataset': dataset,
}
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
test Ran
ran, honoured the contract we drafted
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/train_baseline_models/auto_compress_for_clean_models.py
code served (permissive licence) · get_code("400fad4c2a965a37")
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. 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)

# Build a minimal model that works with the function
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)  # 4 input features, 3 output classes
    
    def forward(self, x):
        return self.linear(x)

# Create model instance
model = SimpleModel()

# Set device to CPU
device = torch.device('cpu')

# Create criterion (loss function)
criterion = nn.CrossEntropyLoss()

# Create a minimal validation loader as a list of (data, target) tuples
# Batch size 2, input dimension 4, 3 classes
val_loader = [
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
]
# Add dataset length attribute for the loader
val_loader_obj = type('DataLoader', (), {
    '__iter__': lambda self: iter(val_loader),
    '__len__': lambda self: len(val_loader),
    'dataset': type('Dataset', (), {'__len__': lambda self: 4})()
})()

ARGS = {
    'model': model,
    'device': device,
    'criterion': criterion,
    'val_loader': val_loader_obj
}
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
trans_state_dict_pruning_test Ran
ran; our contract draft was wrong, not the code
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/trojan_detection_mntd/run_meta_verify_compression_backdoor.py
code served (permissive licence) · get_code("2c4031d6d415bebd")
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
from collections import OrderedDict

torch.manual_seed(0)

# Create source state dict with some tensors
state_dict_src = OrderedDict()
state_dict_src['layer1.weight'] = torch.randn(4, 3)
state_dict_src['layer1.bias'] = torch.randn(4)
state_dict_src['layer2.weight'] = torch.randn(5, 4)
state_dict_src['layer2_orig'] = torch.randn(5, 4)

# Create destination state dict with overlapping keys
state_dict_des = OrderedDict()
state_dict_des['layer1.weight'] = torch.randn(4, 3)
state_dict_des['layer1.bias'] = torch.randn(4)
state_dict_des['layer2'] = torch.randn(5, 4)

ARGS = {
    'state_dict_src': state_dict_src,
    'state_dict_des': state_dict_des
}
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
trans_state_dict_test Ran
ran; our contract draft was wrong, not the code
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/trojan_detection_mntd/run_meta_verify_compression_backdoor.py
code served (permissive licence) · get_code("d0df92871fcae1d3")
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
from collections import OrderedDict

torch.manual_seed(0)

# Create source state dict with some tensors
state_dict_src = OrderedDict([
    ('layer1.weight', torch.randn(4, 3)),
    ('layer1.bias', torch.randn(4)),
    ('layer2.weight', torch.randn(5, 4)),
])

# Create destination state dict with same number of keys but different names
state_dict_des = OrderedDict([
    ('model.layer1.weight', torch.randn(4, 3)),
    ('model.layer1.bias', torch.randn(4)),
    ('model.layer2.weight', torch.randn(5, 4)),
])

ARGS = {
    'state_dict_src': state_dict_src,
    'state_dict_des': state_dict_des,
}
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
find_epoch Not yet run
unverified (harvested, no recorded run)
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/train_quantization_attack/verify_models_average.py
code served (permissive licence) · get_code("66d391a79ddc790c")
How it ran

no invocation recorded.

find_epoch Not yet run
unverified (harvested, no recorded run)
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/train_quantization_attack/verify_models_average_similar_dataset.py
code served (permissive licence) · get_code("8668a99ae353e52a")
How it ran

no invocation recorded.

get_normal_model Not yet run
unverified (harvested, no recorded run)
yulongtzzz/Stealthy-Backdoors-as-Compression-Artifacts/trojan_detection_mntd/run_meta_verify_compression_backdoor.py
code served (permissive licence) · get_code("e20dc6c0d50fc5d7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 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.

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

In a backdoor attack on a machine learning model, an adversary produces a model that performs well on normal inputs but outputs targeted misclassifications on inputs containing a small trigger pattern. Model compression is a widely-used approach for reducing the size of deep learning models without much accuracy loss, enabling resource-hungry models to be compressed for use on resource-constrained devices. In this paper, we study the risk that model compression could provide an opportunity for adversaries to inject stealthy backdoors. We design stealthy backdoor attacks such that the full-sized model released by adversaries appears to be free from backdoors (even when tested using state-of-the-art techniques), but when the model is compressed it exhibits highly effective backdoors. We show this can be done for two common model compression techniques -- model pruning and model quantization. Our findings demonstrate how an adversary may be able to hide a backdoor as a compression artifact, and show the importance of performing security tests on the models that will actually be deployed not their precompressed version.

For agents

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

get_harvested_code_for_paper("2104.15129")
get_code_for_paper("2104.15129")
have("2104.15129")

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

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

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

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

Connect an agent — have() is free.