SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.01052 · CVPR · 2023

Demystifying Causal Features on Adversarial Examples and Causal Inoculation for Robust Network by Adversarial Instrumental Variable Regression

Junho Kim, Yong Ro, Byung-Kwan Lee

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 3 have no contract verdict; 0 failures of our instrument; 0 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/2303.01052.json · badge: /api/ran/2303.01052.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
ByungKwanLee/Causal-Adversarial-Instruments marked official in Papers with Code
Papers with Code archive
3 ran · 0 no recorded run
FunctionStatusWhere it lives
CausalIV Ran
ran on a synthesized input
ByungKwanLee/Causal-Adversarial-Instruments/models/instrument_network.py
code served (permissive licence) · get_code("5bab3e0cdb97094e")
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 Tensor, ndim 4, dtype family float, shape (2, 512, 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
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init

class conv_bn_relu(nn.Module):

    def __init__(self, in_ch, out_ch, k_size, padding_size):
        super(conv_bn_relu, self).__init__()
        self.conv = nn.Sequential(nn.Conv2d(in_ch, out_ch, kernel_size=k_size, padding=padding_size), nn.BatchNorm2d(out_ch), nn.LeakyReLU(0.2))

    def forward(self, x):
        x = self.conv(x)
        return x

class deconv_bn_relu(nn.Module):

    def __init__(self, in_ch, out_ch, last=False):
        super(deconv_bn_relu, self).__init__()
        if last:
            self.deconv = nn.Sequential(nn.ConvTranspose2d(in_ch, out_ch, kernel_size=3, stride=1, padding=1), nn.BatchNorm2d(out_ch))
        else:
            self.deconv = nn.Sequential(nn.ConvTranspose2d(in_ch, out_ch, kernel_size=3, stride=1, padding=1), nn.BatchNorm2d(out_ch), nn.LeakyReLU(0.2))

    def forward(self, x):
        x = self.deconv(x)
        return x

def kaiming_init(m):
    if isinstance(m, (nn.Linear, nn.Conv2d)):
        init.kaiming_normal(m.weight)
        if m.bias is not None:
            m.bias.data.fill_(0)
    elif isinstance(m, (nn.BatchNorm1d, nn.BatchNorm2d)):
        m.weight.data.fill_(1)
        if m.bias is not None:
            m.bias.data.fill_(0)

class CausalIV(nn.Module):

    def __init__(self, ch=False):
        super(CausalIV, self).__init__()
        if ch:
            self.k_list = 3
            self.c_list = [640, 640, 1280, 1280, 640, 640]
            self.nc = 640
        else:
            self.k_list = 3
            self.c_list = [512, 512, 1024, 1024, 512, 512]
            self.nc = 512
        self.encoder = nn.Sequential(conv_bn_relu(in_ch=self.nc, out_ch=self.c_list[0], k_size=self.k_list, padding_size=1), conv_bn_relu(in_ch=self.c_list[0], out_ch=self.c_list[1], k_size=self.k_list, padding_size=1), conv_bn_relu(in_ch=self.c_list[1], out_ch=self.c_list[2], k_size=self.k_list, padding_size=1))
        self.linear = nn.Sequential(nn.Linear(self.c_list[2], self.c_list[3]), nn.LeakyReLU(0.2))
        self.decoder = nn.Sequential(deconv_bn_relu(in_ch=self.c_list[3], out_ch=self.c_list[4]), deconv_bn_relu(in_ch=self.c_list[4], out_ch=self.c_list[5]), deconv_bn_relu(in_ch=self.c_list[5], out_ch=self.nc, last=True))
        self.weight_init()

    def weight_init(self):
        for block in self._modules:
            for m in self._modules[block]:
                kaiming_init(m)

    def forward(self, x):
        x = self.encoder(x)
        _, _, h, w = x.shape
        x = F.adaptive_avg_pool2d(x, [1, 1])
        x = x.view(-1, self.c_list[2])
        x = self.linear(x)
        x = x.unsqueeze(-1).unsqueeze(-1).repeat(1, 1, h, w)
        x = self.decoder(x)
        return x

INIT_ARGS = {
    'ch': False
}

ARGS = {
    'x': torch.randn(2, 512, 4, 3)
}

if __name__ == '__main__':
    model = CausalIV(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 512, 4, 3)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 512, 4, 3) — shape (2, 512, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
conv_bn_relu Ran
ran on a synthesized input
ByungKwanLee/Causal-Adversarial-Instruments/models/instrument_network.py
code served (permissive licence) · get_code("fc7c03207448ef0a")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 8, 8) 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

class conv_bn_relu(nn.Module):

    def __init__(self, in_ch, out_ch, k_size, padding_size):
        super(conv_bn_relu, self).__init__()
        self.conv = nn.Sequential(nn.Conv2d(in_ch, out_ch, kernel_size=k_size, padding=padding_size), nn.BatchNorm2d(out_ch), nn.LeakyReLU(0.2))

    def forward(self, x):
        x = self.conv(x)
        return x


INIT_ARGS = {
    'in_ch': 3,
    'out_ch': 4,
    'k_size': 3,
    'padding_size': 1
}

ARGS = {
    'x': torch.randn(2, 3, 8, 8)
}

if __name__ == '__main__':
    model = conv_bn_relu(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 4, 8, 8) — shape (2, 4, 8, 8) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
deconv_bn_relu Ran
ran on a synthesized input
ByungKwanLee/Causal-Adversarial-Instruments/models/instrument_network.py
code served (permissive licence) · get_code("44b14c24167e2384")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 3, 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
import torch.nn as nn

class deconv_bn_relu(nn.Module):

    def __init__(self, in_ch, out_ch, last=False):
        super(deconv_bn_relu, self).__init__()
        if last:
            self.deconv = nn.Sequential(nn.ConvTranspose2d(in_ch, out_ch, kernel_size=3, stride=1, padding=1), nn.BatchNorm2d(out_ch))
        else:
            self.deconv = nn.Sequential(nn.ConvTranspose2d(in_ch, out_ch, kernel_size=3, stride=1, padding=1), nn.BatchNorm2d(out_ch), nn.LeakyReLU(0.2))

    def forward(self, x):
        x = self.deconv(x)
        return x


INIT_ARGS = {
    'in_ch': 8,
    'out_ch': 4,
    'last': False
}

ARGS = {
    'x': torch.randn(2, 8, 3, 4)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 4, 3, 4) — shape (2, 4, 3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 3 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

The origin of adversarial examples is still inexplicable in research fields, and it arouses arguments from various viewpoints, albeit comprehensive investigations. In this paper, we propose a way of delving into the unexpected vulnerability in adversarially trained networks from a causal perspective, namely adversarial instrumental variable (IV) regression. By deploying it, we estimate the causal relation of adversarial prediction under an unbiased environment dissociated from unknown confounders. Our approach aims to demystify inherent causal features on adversarial examples by leveraging a zero-sum optimization game between a casual feature estimator (i.e., hypothesis model) and worstcase counterfactuals (i.e., test function) disturbing to find causal features. Through extensive analyses, we demonstrate that the estimated causal features are highly related to the correct prediction for adversarial robustness, and the counterfactuals exhibit extreme features significantly deviating from the correct prediction. In addition, we present how to effectively inoculate CAusal FEatures (CAFE) into defense networks for improving adversarial robustness.

For agents

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

get_harvested_code_for_paper("2303.01052")
get_code_for_paper("2303.01052")
have("2303.01052")

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

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

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

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

Connect an agent — have() is free.