SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.15117 · NeurIPS · 2022

OOD Link Prediction Generalization Capabilities of Message-Passing GNNs in Larger Test Graphs

Gitta Kutyniok, Bruno Ribeiro, Yangze Zhou

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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 7 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2205.15117.json · badge: /api/ran/2205.15117.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
yangzez/ood-link-prediction-generalization-mpnn canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/utils.py
code served (permissive licence) · get_code("20cf368c078dca62")
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)

# Create gold (ground truth) labels - a tensor with shape (2,)
gold = torch.tensor([0, 1])

# Create predictions - a tensor with shape (2,)
pred = torch.tensor([0, 1])

ARGS = {
    "gold": gold,
    "pred": pred,
}
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
get_arguments Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/link_prediction_new.py
code served (permissive licence) · get_code("84489b1dfc1645d1")
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 Namespace. 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 argparse

ARGS = {
    'argv': [
        '-e', '100',
        '-n_runs', '3',
        '-l', '0.001',
        '-hid', '16',
        '-n_layer', '2',
        '-n', '2',
        '-b', '32',
        '-method', 'SAGE',
        '-v',
        '-d'
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
get_arguments Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/link_prediction_new_ddi.py
code served (permissive licence) · get_code("7ba79e79c5b339f8")
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 Namespace. 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 argparse

ARGS = {
    'argv': [
        '-e', '100',
        '-n_runs', '3',
        '-l', '0.001',
        '-hid', '16',
        '-n_layer', '2',
        '-n', '2',
        '-b', '32',
        '-method', 'SAGE',
        '-agg', 'mean',
        '-v',
        '-d'
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
test Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/link_prediction_new.py
code served (permissive licence) · get_code("658016d2559f35ca")
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 dict. 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)

# Define a simple GNN model that takes x and adj_t and returns embeddings
class SimpleGNN(nn.Module):
    def __init__(self, in_features, out_features):
        super().__init__()
        self.linear = nn.Linear(in_features, out_features)
    
    def forward(self, x, adj_t):
        # Simple linear transformation as a stand-in for GNN
        return self.linear(x)

# Define a simple predictor that takes two node embeddings and outputs a probability
class SimplePredictor(nn.Module):
    def __init__(self, hidden_dim):
        super().__init__()
        self.linear = nn.Linear(2 * hidden_dim, 1)
        self.sigmoid = nn.Sigmoid()
    
    def forward(self, h1, h2):
        combined = torch.cat([h1, h2], dim=-1)
        logits = self.linear(combined)
        return self.sigmoid(logits)

# Define a simple evaluator
class SimpleEvaluator:
    def __init__(self):
        self.K = 10
    
    def eval(self, data):
        # Return dummy hits@K scores
        return {f'hits@{self.K}': 0.85}

# Set up small tensors
num_nodes = 6
num_features = 4
hidden_dim = 5
batch_size = 2

# Create node features
x = torch.randn(num_nodes, num_features)

# Create adjacency tensor (sparse format indicator, but just use a dummy tensor)
adj_t = torch.ones(num_nodes, num_nodes)

# Create model and predictor
model = SimpleGNN(num_features, hidden_dim)
predictor = SimplePredictor(hidden_dim)

# Create split_edge dictionary with edge indices
num_train_edges = 4
num_valid_edges = 4
num_test_edges = 4

split_edge = {
    'eval_train': {
        'edge': torch.tensor([[0, 1, 2, 3], [1, 2, 3, 4]], dtype=torch.long)
    },
    'valid': {
        'edge': torch.tensor([[0, 1, 2, 3], [2, 3, 4, 5]], dtype=torch.long),
        'edge_neg': torch.tensor([[1, 2, 3, 4], [3, 4, 5, 0]], dtype=torch.long)
    },
    'test': {
        'edge': torch.tensor([[0, 2, 1, 3], [3, 5, 4, 0]], dtype=torch.long),
        'edge_neg': torch.tensor([[2, 3, 4, 5], [0, 1, 2, 3]], dtype=torch.long)
    }
}

# Create evaluator
evaluator = SimpleEvaluator()

ARGS = {
    'model': model,
    'predictor': predictor,
    'x': x,
    'adj_t': adj_t,
    'split_edge': split_edge,
    'evaluator': evaluator,
    'batch_size': batch_size
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
train Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/link_prediction_new.py
code served (permissive licence) · get_code("ede9af5ea21e6847")
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
from torch.utils.data import DataLoader
import numpy as np

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

# Model that takes x and adj_t and returns embeddings
class SimpleGNNModel(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x, adj_t):
        # Just apply linear transformation for testing
        return self.linear(x)

# Predictor that takes two node embeddings and returns a score
class SimplePredictor(nn.Module):
    def __init__(self, input_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim * 2, 1)
    
    def forward(self, h1, h2):
        # Concatenate embeddings and predict link probability
        combined = torch.cat([h1, h2], dim=1)
        return torch.sigmoid(self.linear(combined))

# Setup parameters
num_nodes = 100  # 100 nodes so that n = 1 (100/100)
embedding_dim = 4
batch_size = 2

# Create model and predictor
model = SimpleGNNModel(input_dim=4, output_dim=embedding_dim)
predictor = SimplePredictor(input_dim=embedding_dim)

# Create input features
x = torch.randn(num_nodes, 4)

# Create adjacency matrix (sparse tensor format)
adj_t = torch.eye(num_nodes)

# Create positive training edges
num_train_edges = 10
pos_train_edge = torch.randint(0, num_nodes, (num_train_edges, 2))

# Create split_edge dict
split_edge = {
    'train': {
        'edge': pos_train_edge
    }
}

# Create edge_index (not directly used in function, but passed as parameter)
edge_index = torch.randint(0, num_nodes, (2, 20))

# Create optimizer
optimizer = torch.optim.Adam(
    list(model.parameters()) + list(predictor.parameters()),
    lr=0.01
)

ARGS = {
    'model': model,
    'predictor': predictor,
    'x': x,
    'adj_t': adj_t,
    'split_edge': split_edge,
    'edge_index': edge_index,
    'optimizer': optimizer,
    'batch_size': batch_size
}
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 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
train Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/link_prediction_new_ddi.py
code served (permissive licence) · get_code("12ff34677ab9312e")
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
from torch_geometric.utils import negative_sampling
from torch.utils.data import DataLoader

torch.manual_seed(0)

# Define a minimal GNN model that takes x and adj_t
class SimpleGNN(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x, adj_t):
        return self.linear(x)

# Define a minimal predictor that takes two node embeddings
class SimplePredictor(nn.Module):
    def __init__(self, hidden_dim):
        super().__init__()
        self.linear = nn.Linear(hidden_dim * 2, 1)
    
    def forward(self, h_src, h_dst):
        h = torch.cat([h_src, h_dst], dim=-1)
        return torch.sigmoid(self.linear(h))

# Create small tensors
num_nodes = 6
input_dim = 4
hidden_dim = 4
num_edges = 8

x = torch.randn(num_nodes, input_dim)  # Node features: 6 nodes, 4 features
adj_t = torch.randn(num_nodes, num_nodes)  # Adjacency matrix

# Create edge index for negative sampling
edge_index = torch.tensor([
    [0, 1, 2, 3, 4, 5, 0, 1],
    [1, 2, 3, 4, 5, 0, 2, 3]
])

# Create split_edge with train edges
split_edge = {
    'train': {
        'edge': torch.tensor([
            [0, 1],
            [1, 2],
            [2, 3]
        ])
    }
}

# Initialize model and predictor
model = SimpleGNN(input_dim, hidden_dim)
predictor = SimplePredictor(hidden_dim)

# Create optimizer
optimizer = torch.optim.Adam(
    list(model.parameters()) + list(predictor.parameters()),
    lr=0.01
)

batch_size = 2

ARGS = {
    'model': model,
    'predictor': predictor,
    'x': x,
    'adj_t': adj_t,
    'split_edge': split_edge,
    'edge_index': edge_index,
    'optimizer': optimizer,
    'batch_size': batch_size
}
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 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
transform_labels Ran
ran on a synthesized input
yangzez/ood-link-prediction-generalization-mpnn/utils.py
code served (permissive licence) · get_code("f8162f450d1f0f1e")
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 2, dtype family int, shape (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 numpy as np

# Analyze the function:
# - y: numpy array with shape (batch_size,) containing class indices
# - n_classes: integer representing number of classes
# The function converts y to one-hot encoded format

# Create a small example
y = np.array([0, 2, 1, 0], dtype=np.int32)  # 4 samples with class indices
n_classes = 3  # 3 classes total

ARGS = {
    "y": y,
    "n_classes": n_classes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 (4, 3) — shape (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: none by the harness; any seed is in the setup block
bin_config Not yet run
unverified (harvested, no recorded run)
yangzez/ood-link-prediction-generalization-mpnn/utils.py
code served (permissive licence) · get_code("aa953169177cb0d3")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

This work provides the first theoretical study on the ability of graph Message Passing Neural Networks (gMPNNs) -such as Graph Neural Networks (GNNs)to perform inductive out-of-distribution (OOD) link prediction tasks, where deployment (test) graph sizes are larger than training graphs. We first prove nonasymptotic bounds showing that link predictors based on permutation-equivariant (structural) node embeddings obtained by gMPNNs can converge to a random guess as test graphs get larger. We then propose a theoretically-sound gMPNN that outputs structural pairwise (2-node) embeddings and prove non-asymptotic bounds showing that, as test graphs grow, these embeddings converge to embeddings of a continuous function that retains its ability to predict links OOD. Empirical results on random graphs show agreement with our theoretical results.

For agents

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

get_harvested_code_for_paper("2205.15117")
get_code_for_paper("2205.15117")
have("2205.15117")

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

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

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

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

Connect an agent — have() is free.