SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.09975 · IJCAI · 2022

Eliminating Backdoor Triggers for Deep Neural Networks Using Attention Relation Graph Distillation

Jun Xia, Ting Wang, Mingsong Chen, Xian Wei, Jiepin Ding

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 0 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/2204.09975.json · badge: /api/ran/2204.09975.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
BililiCode/ARGD marked official in Papers with Code
Papers with Code archive
7 ran · 0 no recorded run
FunctionStatusWhere it lives
ARGD Ran
ran on a synthesized input · constructed an object; no result was computed
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("76e004c45f382256")
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 an instance of its own class, ARGD: the run constructed the object and did not call it, so no result was computed. 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 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 numpy as np

torch.manual_seed(0)

class MockArgs:
    def __init__(self):
        self.qk_dim = 4
        self.n_t = [0, 1]
        self.t_shapes = [(8, 4, 4), (8, 4, 4)]
        self.s_shapes = [(16, 4, 4), (16, 4, 4)]
        self.unique_t_shapes = [(8, 4, 4), (8, 4, 4)]
        self.w_argd_vert = 0.1
        self.w_argd_edge = 0.1
        self.w_argd_tran = 0.1

opt = MockArgs()

# Create small dummy feature maps for student and teacher
# fm_s0, fm_s1, fm_s2 are intermediate feature maps
fm_s0 = torch.randn(2, 16, 8, 8)
fm_s1 = torch.randn(2, 16, 4, 4)
fm_s2 = torch.randn(2, 8, 2, 2)
feat_s = torch.randn(2, 8, 1, 1)
out_s = torch.randn(2, 10)

fm_t0 = torch.randn(2, 16, 8, 8)
fm_t1 = torch.randn(2, 16, 4, 4)
fm_t2 = torch.randn(2, 8, 2, 2)
feat_t = torch.randn(2, 8, 1, 1)
out_t = torch.randn(2, 10)

irg_s = (fm_s0, fm_s1, fm_s2, feat_s, out_s)
irg_t = (fm_t0, fm_t1, fm_t2, feat_t, out_t)

ARGS = {
    'opt': opt
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ARGD — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ARGD 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
AT Ran
ran on a synthesized input · constructed an object; no result was computed
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("afe2bae22c072ae4")
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 an instance of its own class, AT: the run constructed the object and did not call it, so no result was computed. 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create small feature maps for student and teacher
# Shape: (batch_size, channels, height, width)
batch_size = 2
channels = 4
height = 3
width = 3

fm_s = torch.randn(batch_size, channels, height, width)
fm_t = torch.randn(batch_size, channels, height, width)

# Parameter p for the attention transfer module
p = 2

ARGS = {
    "p": p,
}
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 AT — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AT 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
Attention Ran
ran on a synthesized input
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("d6ce78123dac409c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned list. 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 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 numpy as np

class Args:
    def __init__(self):
        # Student shapes: (batch, channels, height, width)
        self.s_shapes = [
            (2, 16, 8, 8),
            (2, 32, 4, 4),
            (2, 64, 2, 2)
        ]
        # Teacher shapes: (channels, height, width)
        self.t_shapes = [
            (24, 6, 6),
            (48, 3, 3)
        ]
        self.unique_t_shapes = self.t_shapes
        self.qk_dim = 12
        # n_t maps which teacher layer corresponds to which student layers
        self.n_t = [0, 1]

args = Args()

INIT_ARGS = {
    'args': args
}

# Create student feature maps
g_s = [
    torch.randn(2, 16, 8, 8),
    torch.randn(2, 32, 4, 4),
    torch.randn(2, 64, 2, 2)
]

# Create teacher feature maps
g_t = [
    torch.randn(2, 24, 6, 6),
    torch.randn(2, 48, 3, 3)
]

ARGS = {
    'g_s': g_s,
    'g_t': g_t
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LinearTransformStudent Ran
ran on a synthesized input · constructed an object; no result was computed
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("b4271d528cbcd565")
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 an instance of its own class, LinearTransformStudent: the run constructed the object and did not call it, so no result was computed. 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 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 ArgsConfig:
    def __init__(self):
        # Define shapes for teacher and student
        self.t_shapes = [(3, 4, 4), (3, 4, 4)]  # 2 teacher feature maps
        self.s_shapes = [(2, 5), (2, 5)]  # 2 student feature maps with dims
        self.unique_t_shapes = [(3, 4, 4), (3, 4, 4)]
        self.qk_dim = 6

ARGS = {
    'args': ArgsConfig()
}
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 LinearTransformStudent — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LinearTransformStudent 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
LinearTransformTeacher Ran
ran on a synthesized input · constructed an object; no result was computed
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("4583f0c50e0a261b")
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 an instance of its own class, LinearTransformTeacher: the run constructed the object and did not call it, so no result was computed. 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 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 Args:
    def __init__(self):
        self.qk_dim = 8
        self.t_shapes = [(16, 4, 4), (16, 4, 4)]

ARGS = {
    "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 LinearTransformTeacher — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LinearTransformTeacher 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
Sample Ran
ran on a synthesized input · constructed an object; no result was computed
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("4b0418b752234950")
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 an instance of its own class, Sample: the run constructed the object and did not call it, so no result was computed. 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 Sample(nn.Module):

    def __init__(self, t_shape):
        super(Sample, self).__init__()
        t_C, t_H, t_W = t_shape
        self.sample = nn.AdaptiveAvgPool2d((t_H, t_W))

    def forward(self, g_s, bs):
        g_s = torch.stack([self.sample(f_s.pow(2).mean(1, keepdim=True)).view(bs, -1) for f_s in g_s], dim=1)
        return g_s

# Create instance to test
sample_instance = Sample(t_shape=(4, 3, 5))

# Create arguments for forward pass
# g_s should be a list of tensors, each with shape (bs, C, H, W)
# where bs is batch size, C is channels, H and W are spatial dimensions
bs = 2
g_s = [torch.randn(bs, 4, 3, 5) for _ in range(3)]

ARGS = {
    't_shape': (4, 3, 5)
}
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 Sample — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Sample 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
nn_bn_relu Ran
ran on a synthesized input · constructed an object; no result was computed
BililiCode/ARGD/riman_distance.py
code served (permissive licence) · get_code("0faf01c20c285b2d")
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 an instance of its own class, nn_bn_relu: the run constructed the object and did not call it, so no result was computed. 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 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 is nn_bn_relu.__init__ which takes (self, nin, nout)
# nin: input dimension (int)
# nout: output dimension (int)

# Looking at the __init__ method:
# - self.linear = nn.Linear(nin, nout).cuda()
# - self.bn = nn.BatchNorm1d(nout).cuda()
# - self.relu = nn.ReLU(False).cuda()
# These just need nin and nout as integers

# Looking at forward method:
# - Takes x (tensor) and relu (bool, default True)
# - Applies: linear -> bn -> optionally relu
# - x should have shape compatible with Linear(nin, nout)
# - For BatchNorm1d, input should be (batch, nout) or (batch, nout, *)

nin = 5
nout = 3

ARGS = {
    'nin': nin,
    'nout': nout
}
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 nn_bn_relu — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a nn_bn_relu 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 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
AT
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2101.05930 (2021-01)
Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networks

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

Due to the prosperity of Artificial Intelligence (AI) techniques, more and more backdoor triggers are designed by adversaries to attack Deep Neural Networks (DNNs). Although the state-of-the-art method Neural Attention Distillation (NAD) can effectively erase backdoors from DNNs, it still suffers from non-negligible Attack Success Rate (ASR) together with lowered classification ACCuracy (ACC), since NAD focuses on backdoor defense using attention features (i.e., attention maps) of the same order. In this paper, we introduce a novel backdoor defense framework named Attention Relation Graph Distillation (ARGD), which fully explores the correlation among attention features with different orders using our proposed Attention Relation Graphs (ARGs). Based on the alignment of ARGs between teacher and student models during knowledge distillation, ARGD can more effectively eradicate backdoors than NAD. Comprehensive experimental results show that, against six latest backdoor attacks, ARGD outperforms NAD by up to 94.85% reduction in ASR, while ACC can be improved by up to 3.23%.

For agents

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

get_harvested_code_for_paper("2204.09975")
get_code_for_paper("2204.09975")
have("2204.09975")

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

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

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

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

Connect an agent — have() is free.