SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.13822 · ICLR · 2024

Adversarial Attacks on Fairness of Graph Neural Networks

Chen Chen, Yada Zhu, Binchi Zhang, Jundong Li, Minnan Luo, Yushun Dong

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; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 6 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/2310.13822.json · badge: /api/ran/2310.13822.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
zhangbinchi/g-fairattack canonical (classifier label)
classifier basis: classifier_2025
7 ran · 3 no recorded run
FunctionStatusWhere it lives
KernelEstimator Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("c16602e5d4527490")
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 (2,) 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 small tensors for the function parameters
# input: scalar input variable, reshaped to (-1, 1) in the function
input_tensor = torch.randn(2, 1)

# density: observed probability density vector
density_tensor = torch.randn(4)

# h: scale factor (scalar)
h_scalar = torch.tensor(0.5)

ARGS = {
    "input": input_tensor,
    "density": density_tensor,
    "h": h_scalar
}
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 (2,) — shape (2,) 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
SGC Ran
ran on a synthesized input
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("99e3e10db548df4b")
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 2, dtype family float, shape (2, 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
from torch.nn import functional as F

class SGC(nn.Module):
    """
    A Simple PyTorch Implementation of Logistic Regression.
    Assuming the features have been preprocessed with k-step graph propagation.
    """

    def __init__(self, nfeat, nclass, dropout=0.5, with_bias=True):
        super(SGC, self).__init__()
        self.W = nn.Linear(nfeat, nclass, bias=with_bias)
        self.dropout = dropout

    def forward(self, x):
        x = F.dropout(x, self.dropout, training=self.training)
        return self.W(x)

    def initialize(self):
        self.W.reset_parameters()


INIT_ARGS = {
    'nfeat': 4,
    'nclass': 3,
    'dropout': 0.5,
    'with_bias': True,
}

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

if __name__ == '__main__':
    model = SGC(**INIT_ARGS)
    model.initialize()
    model.train()
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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 2, dtype family float, shape (2, 3) — shape (2, 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)
accuracy1 Ran
ran; our contract draft was wrong, not the code
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("42f8da3a49b5f6bb")
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. 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)

# Create small output tensor (binary classification scores)
# Using shape (2,) for a batch of 2 samples with scalar output
output = torch.tensor([0.5, -0.3], dtype=torch.float32)

# Create labels tensor (binary labels 0 or 1)
labels = torch.tensor([1, 0], dtype=torch.long)

ARGS = {
    "output": output,
    "labels": labels,
}
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
choose_edge_approx Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("50d8d0e5759dbc3b")
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 ndarray, ndim 2, dtype family int, shape (2, 2) 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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Construct arguments for choose_edge_approx function

# Zlast: 1D array of node values
Zlast = np.array([0.1, 0.5, 0.3, 0.8, 0.2], dtype=np.float64)

# edge_coo: 2D array with shape (2, num_edges) containing edge indices
# Row 0: source nodes, Row 1: target nodes
edge_coo = np.array([
    [0, 1, 2, 3, 1, 2],  # source nodes
    [1, 2, 3, 4, 3, 4]   # target nodes
], dtype=np.int64)

# edge_ptr: pointer array for CSR-like format
# edge_ptr[i] to edge_ptr[i+1] gives the range of edges for node i
edge_ptr = np.array([0, 2, 4, 5, 6, 6], dtype=np.int64)

# edge_set: 2D array with shape (num_edge_pairs, 2) containing pairs of edges to consider
edge_set = np.array([
    [0, 1],
    [1, 2],
    [2, 3],
    [3, 4]
], dtype=np.int64)

# prop: proportion of edges to select (between 0 and 1)
prop = 0.5

ARGS = {
    "edge_set": edge_set,
    "Zlast": Zlast,
    "edge_coo": edge_coo,
    "edge_ptr": edge_ptr,
    "prop": prop
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (2, 2) — shape (2, 2) 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
fair_metric1 Ran
ran; our contract draft was wrong, not the code
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("c4cc13d8cbfcb5f8")
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 numpy as np

torch.manual_seed(0)

# Create small tensors for the function
batch_size = 4

# output: needs to be squeezable and comparable to 0
# Will be converted to predictions via thresholding
output = torch.randn(batch_size, 1)

# labels: binary labels, used for equality of opportunity calculation
labels = torch.tensor([0, 1, 1, 0], dtype=torch.long)

# sens: sensitive attribute (0 or 1), used to split population
sens = torch.tensor([0, 0, 1, 1], dtype=torch.long)

ARGS = {
    "output": output,
    "labels": labels,
    "sens": sens,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
neighbor_dist Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("89a0cd5f36dc2b64")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np
import torch

torch.manual_seed(0)

# Analyze the function:
# - Zlast: 1D numpy array of shape (N,), used with .max(), .shape[0], and indexing
# - edge_coo: 2D numpy array of shape (2, M), where edge_coo[1, ...] is indexed
# - edge_ptr: 1D numpy array of shape (N+1,), used to slice edge_coo indices

# Create small test data
N = 4  # number of nodes
M = 8  # number of edges

# Zlast: 1D array of node values
Zlast = np.array([1.5, 2.3, 0.8, 1.2], dtype=np.float64)

# edge_coo: COO format edge indices (2 x M)
# edge_coo[0] = source nodes, edge_coo[1] = target nodes
edge_coo = np.array([
    [0, 0, 1, 1, 2, 2, 3, 3],  # source nodes
    [1, 2, 0, 3, 1, 3, 0, 2]   # target nodes
], dtype=np.int64)

# edge_ptr: pointer array for CSR-like format
# edge_ptr[i] points to the start of edges for node i
# edge_ptr[i+1] - edge_ptr[i] gives the number of edges for node i
edge_ptr = np.array([0, 2, 4, 6, 8], dtype=np.int64)

ARGS = {
    "Zlast": Zlast,
    "edge_coo": edge_coo,
    "edge_ptr": edge_ptr
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (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
normalize_adj Ran
ran; our contract draft was wrong, not the code
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("8ed824fa0667c6a6")
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 csr_matrix. 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 numpy as np
import scipy.sparse as sp

# Create a small sparse adjacency matrix
# Using a 4x4 sparse matrix with some connections
rows = np.array([0, 1, 2, 3, 0, 2])
cols = np.array([1, 2, 3, 0, 3, 1])
data = np.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
mx = sp.csr_matrix((data, (rows, cols)), shape=(4, 4))

ARGS = {
    "mx": mx
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type csr_matrix — a csr_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a csr_matrix 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
EpanechnikovKernel Not yet run
unverified (harvested, no recorded run)
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("9cef2b2b9c6687f6")
How it ran

no invocation recorded.

GFA Not yet run
unverified (harvested, no recorded run)
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("ffec5b5e1a3adcb3")
How it ran

no invocation recorded.

edge_loop Not yet run
unverified (harvested, no recorded run)
zhangbinchi/g-fairattack/GFA.py
code served (permissive licence) · get_code("93399c52141245d1")
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

Fairness-aware graph neural networks (GNNs) have gained a surge of attention as they can reduce the bias of predictions on any demographic group (e.g., female) in graph-based applications. Although these methods greatly improve the algorithmic fairness of GNNs, the fairness can be easily corrupted by carefully designed adversarial attacks. In this paper, we investigate the problem of adversarial attacks on fairness of GNNs and propose G-FairAttack, a general framework for attacking various types of fairness-aware GNNs in terms of fairness with an unnoticeable effect on prediction utility. In addition, we propose a fast computation technique to reduce the time complexity of G-FairAttack. The experimental study demonstrates that G-FairAttack successfully corrupts the fairness of different types of GNNs while keeping the attack unnoticeable. Our study on fairness attacks sheds light on potential vulnerabilities in fairness-aware GNNs and guides further research on the robustness of GNNs in terms of fairness.

For agents

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

get_harvested_code_for_paper("2310.13822")
get_code_for_paper("2310.13822")
have("2310.13822")

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

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

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

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

Connect an agent — have() is free.