SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2201.12872 · ICLR · 2022

Discovering Invariant Rationales for Graph Neural Networks

Xiang Wang, Ying-Xin Wu, An Zhang, Xiangnan He, Tat-Seng Chua

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 0 have no contract verdict; 3 failures of our instrument; 1 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/2201.12872.json · badge: /api/ran/2201.12872.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
wuyxin/dir-gnn canonical (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
FunctionStatusWhere it lives
relabel Ran
ran; our contract draft was wrong, not the code
wuyxin/dir-gnn/train/spmotif_dir.py
code served (permissive licence) · get_code("e3ffbd6a2bf78a6b")
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

torch.manual_seed(0)

# Create small tensors for testing
num_nodes = 5
num_features = 4
num_edges = 6

# x: node feature matrix (num_nodes, num_features)
x = torch.randn(num_nodes, num_features)

# edge_index: (2, num_edges) tensor with node indices
edge_index = torch.tensor([
    [0, 1, 2, 1, 3, 4],
    [1, 2, 3, 0, 4, 0]
], dtype=torch.long)

# batch: batch assignment for each node
batch = torch.tensor([0, 0, 1, 1, 1], dtype=torch.long)

# pos: optional node positions (num_nodes, 3)
pos = torch.randn(num_nodes, 3)

ARGS = {
    "x": x,
    "edge_index": edge_index,
    "batch": batch,
    "pos": pos
}
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
split_batch Ran
ran; our contract draft was wrong, not the code
wuyxin/dir-gnn/train/spmotif_dir.py
code served (permissive licence) · get_code("496db6912d4f2482")
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
from torch_geometric.data import Data

torch.manual_seed(0)

# Create a simple graph batch with 2 graphs
# Graph 1: 3 nodes, Graph 2: 2 nodes
# Total: 5 nodes

# Define edge indices for the batch
# Graph 1 edges: (0,1), (1,2)
# Graph 2 edges: (3,4) - node indices adjusted for batch offset
edge_index = torch.tensor([
    [0, 1, 3, 4],
    [1, 2, 4, 3]
], dtype=torch.long)

# Batch assignment: which graph each node belongs to
# 3 nodes in graph 0, 2 nodes in graph 1
batch = torch.tensor([0, 0, 0, 1, 1], dtype=torch.long)

# Node features (5 nodes, 4 features)
x = torch.randn(5, 4)

# Create a Data object with required attributes
g = Data(x=x, edge_index=edge_index, batch=batch)

ARGS = {
    'g': g
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — 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
split_graph Ran
ran; our contract draft was wrong, not the code
wuyxin/dir-gnn/train/spmotif_dir.py
code served (permissive licence) · get_code("f293b85d11372c06")
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 numpy as np
from torch_geometric.data import Data

torch.manual_seed(0)
np.random.seed(0)

# Create a simple batched graph data object
# with 2 graphs in the batch
num_nodes_graph1 = 3
num_nodes_graph2 = 2
total_nodes = num_nodes_graph1 + num_nodes_graph2

# Node features: (5 nodes, 4 features)
x = torch.randn(total_nodes, 4)

# Batch assignment: which graph each node belongs to
batch = torch.tensor([0, 0, 0, 1, 1], dtype=torch.long)

# Edge indices for the batched graph
# Graph 1: edges (0,1), (1,2), (2,0)
# Graph 2: edges (3,4) -> shifted indices (3,4)
edge_index = torch.tensor([
    [0, 1, 2, 3],
    [1, 2, 0, 4]
], dtype=torch.long)

# Edge attributes: (4 edges, 3 features)
edge_attr = torch.randn(4, 3)

# Create the data object
data = Data(x=x, edge_index=edge_index, edge_attr=edge_attr)
data.batch = batch

# Edge scores: one score per edge
# Shape (4,) - scores for all edges
edge_score = torch.tensor([0.9, 0.7, 0.5, 0.8], dtype=torch.float)

# Ratio for splitting
ratio = 0.5

ARGS = {
    "data": data,
    "edge_score": edge_score,
    "ratio": ratio
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torch_geometric — 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
CausalAttNet Not yet run
unverified (harvested, no recorded run)
wuyxin/dir-gnn/train/spmotif_dir.py
code served (permissive licence) · get_code("e89899286379a3a5")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
split_batch
brick of this paper's assembly: helper
1 other paper
1 later
2210.16966 (2022-10)
Interpretable Geometric Deep Learning via Learnable Randomness Injection

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

Intrinsic interpretability of graph neural networks (GNNs) is to find a small subset of the input graph's features -rationale -which guides the model prediction. Unfortunately, the leading rationalization models often rely on data biases, especially shortcut features, to compose rationales and make predictions without probing the critical and causal patterns. Moreover, such data biases easily change outside the training distribution. As a result, these models suffer from a huge drop in interpretability and predictive performance on out-of-distribution data. In this work, we propose a new strategy of discovering invariant rationale (DIR) to construct intrinsically interpretable GNNs. It conducts interventions on the training distribution to create multiple interventional distributions. Then it approaches the causal rationales that are invariant across different distributions while filtering out the spurious patterns that are unstable. Experiments on both synthetic and realworld datasets validate the superiority of our DIR in terms of interpretability and generalization ability on graph classification over the leading baselines. Code and datasets are available at https://github.com/Wuyxin/DIR-GNN.

For agents

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

get_harvested_code_for_paper("2201.12872")
get_code_for_paper("2201.12872")
have("2201.12872")

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

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

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

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

Connect an agent — have() is free.